Advertisement Jump to content
Sign in to follow this  

A couple of questions...

This topic is 4895 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

Ok, I've been working fervently on learning C/C++ as of late, so these questions might seem a little inane, so please bear with me. Ok, First off, I've been working with SDL. Now, I've written a function which loads a bmp and colorkey's the surface with the very first pixel, however, I'd like to be able to take the color of the bottom-left pixel instead... here's the problem. I have a pointer to where the pixel data is stored, but the data can be 8,16,24,32 bits in size. How can I get a meaningful value to use as a colorkey, and how would I get a 16 bit or 24 bit value when other data types are 8 and 32 bits? In general, how could I traverse a pointer by, say 8 bytes, and retrieve a long result? Ok, another one... This is something that probably comes second nature. What do you guys do in the event of a game pausing or a menu popping up on the screen where you still want to process the menu and mouse and pause screen, but you want to show the renderings in the back. Do you have a global variable that disables all objects from moving? do you take a screenshot and render that while the menu stuff is being done? I'll probably have more questions as time goes on. I truly appreciate any help.

Share this post

Link to post
Share on other sites
not sure how to answer the first since i don't use SDL

but for the second, i just have ae global variable called gameState; let's say i define gameState as an int and pause is 2

then you say if gameState is 2 then don't do the gameMain stuff

basically it's like this:

// in main loop

if(gameState != 2)


EDIT: i like ur games :) u are really good!

Share this post

Link to post
Share on other sites
For the menu question, I'd guess that most people simply push a new 'input handler'/'keybinding map' or whatever with the menu/pause screen. The new inputs would override the game's inputs, until the menu is disabled or the game resumed. The input handler would then be popped off a stack, leaving the game's inputs in control.

The background would continue rendering [or be paused seperately if you desire].

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!