Files
snake-raylib-prototype/src/main.cpp
T
2026-07-09 00:27:26 +01:00

85 lines
1.7 KiB
C++

#include <asset/raylib_asset.hpp>
#include <scene.hpp>
#include <components.hpp>
#include <box2d/box2d.h>
#include <box2d/types.h>
#include <raylib.h>
#include <rlImGui.h>
#include <imgui.h>
#include <entt/entt.hpp>
#include <asset_packer/asset.hpp>
#include <iostream>
// Globals
EngineState g_Engine;
RaylibAssetLoader asset_loader;
int main(){
//
int screen_width = 1280;
int screen_height = 800;
// initialized scene manager
SceneManager scene_manager;
entt::registry registry;
rlImGuiSetup(true);
ImGuiStyle& style = ImGui::GetStyle();
// Rounded corners
style.WindowRounding = 6.0f;
style.ChildRounding = 4.0f;
style.FrameRounding = 4.0f;
style.PopupRounding = 4.0f;
style.ScrollbarRounding = 9.0f;
style.GrabRounding = 4.0f;
style.TabRounding = 4.0f;
// Sizes and Spacing
style.WindowPadding = ImVec2(15.0f, 15.0f);
style.FramePadding = ImVec2(6.0f, 6.0f);
style.ItemSpacing = ImVec2(10.0f, 8.0f);
style.ScrollbarSize = 15.0f;
SetTargetFPS(60);
SetTraceLogLevel(TraceLogLevel::LOG_NONE);
InitWindow(screen_width, screen_height, "Bullet bird");
SetWindowState(FLAG_WINDOW_RESIZABLE);
while (!WindowShouldClose() && !g_Engine.shouldQuit){
float dt = GetFrameTime();
if (dt > 0.1f) dt = 0.1f; // cap dt just for now
scene_manager.update(dt);
BeginDrawing();
ClearBackground(RAYWHITE);
scene_manager.render();
rlImGuiBegin();
scene_manager.ui();
rlImGuiEnd();
EndDrawing();
scene_manager.process_scene_switch(); // !!! After scene_manager is done with the current loop
}
CloseWindow();
rlImGuiShutdown();
return 0;
}