diff --git a/examples/PoolBox/application/src/main.cpp b/examples/PoolBox/application/src/main.cpp index fb123700..0d266f20 100644 --- a/examples/PoolBox/application/src/main.cpp +++ b/examples/PoolBox/application/src/main.cpp @@ -1,42 +1,62 @@ -#include "FontWriter/font_writer.hpp" -#include "Objects/paco.hpp" -#include "assets.hpp" -#include -#include -#include -#include - -using namespace JabyEngine; - -static object::Paco paco; - -static void setup() { - Assets::load_for_main(); - FontWriter::FontWriter::setup(); - - paco.setup(); -} - -static void update() { - FontWriter::FontWriter cursor; - - const auto end_pos = cursor.write(FontWriter::Position::create(0, 32), "Cody is cute\n&\na \x1b[8;0;0mBAAAAABY!!!"); - cursor.write(end_pos, "\x1b[0;7;7mJaby was\nhere c:"); - - paco.update(); -} - -static void render() { - GPU::swap_buffers_vsync(1); - FontWriter::FontWriter::render(); - paco.render(); -} - -void main() { - setup(); - - while(true) { - update(); - render(); - } +#include "FontWriter/font_writer.hpp" +#include "Objects/paco.hpp" +#include "Overlay/Overlay.hpp" +#include "assets.hpp" +#include +#include +#include +#include +#include + +using namespace JabyEngine; + +static object::Paco paco; + +static void setup() { + Assets::load_for_main(); + FontWriter::FontWriter::setup(); + + paco.setup(); +} + +static void update() { + FontWriter::FontWriter cursor; + + const auto end_pos = cursor.write(FontWriter::Position::create(0, 32), "Cody is cute\n&\na \x1b[8;0;0mBAAAAABY!!!"); + cursor.write(end_pos, "\x1b[0;7;7mJaby was\nhere c:"); + + paco.update(); +} + +static void render() { + GPU::swap_buffers_vsync(1); + FontWriter::FontWriter::render(); + paco.render(); +} + +void main() { + static constexpr size_t MaxRounds = 1; + + size_t avg = 0; + size_t cur_rounds = 0; + setup(); + + Overlay::mesaure_busy_loop(); + JabyEngine::HighResTime::enable(); + + while(true) { + const auto start = JabyEngine::HighResTime::get_time_stamp(); + update(); + render(); + const auto end = JabyEngine::HighResTime::get_time_stamp(); + + avg += start.microseconds_to(end); + cur_rounds++; + if(cur_rounds == GPU::Display::frames_per_sec) { + printf("AVG Time: %ius\n", avg/MaxRounds); + + avg = 0; + cur_rounds = 0; + } + } } \ No newline at end of file diff --git a/src/Library/src/syscall_printf.s b/src/Library/src/syscall_printf.s index 2f8cdf27..57322d6e 100644 --- a/src/Library/src/syscall_printf.s +++ b/src/Library/src/syscall_printf.s @@ -9,4 +9,3 @@ _ZN10JabyEngine7SysCall6printfEPKcz: li $t2, 0xa0 jr $t2 li $t1, 0x3f - \ No newline at end of file