collision_crisis/src/CHANGEME.cpp
2025-09-05 22:00:45 +02:00

58 lines
1.4 KiB
C++

#include "defs.h"
#include <SFML/Graphics.hpp>
#include <SFML/Graphics/RectangleShape.hpp>
#include <SFML/Graphics/RenderStates.hpp>
#include <SFML/Window.hpp>
#include <imgui-SFML.h>
#include <imgui.h>
#include <print>
void configure(AppConfig &config) {
config.window_title = "My Project";
config.frame_rate_limit = std::nullopt;
config.vsync = true;
}
void setup() {
ImGui::GetIO().ConfigFlags |= (
ImGuiConfigFlags_NavEnableKeyboard
| ImGuiConfigFlags_NavEnableGamepad
| ImGuiConfigFlags_DockingEnable
);
}
void loop(double delta) {
}
void draw_scene(sf::RenderTarget &target, sf::RenderStates const &states) {
static sf::RectangleShape rect{ { 300, 300 } };
sf::RenderStates n_states{states};
n_states.transform.translate({ 20, 20 });
target.draw(rect, n_states);
}
void draw_main_menu_bar() {
if (ImGui::BeginMenu("Edit")) {
if (ImGui::MenuItem("Menu item!")) {
std::println("Wahooo!!!");
}
ImGui::EndMenu();
}
}
void draw_gui() {
// draw your GUI
ImGui::DockSpaceOverViewport(0, NULL, ImGuiDockNodeFlags_PassthruCentralNode);
if (ImGui::Begin("My Window")) {
ImGui::Text("A window with text and a button!!");
if (ImGui::Button("My Button")) {
std::println("Yipeeee");
}
ImGui::End();
}
if (ImGui::Begin("Second Window :O")) {
ImGui::Text("A window with text!");
ImGui::End();
}
}