Jump to content
  • Advertisement
Sign in to follow this  
Panopticon

SDL_init wont work?!?! [SOLVED]

This topic is 5404 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Advertisement
*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!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster

//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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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 ;)!!!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!