#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <3ds.h>
#include <sf2d.h>
#include <sfil.h>
#include <sftd.h>
#include "FreeSans_ttf.h"
#include "citra_jpeg.h"
#include "3dbrew_png.h"
int main()
{
// Set the random seed based on the time
srand(time(NULL));
sf2d_init();
sftd_init();
sf2d_set_clear_color(RGBA8(0x40, 0x40, 0x40, 0xFF));
sf2d_texture *tex1 = sfil_load_JPEG_buffer(citra_jpeg, citra_jpeg_size, SF2D_PLACE_RAM);
sf2d_texture *tex2 = sfil_load_PNG_buffer(_3dbrew_png, SF2D_PLACE_RAM);
sftd_font *font = sftd_load_font_mem(FreeSans_ttf, FreeSans_ttf_size);
u32 held;
while (aptMainLoop()) {
hidScanInput();
held = hidKeysHeld();
if (held & KEY_START) {
break;
}
sf2d_start_frame(GFX_TOP, GFX_LEFT);
sftd_draw_textf(font, 10, 10, RGBA8(0, 255, 0, 255), 20, "FPS %f", sf2d_get_fps());
sf2d_draw_texture(tex1, 400/2 - tex1->width/2, 240/2 - tex1->height/2);
sf2d_end_frame();
sf2d_start_frame(GFX_BOTTOM, GFX_LEFT);
sf2d_draw_texture(tex2, 320/2 - tex2->width/2, 240/2 - tex2->height/2);
sf2d_end_frame();
sf2d_swapbuffers();
}
sf2d_free_texture(tex1);
sf2d_free_texture(tex2);
sftd_free_font(font);
sf2d_fini();
sftd_fini();
return 0;
}