jabyengine/examples/PoolBox/application/src/application.cpp

58 lines
1.5 KiB
C++

#include "../include/asset_mgr.hpp"
#include "include/font_writer.hpp"
#include "include/menu.hpp"
#include "include/paco.hpp"
#include <FontWriter/fonts.hpp>
#include <FontWriter/font_writer.hpp>
#include <PSX/Periphery/periphery.hpp>
#include <stdio.h>
using namespace JabyEngine;
static const Menu::SimpleMenu::Entry MenuEntries[] = {
{"Menu 1"},
{"Menu 2"},
{"Menu 3"},
{"Menu 4"},
{"Menu 5"}
};
// Do we want this namespace?
// Do we want Paco to be HERE?!
static object::Paco paco;
static Menu::SimpleMenu menu;
static void setup() {
Assets::Main::load();
FontWriter::setup();
paco.setup();
menu.setup(MenuEntries);
}
static void update() {
static const char Title[] = "Pool Box";
static constexpr auto TitleLength = (sizeof(Title) - 1)*DefaultFont::Info.font_size.width;
Periphery::query_controller();
auto cursor = FontWriter::update(JabyEngine::Make::PositionI16((GPU::Display::Width-TitleLength)/2, 16));
paco.update();
FontWriter::new_font_writer.write(cursor, Title, GPU::Color24::Yellow(), &FontWriter::wiggle);
menu.update(FontWriter::bios_font_writer, cursor, Make::PositionI16(8, 64));
}
static void render() {
FontWriter::new_font_writer.render();
FontWriter::bios_font_writer.render();
paco.render();
}
void main() {
setup();
while(true) {
update();
GPU::swap_buffers_vsync(1);
render();
}
}