Jump to content
  • Advertisement
Sign in to follow this  
RedReaper132

C++ SDL. Help with surface

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

I need help from some experianced C++ SDL programmers. The problem is this: I created a surface and loaded an image into the surface: Then I blited the surface on the screen. The think i want is, that when the surface is blited and i press a button or i click on it that the surface siply changes. I have done anything to the point where i want to change the surface. My code is like this: SDL_FreeSurface(image); image = load_surface("image.png"); //The load_surface is a funkction that loads SDL_Flip(screen); The thing is that the blited surface doesn't change. I want to know how to change it without bliting the whole screen again(background and anything else) or without making the image a sprite with both pictures in it. Plese help.

Share this post


Link to post
Share on other sites
Advertisement
I think you misunderstand surfaces. They're just a bunch of pixels. Blitting an image to the screen just means copying the pixel values, it doesn't magically attach the image to the screen.
Blitting the whole screen is really the most simple way to do what you want. There are more efficient ways (google "dirty rectangles"), but they're more complicated.

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!