diff --git a/.gitignore b/.gitignore index a5309e6..de5a352 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ build*/ +compile_commands.json +.clangd/ diff --git a/include/imgui-SFML.h b/include/imgui-SFML.h new file mode 120000 index 0000000..be86680 --- /dev/null +++ b/include/imgui-SFML.h @@ -0,0 +1 @@ +../third_party/imgui-sfml/imgui-SFML.h \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 817b524..72d131a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,6 +2,45 @@ #include #include +#include +#include + int main(int argc, char **argv) { + // init + sf::RenderWindow window(sf::VideoMode(800, 600), "Triangles"); + ImGui::SFML::Init(window); + window.setFramerateLimit(60); + const sf::Time dt = sf::microseconds(16666); + + // main loop + sf::Event event; + while(window.isOpen()) { + // events + window.pollEvent(event); + ImGui::SFML::ProcessEvent(event); + if(event.type == sf::Event::Closed) { + window.close(); + } + + // update + ImGui::SFML::Update(window, dt); + + ImGui::Begin("Test window"); + ImGui::Text("Test text"); + + ImGui::End(); + ImGui::EndFrame(); + // update end + + // draw + window.clear(); + ImGui::SFML::Render(window); + window.display(); + } + + // cleanup + window.close(); + ImGui::SFML::Shutdown(); + return 0; }