#include <stdint.h>
#include <math.h>

#include <psp2/ctrl.h>
#include <psp2/audioout.h>
#include <psp2/kernel/processmgr.h>
#include "app.hpp"

#include "game/game.h"

#include "render/render.h"
#include "render/primitives.hpp"
#include "render/sprite.hpp"
#include "render/background.hpp"
#include "render/camera.h"

#include <psp2/gxm.h>
#include "netlog.h"

int main() {

    // netlog_init();

    // netlog("render");

    render::Init();

    // netlog("start");

    App::Init();

    // netlog("game");

    game::init();

    // netlog("ololo");

    render::Camera cam;
    cam.screenSize = vec2f{30, 17};

    cam.Bind();

    game::setState(1);

    // netlog("state");

    while (true) {

        App::Update();

        game::update();

        cam.Math();

        render::StartFrame();

        render::background::Render();

        game::draw();

        render::primitives::Render();
        render::sprite::Render();

        render::EndFrame();
    }

    render::Free();

    sceKernelExitProcess(0);
    return 0;
}
