Author Topic: Help with SDL  (Read 1742 times)

0 Members and 1 Guest are viewing this topic.

Offline rfreak

  • Soldier
  • **
  • Posts: 152
Help with SDL
« on: June 08, 2007, 07:32:57 pm »
I just wanted to ask How can I make my Font be over the tiles in my game because the font dosent appear on the screen because the tile goes over

P.S. I'm using SDL_ttf for the font it's in C++ (I say this because I don't want anybody to ask me that question  ;D)
R the coolest game ever

Offline mar77a

  • Global Moderator
  • Veteran
  • *****
  • Posts: 1295
  • mad
    • random stuffs
Re: Help with SDL
« Reply #1 on: June 08, 2007, 07:36:30 pm »
apply the surface with the text after the surface with the tiles

Offline rfreak

  • Soldier
  • **
  • Posts: 152
Re: Help with SDL
« Reply #2 on: June 10, 2007, 09:56:01 am »
can you be more specific
R the coolest game ever

Offline Clawbug

  • Veteran
  • *****
  • Posts: 1393
  • 1184!
Re: Help with SDL
« Reply #3 on: July 04, 2007, 09:10:45 pm »
Well, first render the background, then the font, and flip the stuff to screen.

I don't really know how to excactly do this with SDL, but the basic idea is the same for every language anyway, I think.
Fight! Win! Prevail!

Offline truup

  • Soldier
  • **
  • Posts: 243
Re: Help with SDL
« Reply #4 on: July 10, 2007, 09:32:53 pm »
Well, first render the background, then the font, and flip the stuff to screen.
Would be like this:
Code: [Select]
// Blit the sprite/tile what ever you want to be behind on the buffer
SDL_BlitSurface(surface, NULL, screen, &rect);

// Blit the text surface
SDL_BlitSurface(text_surface, NULL , screen, &rect);

// Flip buffers
SDL_Flip(screen);
Sprites, text, everything you blit on the screen surface will appear in the order you put them in the code. Think about them as steel plate and iron plate. You put an iron plate in a box, then after that (In next line), you put the steel plate in the box. Which will be on the top? Steel plate since it was the last thing you put in there. 8)