Yes i have changed the color already to the background color this solution works fine now, im just curious on how to handle this when you got ( i uses this for an exampel now ) diffrent tiles that is beneath the button and when your hiding the button and covering it with a sdl rect like you just did then it whould cover the tiles and it whould look weird, or maybe im thinking wrong :P
anyway thanks alot for your patience and help
Deleting surfaces in SDL
Moderator: Coders of Rage
Re: Deleting surfaces in SDL
TorteXXX
- programmerinprogress
- Chaos Rift Devotee
- Posts: 632
- Joined: Wed Oct 29, 2008 7:31 am
- Current Project: some crazy stuff, i'll tell soon :-)
- Favorite Gaming Platforms: PC
- Programming Language of Choice: C++!
- Location: The UK
- Contact:
Re: Deleting surfaces in SDL
Well, the order things are drawn depends on the way you program them, in the example I showed you there, I placed the FillRect function before everything else was drawn, and then all of the object are drawn to the screen in the order you tell the program to draw them.
You can also come up with a system that implements a thing called a Z-order in your programs, basically you assign your objects different priorities(or Z-Orders) for drawing, to create the effect of foreground and background, or to prevent buttons from being overlapped by sprites.
This will probably be the priority for a program you write:
Top Layer = your buttons and your counters/text
Middle Layer = your sprites and moving objects
Bottom Layer = your background
You could also use some foreground, and make a separate level for panels(which would be under your buttons and text, but over your sprites)
You don't have to create anything extra (although this helps organise things), you could just draw everything in that order.
PS: also you're not covering anything, you're just clearing the surface and redrawing the images.
You can also come up with a system that implements a thing called a Z-order in your programs, basically you assign your objects different priorities(or Z-Orders) for drawing, to create the effect of foreground and background, or to prevent buttons from being overlapped by sprites.
This will probably be the priority for a program you write:
Top Layer = your buttons and your counters/text
Middle Layer = your sprites and moving objects
Bottom Layer = your background
You could also use some foreground, and make a separate level for panels(which would be under your buttons and text, but over your sprites)
You don't have to create anything extra (although this helps organise things), you could just draw everything in that order.
PS: also you're not covering anything, you're just clearing the surface and redrawing the images.
---------------------------------------------------------------------------------------
I think I can program pretty well, it's my compiler that needs convincing!
---------------------------------------------------------------------------------------
And now a joke to lighten to mood :D
I wander what programming language anakin skywalker used to program C3-PO's AI back on tatooine? my guess is Jawa :P
I think I can program pretty well, it's my compiler that needs convincing!
---------------------------------------------------------------------------------------
And now a joke to lighten to mood :D
I wander what programming language anakin skywalker used to program C3-PO's AI back on tatooine? my guess is Jawa :P
Re: Deleting surfaces in SDL
ahh ok, ill look more into Z-order once i get more a hang of SDL maybe after lazyfoo´s tutorials.
once again thank you for taking time to anwser and help me
once again thank you for taking time to anwser and help me
TorteXXX