SDL_init wont work?!?! [SOLVED]

Started by
8 comments, last by Panopticon 19 years, 6 months ago
Maybe I've been staring at this for too long, maybe I just dont understand c++ deeply enough, but for some reason after trying to convert my structured SDL game to OOP, the SDL_Init doesn't initialize. What am I missing?!?! Any help would be awsome! My Example using SDL and Dev-C++ p.s. I suspect it has something to do with my objects, losing scope..pointers...something, I dont know, I've become frustrated and useless. [Edited by - Panopticon on October 5, 2004 5:41:27 PM]
Advertisement
What do you mean it doesn't init? Does SDL_Init() fail? If so, what does SDL_GetError() return?
yes SDL_init does fail.
Quote:Original post by Panopticon
yes SDL_init does fail.
So what does SDL_Error() return?
Nothing....frustrating isn't it :D
*sigh* a zip file. fine, I'll be nice.

Hmm... whoever told you this was a good design is off their rocker. OO or not, it's not good this way. Always avoid the "stick everything in classes" people.

As for SDL_Init failing... are you sure the call to init is failing (do you see the fprintf) or are you just assuming that's the cause?

Edit: holy quick batman! four posts beating me!
    //Load bitmaps, initialize screen surface, etc...\   if( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_AUDIO) < 0 )    {        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());        return false;    }


The first line ends with a \, meaning that the comment continues on the next line. Basically, your call to SDL_Init is commented out.

FWIW, including windows.h and using GetTickCount defeats one of SDL's main features: portability. Removing the includes of windows.h and replacing GetTickCount with SDL_GetTicks allowed me to build your code on Linux. I just thought I'd let you know.

Hope this helps.
Back slash strikes again.
Quote:Original post by Anonymous Poster
*** Source Snippet Removed ***

The first line ends with a \, meaning that the comment continues on the next line. Basically, your call to SDL_Init is commented out.

FWIW, including windows.h and using GetTickCount defeats one of SDL's main features: portability. Removing the includes of windows.h and replacing GetTickCount with SDL_GetTicks allowed me to build your code on Linux. I just thought I'd let you know.

Hope this helps.

Lol! MSVC highlighted both lines as comments, but I assumed they were both intentional...
OH WOW....it was just that \ at the end
I can't believe that. ~smacks self~ yeesh.

I understand the windows.h reduces portability, the FPS counter will most likely be removed or port to use SDL. It was just so I could understand how calculating FPS would work.

ohya, what is wrong with the design?


edit: in my own defense that was the first time i've encountered that \ problem...something i will not forget about again ;)!!!

This topic is closed to new replies.

Advertisement