 |
|
View previous topic - View next topic |
Author |
Message |
DeveloperX 202192397

Joined: 04 May 2003 Posts: 1626 Location: Decatur, IL, USA
|
Posted: Mon Apr 02, 2007 6:02 am Post subject: Allegro and fonts |
[quote] |
|
{edit}*** SOLUTION FOUND. VIEW MY SOLUTION
Okay, I'm at my wits end.
I have tried countless times to use a different font with Allegro with no results.
I've heard people say use AllegTTF.....could not get that working.
AllegFont....cannot compile the source for it...several hundred errors pointing at allegro???
I am truly going crazy at this point.
I ask someone here that has the secret to using fonts with allegro, to step forth and tell me step by step how the hell to do it please! _________________ Principal Software Architect
Rambling Indie Games, LLC
See my professional portfolio
Last edited by DeveloperX on Mon Apr 02, 2007 9:15 pm; edited 2 times in total
|
|
Back to top |
|
 |
Ninkazu Demon Hunter

Joined: 08 Aug 2002 Posts: 945 Location: Location:
|
|
Back to top |
|
 |
DeveloperX 202192397

Joined: 04 May 2003 Posts: 1626 Location: Decatur, IL, USA
|
Posted: Mon Apr 02, 2007 9:12 pm Post subject: |
[quote] |
|
Okay.....a new approach to AllegFont resulted in success! :D
and.....could not get AllegTTF to work. ttf2pcx is a bitch.
anyway, for anyone who would like to know, here is a quick example using AllegFont to use a TrueType font:
Code: |
#include <allegro.h>
#include <alfont.h>
BITMAP* backbuffer;
ALFONT_FONT* newfont;
int main ()
{
allegro_init ();
install_timer ();
install_keyboard ();
set_color_depth (16);
set_gfx_mode (GFX_AUTODETECT_WINDOWED, 800, 600, 0, 0);
backbuffer = create_bitmap (SCREEN_W, SCREEN_H);
clear (backbuffer);
if (ALFONT_OK != alfont_init ())
{
allegro_exit ();
return 1;
}
newfont = alfont_load_font ("coolfont.ttf");
if (NULL == newfont)
{
alfont_exit ();
allegro_exit ();
return 1;
}
alfont_set_font_size (newfont, 24);
while (!key[KEY_ESC])
{
int x = backbuffer->w / 2;
int y = backbuffer->h / 2;
int c = makecol (255, 255, 255);
alfont_textout_centre (backbuffer, newfont, "Hello World!", x, y, c);
alfont_textout_centre_aa (backbuffer, newfont, "Hello World!", x, y+96, c);
blit (backbuffer, screen, 0, 0, 0, 0, backbuffer->w, backbuffer->h);
}
alfont_destroy_font (newfont);
destroy_bitmap (backbuffer);
alfont_exit ();
allegro_exit ();
return 0;
}
END_OF_MAIN ();
|
Linker params:
The order of the params matter. AlFont MUST be before Allegro. _________________ Principal Software Architect
Rambling Indie Games, LLC
See my professional portfolio
|
|
Back to top |
|
 |
 |
Page 1 of 1 |
All times are GMT
|
|