-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
47 lines (37 loc) · 1.42 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "raylib.h"
#include "imgui_impl_raylib.h"
#include "core/action.h"
#include "core/camera/camera_controller.h"
#include "core/system/cleanup.h"
#include "core/system/input/input.h"
#include "core/system/physics/physics.h"
#include "core/system/render/render.h"
int main(int argc, char const** argv)
{
// Initialization
SetConfigFlags(FLAG_MSAA_4X_HINT); // enable Multi Sampling Anti Aliasing 4x (if available)
InitWindow(SANDBOX3D_WINDOW_WIDTH, SANDBOX3D_WINDOW_HEIGHT, "sandbox3d");
SetTargetFPS(SANDBOX3D_TARGET_FPS);
// Icon
Image icon = LoadImage(SANDBOX3D_RESOURCES_PATH"icon.png");
SetWindowIcon(icon);
// Create scene
action::bindAllActions();
action::createScene();
// Imgui initialization
ImGuiIO* io = RenderSystem::ImGuiInit();
// Main game loop
while (!WindowShouldClose()) // detect window close button or ESC key
{
CameraController::update(GetFrameTime());
InputSystem::getSystem().update(GetFrameTime());
PhysSystem::getSystem().update(GetFrameTime() * 1.5f); // speed-up physics simulation
RenderSystem::getSystem().update(GetFrameTime());
CleanupSystem::getSystem().update(GetFrameTime());
}
// De-initialization
RenderSystem::getSystem().unloadAllModels();
RenderSystem::getSystem().unloadAllShaders();
CloseWindow(); // close window and OpenGL context
return 0;
}