Yoshi mini-game

Show off your completed projects here, or keep us updated on a current project as you work on it!

Re: Yoshi mini-game

Postby Ginto8 on Tue Jul 13, 2010 7:56 pm

*gasp* that's cool. Is that lazyfoo's font I see?
Haiku's are pretty,
but sometimes they don't make sense.
Refrigerator.

BWAHAHAHA!
Image
User avatar
Ginto8
 
Posts: 167
Joined: Thu May 06, 2010 3:20 pm

Re: Yoshi mini-game

Postby adikid89 on Wed Jul 14, 2010 6:55 am

Yes :D I also had the background from lazyfoo :lol: . I only recently took it out. Lazyfoo rullz! His tutorials are awesome.
adikid89
 
Posts: 35
Joined: Tue May 04, 2010 2:01 pm

Re: Yoshi mini-game

Postby programmerinprogress on Wed Jul 14, 2010 9:39 am

Just a random technical question.

How did you find implementing the bitmap fonts? do they pretty much do what you need them to do or are they awkward to use in your program?

Also, are you using different bitmaps or scaling the bitmaps for the different sizes?

Nice project by the way, you're making some really good progress :D
programmerinprogress
 
Posts: 64
Joined: Mon Feb 01, 2010 8:15 am

Re: Yoshi mini-game

Postby adikid89 on Wed Jul 14, 2010 11:34 am

I actually just use ttf fonts with sdl_ttf functions wrapped around twice :) . I'm not exactly proud of it, but it's pretty much doing it's job pretty well.
Here's how the double wrapper works. I have a font class, that loads the font with TTF_Load() or something like that, can't remember thanks to oop design :), the class looks like this:
Code: Select all
class Font {
public:
   friend class FontManager;
   Font() {_size = 30; font=NULL; _text = NULL;}
   ~Font() { if(font) TTF_CloseFont(font); }
   bool Load(int nameId,const string& filename, int size = 0, Uint8 r=255, Uint8 g=255, Uint8 b=255);
   void size(int size);
   inline int size() {return _size; }
   void SetColor(Uint8 red, Uint8 green, Uint8 blue);   //probably not the best way to do it...
   void Delete();
   void SetAlpha(int amount);
   void draw(const string& text, int x=0, int y=0, int alpha = 255);


   //shouldn't be used
   SDL_Surface* GetSurface() { return _text; }
private:
   string filename;
   int nameId;
   int _size;
   SDL_Color textColor;
   TTF_Font *font;
   SDL_Surface* _text;
};


And then I have another class called Text, which is another wrapper that further extends the capabilities of the font class(you could write text to the screen using a font class but it was getting messy). The text class is pretty big but basically, what it does so far, is it can handle transparency, it can be permanent or not(that is, it will disappear after a fixed amount of time has passed) - I also gave it a fade time - meaning that it takes x second to make it completely disappear, it can be in front or not(that is, it's position can be relative to the camera or not) - this was really useful :). Lately I also added scrolling direction which was really fun to do and watch.
adikid89
 
Posts: 35
Joined: Tue May 04, 2010 2:01 pm

Re: Yoshi mini-game

Postby programmerinprogress on Wed Jul 14, 2010 12:00 pm

Ahh, so you're using TTF then, I'm working on something Bitmap Font-related, and I was actually trying to avoid using TFF :D , thankyou for your reply though, good luck with the rest of the project.
programmerinprogress
 
Posts: 64
Joined: Mon Feb 01, 2010 8:15 am

Re: Yoshi mini-game

Postby adikid89 on Wed Jul 14, 2010 12:04 pm

programmerinprogress wrote:Ahh, so you're using TTF then, I'm working on something Bitmap Font-related, and I was actually trying to avoid using TFF :D , thankyou for your reply though, good luck with the rest of the project.

Why where you trying to avoid ttf ?
adikid89
 
Posts: 35
Joined: Tue May 04, 2010 2:01 pm

Re: Yoshi mini-game

Postby programmerinprogress on Wed Jul 14, 2010 12:18 pm

I'm writing a library (sorta) and I'm trying to avoid having to force the user to include any additional libraries (apart from the standard SDL libraries) in their projects.

Getting people to include a simple 'Fonts' folder in their working directory seems like a better idea than getting them to add another library, I'm just at the design phase on this particular part of the project.
programmerinprogress
 
Posts: 64
Joined: Mon Feb 01, 2010 8:15 am

Previous

Return to Games showcase!

Who is online

Users browsing this forum: No registered users and 1 guest