Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - hoffa

Pages: 1 ... 3 4 [5] 6 7 ... 22
61
nSDL / Re: nSDL 1.0.2—A very fast & robust graphics library
« on: January 07, 2013, 06:33:35 pm »
There's no such thing as nDraw. Blitting (or "drawing" as I referred it to) is all part of standard SDL.

62
nSDL / Re: nSDL 1.0.2—A very fast & robust graphics library
« on: January 07, 2013, 04:35:23 pm »
Done!

I finally managed to port SDL_image. The relocation issues were so frustrating I today decided to hardcode the cancerous part. Here's nSDL drawing the OpenBSD fish loaded from a GIF file:



Using the freshly ported SDL_image (which can be downloaded, as usual, here), you can now load images of the following formats: GIF, LBM, PCX, PNM, TGA and XCF.

You should now be able to use much less memory to store those pictures as opposed to using BMP (or the in-code NTI format). GIF images are usually at least 4 times smaller than their BMP counterpart.

63
nSDL / Re: nSDL 1.0.2—A very fast & robust graphics library
« on: January 06, 2013, 05:03:06 pm »
(new page, can't raise awareness like this)
Everybody! Look at this! This violates all international humanitarian laws: http://ourl.ca/14975/333020

How is debugging property of EMI?
(maybe you were listening to some music during the debug session and youtube spotted them?)
Probably because I used "Don't Worry, Be Happy" as the background music.

@Hoffa what bugs are you encountering in fact ? Today I tried to port only the gif loading, and I didn't get any error other than "This file type is not supported" always. I just compiled SDL_image.h, IMG.c and IMG_gif.c (and removed all dependencies like constants and strings relatives to other formats). I just gave up after a few hours ;D but maybe I can help you debugging.
Yeah you have to define LOAD_GIF for it to even compile anything (otherwise it just compiles virtually empty functions, that's why you got the error). I have no idea what the issue nor do I want to think about it. It's some mix of relocation issues with ndless and pure magic. The behavior was irregular and completely illogical to even the most experienced human mind. Shit breaks down when it feels like it, next build doesn't, works with while but not for, reads one string but not the other, doesthefuckdoiknowwhat, etc.
It's worse than writing Brainfuck or Java, or trying to solve a Rubik's cube.

EDIT: Offtopic, but I got out of the Finnish Army this Friday. No more conscription. No more shaved head or asshole sergeants using you as a puppet. No more waking up at 6 AM, no more spending two weeks in the forest. No more 30-hour-long 70-km marches with 60 kg "camping" equipment on your back. No more APILAS, no more RK62, no more M72, no more TM 65 77, no more NSV. Feels great to back in normal life!


64
nSDL / Re: nSDL 1.0.2—A very fast & robust graphics library
« on: January 06, 2013, 04:47:53 pm »
Yeah, worst thing there's no logic at all behind the issues I'm having. And I've done some serious debugging before, but this just takes it all to a whole new level.

65
nSDL / Re: Frequently Asked Questions
« on: January 06, 2013, 04:28:56 pm »
Sorry to bother about it again, but in SDL_image, only 3 formats require an external lib to be read : jpeg, tiff and png. Personally, I'd be happy only with gif images :)
I tried. I can't at this stage. It's like I'm dealing with magic. I don't understand anything anymore. I'm frustrated as fsck. Please read (and watch) this, understand my pain dear brother:
http://ourl.ca/14975/333020

66
nSDL / Re: nSDL 1.0.2—A very fast & robust graphics library
« on: January 06, 2013, 04:24:48 pm »
Fuck me. For last few hours I've been trying to port SDL_image, and it has been one of the most frustrating experiences ever. I fucking hate debugging, someone please shoot me in the head, blow my brains out and burn my body with fire. ExtendeD I really would like you to fix the relocation issues, it's unbelievably horrible (but I suppose you know more than well enough the feeling I'm feeling right now, so no hurry). I even managed to film the whole process (actually now, the video begins after about 2 hours of debugging). Watch it. Feel my pain. We need to raise awareness!



I will never ever work as a code monkey in some gigantic corporation, I'd kill myself  before that. Debugging some mysterious black magic is not my thing. I don't mind coding but FUCK this is crazy my brain is completely fucked and I need to hit some boxing bag to release the tension inside me. My brain has been literally violated with the force of a thousand supermassive black holes. Goddamn global static arrays of structures with constant fucking strings and pointers to functions. The issues I'm having go against all the laws of physics and the behavior fluctuates faster than a Thai whore's mouth in Pattaya. It doesn't even have anything to do with the would-be complexity of the code. Even porting SDL and fixing its own flock of relocation issues wasn't this annoying. It should be a war crime to make me go through this kind of shit. If C was a person it would have been considered rape. Please ban me from the Internet for such vulgar terminology, tell me I'm a bad boy for saying no-no words and traumatizing the 7-year-old boys here. Give me a ticket, tell me I need to watch my language. Hack my IP, call the cyber cops, neg me to oblivion, tell your mom, I don't give a fuck. I feel like punching kittens right now.

Alright, calm down hoffa, everything's alright.

ALSO, I HATE THIS SHITTY LOW RESOLUTION ON MY LAPTOP.

67
nSDL / Re: Frequently Asked Questions
« on: January 06, 2013, 08:38:51 am »
Yeah, but JPEG and PNG are by far the most used formats. Also, just partially porting SDL_image wouldn't make it SDL_image anymore, but some dirty stripped spin-off.

Now that I think of it, a trimmed (and possibly renamed, to not confuse the user) version of SDL_image would probably be possible. I'll look into it.

68
nSDL / Frequently Asked Questions
« on: January 05, 2013, 04:48:04 pm »
  • What is nSDL?
    nSDL is a port of the widely used, cross-platform and open source SDL graphics library for the Ndless-fueled TI-Nspire.

  • What is SDL?
    According to Wikipedia, "SDL acts as a thin, cross-platform wrapper, providing support for 2D pixel operations, sound, file access, event handling, timing, threading, and more." It's basically a graphics library with event handling, timing and other nice little things.

  • Where can I download nSDL?
    On the nSDL website.

  • How do I install/use nSDL?
    Copy lib and include folders' content in the nSDL package to the respective folders in your Ndless SDK folder. To build your nSDL programs, use and adapt the Makefile.sample file.

  • Is there some nSDL wiki?
    Yeah.

  • Which version of SDL is nSDL based on?
    1.2.15.

  • Do I need to recompile my code for each machine separately?
    No, compile it once and it'll work on any of the calculators. If however it doesn't, check out some other part of the code isn't causing the trouble.

  • What functionalities of SDL are/aren't supported?
    Supported: video, events, SDL_GetTicks()
    Not supported: audio, threads, timers, mouse

  • Will there ever be mouse support?
    Most probably yes. There was partial mouse support in an earlier nSDL version, but it was removed in a later release because the behavior on CX and non-CX calculators was different, making it desperately frustrating to debug as I only have a Touchpad.

  • Are SDL_image or SDL_gfx supported?
    Yes, both have been ported and can be found here.

  • How do I draw text?
    Using the included nSDL-exclusive functions. First load the font with whatever color you want using nSDL_LoadFont(), then draw your stuff with nSDL_DrawString(), and finally free the font using nSDL_FreeFont(). Simple as that. Here's an example:

    nSDL_Font *font = nSDL_LoadFont(NSDL_FONT_TINYTYPE, 255, 0, 0);
    nSDL_DrawString(screen, font, 10, 10, "I love your string, baby.");
    nSDL_FreeFont(font);


    For more information about the different fonts and available flags, check this page out.

  • What are those nSDL-exclusive functions?
    Here's a list of them.

  • Can I draw text in different sizes?
    No.

  • How do I use cos(), sin() and other mathematical functions?
    Using the ported fdlibm library which can be found here. Just include libfdm.h in your code. It implements all of the functions defined in math.h. Install it the same way as you'd install nSDL. Remember to link fdlibm using the -lfdm switch.

  • Can I draw text in different sizes?
    No.

  • Where do I see which key is mapped to which SDL key value?
    Check out the last part of this file for the latest keymap.

  • Does it run Crysis?
    Yes, the latest tests show that nSDL runs Crysis at about 47 FPS in ultra (note to Fox News: the TI-Nspire doesn't actually run Crysis at 47 FPS). nSDL has been designed with performance in mind.


69
nSDL / Re: nSDL 1.0.2—A very fast & robust graphics library
« on: January 03, 2013, 03:09:28 pm »
  • In my program, I'm loading a bitmap with SDL_LoadBMP(path), but it seems that relative path doesn't work. If I have image.bmp.tns in the same directory as my program, just typing SDL_LoadBMP("image.bmp.tns"); doesn't work. Is there a way to fix that ?
Yeah that must be because of the way ndless (or syscalls, whatever) handle opening files (at some point in the code it's just calling fopen). Rather than implementing the relative path thing in nSDL, I think it would be better to do it in the fopen code itself for consistency across all programs. Despite that, I've never had to use "/documents/Examples/derp.bmp.tns" as the path, "Examples/derp.bmp.tns" has always worked IIRC.

  • Second question, I have sprites that have transparent parts, but it seems that transparency isn't supported due to the NTI format and get replaced by white 0xffff. Is there a way to use transparent sprites or are they forbidden ?
The format itself doesn't support transparency (neither does BMP), but SDL does support color keys for surfaces, and that's what you should be using. In the image, draw (in Paint or whatever) the parts that you want transparent with a certain color (#ff00ff is quite common) and after you've loaded it and have its SDL_Surface, do SDL_SetColorKey(surface, SDL_SRCCOLORKEY, SDL_MapRGB(screen->format, 0xff, 0x00, 0xff)). More info here.

70
nSDL / Re: nSDL 1.0.2—A very fast & robust graphics library
« on: November 29, 2012, 11:50:56 am »
Tiny update that handles arrow keys better (diagonal arrow keys supported) and maps the Nspire's touchpad click button to SDLK_KB_ENTER. Those were supposed to be included in an update with functional mouse support, but as it's been taking so long and can't test my code on an actual TI-Nspire (and probably won't for long), I decided to push those changes to master so they're outta the way.

(Download's on the website, as usual)

71
TI-Nspire / Re: nCraft (3D minecraft-like game for the nspire)
« on: September 27, 2012, 01:29:52 pm »
Oh, true, my bad. Well, even if in theory everything did scale well and there would be no visual issues, I think it would complexify the code quite a bunch as the maths behind your technique might be difficult (mixing 2D and 3D maths is not easy) and I'm not sure if it's guaranteed it will handle all situations perfectly without some dirty hacks. Furthermore, I don't know if the eventual speed gain is enough to compensate for the pain of implementing the technique. But I might be wrong, if it is a (variation) of a proven rendering technique why not. However I believe there are simpler and faster alternatives (I'm not sure what those alternatives are, but looking at the Yeti3D demo on GBA makes me think they exist).

72
TI-Nspire / Re: nCraft (3D minecraft-like game for the nspire)
« on: September 27, 2012, 01:05:57 pm »
Isometric 3D would look extremely weird and is not at all suitable for first person games.

73
Calculator C / Re: [Ndless] Memory leaks happen anyway
« on: September 25, 2012, 02:32:12 pm »
It's quite a pain to read through the code because of the high amount of mallocs and whatnot. Clean up your code as much as possible (it may be possible that every malloc/free can be removed and replaced with static allocations) and try again, the crash could be caused by different things; I doubt it has anything to do with a memory leak.

74
Calculator C / Re: [Ndless] Memory leaks happen anyway
« on: September 25, 2012, 01:30:32 pm »
A few things: you're using dynamic allocations enormously, you should use static allocations a lot more. They're generally safer, easier to handle and makes your code more readable and maintainable. Only use malloc if the dynamic solution is actually better (i.e., when you know the size of your data structure, go for static allocation). In your case why not just have int activeShot[128] instead of activeShot = malloc(128 * sizeof(int)), for instance? It saves you from redundant memory management and avoids all the hassles of it.

Also there's no need to allocate memory for the screen surface, SDL takes care of it. SDL has a pretty good event system, you should use it for your key handling.

75
TI-Nspire / Re: nTris - Tetris for nSpire -
« on: September 24, 2012, 04:00:26 am »
Quote
There was something too that I found annoying with the game: pressing the down key makes the piece fall but holding down the key does nothing (I mean it gets down by one case then stops instead of keeping falling)
Me too, but just a little. One thing i forgot to mention in the "instructions" above, is that the user can always press the 'space-bar' to force the piece to fall to the bottom at once. Hope it helps.
You could just add something like SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL) during initialization and remove any dirty hacks that do exactly that but manually (I had a very quick look at the code, I think it's when pressing the horizontal arrow keys that it's done manually).

Pages: 1 ... 3 4 [5] 6 7 ... 22