Ok well I've been following lazyfoo.net but I just can't do the "event driven programming" tutorial so here's my code, what is it that I am doing wrong?
load_files() keeps returning 2 for me?
im using Code::Blocks IDE and GCC compiler if that helps
VelloCretic wrote:Ok well I've been following lazyfoo.net but I just can't do the "event driven programming" tutorial so here's my code, what is it that I am doing wrong?
load_files() keeps returning 2 for me?
im using Code::Blocks IDE and GCC compiler if that helps
VelloCretic wrote:
I am suprised your compiler didnt catch those errors.
do you have -enable all compiler warnings set?
Code::Blocks doesn't have the luxury of catching such common mistakes by default. Dunno if changing warning level would fix that, but there are so many other reasons to switch from Code::Blocks to Visual Studio does it even matter (I was a long-time Code::Blocks fan, but am incredibly happy to have given VS an honest chance).
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
yes you're right it returns 1 not 2 ( i made a typo in the OP) and i fixed the areas where i had put = instead of ==,
i also found a if statement which was wrong being this,
I really dont see anything wrong with your load_files() function.
Have you checked the return value? Your problem could also reside in the load_image() function.
It is almost always better to use asset() statements to determine if you are dealling with a NULL pointer.
One other thought:
Since you created the screen in system memory, SDL_Flip() is actually calling SDL_UpdateRects().
Also try commenting out your error checking and just call the function as is and see if the debugger kicks in.
ok well i've just tried recompiling the code into VC++ 2010 and...
load_files returns true and the program continues but now when i try and run it, it executes the program fine until
what happens is when the program gets to this part of the code i get an error saying
"Unhandled exception at 0x6812a1ba in dep.exe: 0xC0000005: Access violation reading location 0x00000138."
i really have no idea what this error is or means , when i comment out the if statement calling SDL_Flip though the program returns 0 although it seems it skips over the loop but maybe that has something to do with refreshing the screen.
I think it's or VS, I'll try SDL_GetError in a sec
Edit: alright i replace SDL_Flip with SDL_Rect, instead of testing the load_files() function im just calling it and everything is working fine except the picture is not showing up, so maybe there is something wrong with either my load_image/load_files functions
eaane74 wrote:Sweet. I am glad you got it working.
I have nothing against lazyfoo, it is a excellent site to learn SDL and only SDL.
My only problem is the he does it with bad programming habits
Here is another good SDL tutorial site:( where I learned SDL ) http://iki.fi/sol/gp/
Come on... you can't hold that against him...He's not teaching programming, you should already know that if you going into game programming. His tutorials are about a graphics library that's all. His examples could just as well have been in pseudo-code.
P.S. Thosesol tutorials are awesome.. too bad I didn't understand anything from them .