|
|
Re: Using truetype font from game folder?
[Re: Toon]
#368062
04/21/11 07:58
04/21/11 07:58
|
Joined: Jun 2009
Posts: 43
MCKiller
Newbie
|
Newbie
Joined: Jun 2009
Posts: 43
|
Hi Richi007, thanks for your reply! Unfortunately I tryed the code without any luck  This is what I tryed, maybe you know what I'm doing wrong;
#include <acknex.h>
#include <default.c>
#include <windows.h>
#include <stdio.h>
FONT* my_font;
TEXT* test_txt =
{
flags = SHOW;
string = "Comic letter";
pos_x = 100;
pos_y = 100;
}
void main()
{
if(AddFontResource("comic_andy.ttf")!=0)
{
my_font = font_create("comic andy#100");
if(my_font == NULL)
{
sys_exit("");
}
else
{
beep();
wait(-10);
test_txt.font = my_font;
}
}
else
{
beep();beep();beep();
}
}
This will not work, because font_create() will use a standard font if the new one (added with AddFontResource) was not found. This means that font_create() give you back a pointer and not a NULL! You can not be 100% sure if the new font is really used!
|
|
|
Re: Using truetype font from game folder?
[Re: MCKiller]
#368150
04/22/11 01:34
04/22/11 01:34
|
Joined: Jun 2007
Posts: 1,337 Hiporope and its pain
txesmi
Serious User
|
Serious User
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
|
this works good for me...
#include <acknex.h>
#include <windows.h>
FONT* my_font;
TEXT* test_txt =
{
flags = SHOW;
string = "Comic letter";
}
void main()
{
AddFontResource("Aarvark_Cafe.ttf");
my_font = font_create("Aarvark Cafe#100");
test_txt.font = my_font;
while ( !key_any ) wait(1);
sys_exit ( NULL );
}
Salud!
|
|
|
|
|
|