Tuesday, 5 June 2012

NoRSX with TTF support!



My lib has been updated to allow people to use *.ttf files instead of my old experimental font.
You can use any ttf loaded from memory or from hdd and print any kind of text as you want.
an example
This is the function that needs to be called to load a font from memory:
Font(u32 Color, u32 Size, const void *MemFont, u32 MemFont_size, Minimum *min);
so for example if my font is Andale.ttf, and i want to load it from memory, i would call:

#include "Andale_ttf.h" //This file will be created from the Makefile.
                        //just put your Andale.ttf inside the "data" folder
int main(){
          NoRSX gfx();
          Font A(COLOR_WHITE, 40, Andale_ttf, Andale_ttf_size, &gfx);
             //this will allow you to print on the screen a White
             //text with the Andale ttf and with a size of 40 pixel.
             //to print any kind of text i've added a printf function:
          A.Printf(100,300,"This is an example %i", 10);
             //This will print on the screen a text at the position (100,300)
             //on the screen, with written "This is an example 10".
}

you can also load ttf loaded from hdd (as i said before).
just change the function
Font A(COLOR_WHITE, 40, Andale_ttf, Andale_ttf_size, &gfx);
with this one:
Font A(COLOR_WHITE, 40, "/dev_hdd0/game/NORSX0000/Andale.ttf", &gfx);
This will load the font from the hdd. (you can use also the ps3 fonts already included with your ps3 :D).
Now the only thing that i need to implement is make it faster (it needs a spu implementation). once done, the lib will be finally done and i will be able to add more objects and other stupid stuff that now isn't necessary.


[GIT] https://github.com/wargio/NoRSX

No comments:

Post a Comment