Sign in to follow this  
RedReaper132

C++ SDL. Help with surface

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this