Files
2026-06-01 23:20:07 +01:00

41 lines
748 B
C++

#ifndef APP_H
#define APP_H
#include "app/scene.h"
#include "bindings/ruby.h"
#include "utils.h"
#include "window/window.h"
namespace app {
struct App {
uint64_t current_scene_id = 0;
bool running = true;
Vec2<float> mouse_position = {-1, -1};
std::array<bool, 600> down_keys{};
std::vector<Key> pressed_keys;
std::vector<Key> released_keys;
Vec2<float> scroll = {0, 0};
std::string text = "";
Ruby::Block update;
App(Vec2<float> size, const char *title);
void exit();
void switch_to_scene(uint64_t scene_id);
void set_fps(float fps);
uint64_t get_fps() const;
void loop();
private:
uint64_t fps = 60;
uint64_t target_frame_time = 1e9 / fps;
};
} // namespace app
inline app::App *app_ = nullptr;
#endif