#define GINT_NEED_VRAM #include #include #include #ifdef USE_LIBPROF #include #endif #include #include #include #include #include // FPS count #ifdef USE_LIBPROF static uint32_t frame_interval_min=1000000; static uint32_t frame_interval_max=1; static uint32_t fps=0; #endif uint32_t fe_get_fps() {return fps;} // Triple buffering #define BUFFER_SIZE 256 static uint32_t triple_buffering_area[2*BUFFER_SIZE]; // 2 buffers supplémentaires static uint32_t * const temp_buffers[2] = {&triple_buffering_area[0], &triple_buffering_area[BUFFER_SIZE]}; static uint32_t * gint_vram=0; static uint32_t working_buffer=0; static void check_vram() { if (gint_vram==0) gint_vram=vram; } void fe_callback_start() { vram=gint_vram; memcpy(gint_vram, temp_buffers[1-working_buffer], sizeof(uint32_t)*BUFFER_SIZE); } void fe_callback_end() { vram=temp_buffers[working_buffer]; } void fe_draw() { memcpy(gint_vram, temp_buffers[1-working_buffer], sizeof(uint32_t)*BUFFER_SIZE); } void switch_frame() { working_buffer=1-working_buffer; vram=temp_buffers[working_buffer]; dclear(C_WHITE); } static volatile bool quit=true; void fe_load() { check_vram(); quit=false; while (1) { fe_clear_zbuffer(); fe_render(); switch_frame(); if (quit) break; } // Free some malloc //// as object list } void fe_quit() { quit=1; }