summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644
index 0000000..5bb7884
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,37 @@
+#include <imgui-SFML.h>
+#include <imgui.h>
+
+#include <SFML/Graphics/RenderWindow.hpp>
+#include <SFML/System/Clock.hpp>
+#include <SFML/Window/Event.hpp>
+#include <SFML/Window/VideoMode.hpp>
+#include <optional>
+
+int main() {
+ sf::RenderWindow window(sf::VideoMode({800, 600}), "sillyeditor");
+ window.setFramerateLimit(60);
+ ImGui::SFML::Init(window);
+
+ sf::Clock deltaClock;
+ while (window.isOpen()) {
+ while (const std::optional<sf::Event> event = window.pollEvent()) {
+ if (event.has_value()) {
+ sf::Event e = event.value();
+ ImGui::SFML::ProcessEvent(window, e);
+ }
+
+ if (event->is<sf::Event::Closed>()) {
+ window.close();
+ }
+ }
+
+ ImGui::SFML::Update(window, deltaClock.restart());
+
+ window.clear();
+
+ ImGui::SFML::Render(window);
+ window.display();
+ }
+
+ return 0;
+} \ No newline at end of file