Impl basic drawing, a basic start to the program

This commit is contained in:
Stephen Seo 2020-07-21 20:15:10 +09:00
parent 5a7f214a5d
commit 26c7aacea0
3 changed files with 42 additions and 0 deletions

2
.gitignore vendored
View file

@ -1 +1,3 @@
build*/
compile_commands.json
.clangd/

1
include/imgui-SFML.h Symbolic link
View file

@ -0,0 +1 @@
../third_party/imgui-sfml/imgui-SFML.h

View file

@ -2,6 +2,45 @@
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <imgui.h>
#include <imgui-SFML.h>
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;
}