mirror of
https://github.com/ctruLua/ctruLua.git
synced 2025-10-28 00:39:30 +00:00
Updated the sftdlib, Added some functions in gfx and gfx.texture
This commit is contained in:
parent
c5337a5b2e
commit
dcdeec6525
5 changed files with 484 additions and 48 deletions
|
|
@ -16,6 +16,10 @@ int main()
|
|||
sftd_init();
|
||||
sftd_font *font = sftd_load_font_mem(FreeSans_ttf, FreeSans_ttf_size);
|
||||
|
||||
const char *someText = "Font drawing on the top screen! Text wraps after 300 pixels... Lorem ipsum dolor sit amet, consetetur sadipscing elit.";
|
||||
int textWidth = 0;
|
||||
int textHeight = 0;
|
||||
|
||||
while (aptMainLoop()) {
|
||||
|
||||
hidScanInput();
|
||||
|
|
@ -24,18 +28,9 @@ int main()
|
|||
sf2d_start_frame(GFX_TOP, GFX_LEFT);
|
||||
|
||||
sftd_draw_textf(font, 10, 10, RGBA8(0, 255, 0, 255), 20, "FPS %f", sf2d_get_fps());
|
||||
|
||||
sftd_draw_text(font, 10, 30, RGBA8(255, 0, 0, 255), 20, "Font drawing on the top screen!");
|
||||
sftd_draw_text(font, 10, 50, RGBA8(0, 255, 0, 255), 15, "Font drawing on the top screen!");
|
||||
sftd_draw_text(font, 10, 68, RGBA8(0, 0, 255, 255), 25, "Font drawing on the top screen!");
|
||||
sftd_draw_text(font, 10, 90, RGBA8(255, 255, 0, 255), 10, "Font drawing on the top screen!");
|
||||
sftd_draw_text(font, 10, 105, RGBA8(255, 0, 255, 255), 8, "Font drawing on the top screen!");
|
||||
sftd_draw_text(font, 10, 120, RGBA8(0, 255, 255, 255), 30, "Font drawing on the top screen!");
|
||||
|
||||
sftd_draw_text(font, 10, 155, RGBA8(255, 0, 0, 255), 20, "Font drawing on the top screen!");
|
||||
sftd_draw_text(font, 10, 170, RGBA8(0, 255, 0, 255), 2, "Font drawing on the top screen!");
|
||||
sftd_draw_text(font, 10, 180, RGBA8(0, 0, 255, 255), 10, "Font drawing on the top screen!");
|
||||
sftd_draw_text(font, 10, 205, RGBA8(255, 255, 0, 255), 170, "Font drawing on the top screen!");
|
||||
sftd_calc_bounding_box(&textWidth, &textHeight, font, 20, 300, someText);
|
||||
sf2d_draw_rectangle(10, 40, textWidth, textHeight, RGBA8(0, 100, 0, 255));
|
||||
sftd_draw_text_wrap(font, 10, 40, RGBA8(255, 255, 255, 255), 20, 300, someText);
|
||||
|
||||
sf2d_end_frame();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue