21 [[maybe_unused]]
static void Box2dDebugDraw(
const glm::vec2 cameraSize,
const glm::vec2 cameraPos,
const int32_t pixelsPerMeter,
Core::Layer* layer,
const bool mouseDrag,
const float mouseForce = 1000.0f) {
27 if (!ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow) && !ImGui::IsAnyItemActive()) {
41 const char* items[] = {
"Windowed",
"Borderless Windowed",
"Exclusive Fullscreen"};
43 int32_t oneToDisplay = 0;
55 const char* windowModeDropdownPreview = items[oneToDisplay];
56 if (ImGui::BeginCombo(
"Window Mode", windowModeDropdownPreview)) {
57 for (int32_t i = 0; i < IM_ARRAYSIZE(items); i++) {
58 const bool isSelected = oneToDisplay == i;
59 if (ImGui::Selectable(items[i], isSelected)) {
64 CORI_ERROR(
"Failed to set window mode. Error: {}", result.error().what());
72 CORI_ERROR(
"Failed to set window mode. Error: {}", result.error().what());
80 CORI_ERROR(
"Failed to set window mode. Error: {}", result.error().what());
87 ImGui::SetItemDefaultFocus();
97 if (ImGui::BeginCombo(
"Resolution", resolutionDropdownPreview)) {
100 if (ImGui::Selectable(window.
GetScreenModes()[i].m_ModeName.c_str(), isSelected)) {
103 CORI_ERROR(
"Failed to set screen mode. Error: {}", result.error().what());
108 ImGui::SetItemDefaultFocus();
113 ImGui::EndDisabled();
117 static int frameCount = 0;
118 static double lastTime = 0.0;
119 static float fps = 0.0f;
123 double elapsed = currentTime - lastTime;
125 if (elapsed >= 1.0) {
126 fps =
static_cast<float>(frameCount / elapsed);
128 lastTime = currentTime;
133 ImGui::Text(
"FPS: %.2f", fps);
static Window & GetWindow()
Getter for the main Window.
A GameTimer is responsible for managing everything that is connected with time, ticks,...
double GetElapsedSeconds() const
Gets the time in seconds since application start.
An abstract class that is ment to be used as a template for defining layers.
World::SceneHandle ActiveScene
A SceneHandle to the Scene that is currently bound.
static Physics::DebugImguiRenderer m_DebugImGuiRenderer
This class manages everything that is connected with physical Window management, i might add multiwin...
std::expected< void, CoriError<> > SetScreenMode(const uint32_t modeIndex)
Changes the current ScreenMode.
const std::vector< ScreenMode > & GetScreenModes() const
Retrieves a list of all available ScreenMode.
uint32_t GetCurrentScreenMode() const
Retrieves the current screen mode index.
WindowMode GetWindowMode() const
Gets the current WindowMode;.
std::expected< void, CoriError<> > SetWindowMode(WindowMode mode)
Changes the current WindowMode.
std::expected< std::weak_ptr< T >, Core::CoriError<> > GetSystem()
Retries a registered system instance from the scene.
System responsible for physics.
Here are stored all predefined ImGui window presets, you can only use this functions in Layer OnImGui...
static void Box2dDebugDraw(const glm::vec2 cameraSize, const glm::vec2 cameraPos, const int32_t pixelsPerMeter, Core::Layer *layer, const bool mouseDrag, const float mouseForce=1000.0f)
Enables the debug draw of Box2D physics.
static void FpsCounter(const Core::GameTimer &timer)
static void ScreenModeAndResolutionDropdowns()
Displays a window mode and screen mode selection window.