summaryrefslogtreecommitdiff
path: root/src/main.cpp
blob: e58fc06b9b505508b58c917bf90a4081598d1793 (plain)
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
#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>

#include "floor.hpp"

int main() {
  sf::RenderWindow window(sf::VideoMode({800, 600}), "sillyeditor");
  window.setFramerateLimit(60);
  ImGui::SFML::Init(window);

  silly::editor::Floor floor(30, 30);

  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;
}