A simple meson based build of an SFML+ImGUI project.

master
Zed A. Shaw 7 months ago
parent 7cf9010686
commit 8a78fffb5f
  1. 9
      sfmldemo/meson.build
  2. 13
      sfmldemo/setup.ps1
  3. 44
      sfmldemo/sfmlprog.cpp

@ -0,0 +1,9 @@
project('sfmldemo', 'cpp',
default_options: 'default_library=static')
sfml_dep = dependency('sfml')
imgui_dep = dependency('imgui-sfml')
executable('sfmlprog', 'sfmlprog.cpp',
win_subsystem: 'windows',
dependencies: [sfml_dep, imgui_dep])

@ -0,0 +1,13 @@
mkdir builddir
mkdir subprojects
meson wrap install flac
meson wrap install freetype2
meson wrap install imgui-sfml
meson wrap install imgui
meson wrap install libpng
meson wrap install ogg
meson wrap install openal-soft
meson wrap install sfml
meson wrap install vorbis
meson wrap install zlib
meson setup builddir

@ -0,0 +1,44 @@
#include "imgui.h"
#include "imgui-SFML.h"
#include <SFML/Graphics/CircleShape.hpp>
#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/System/Clock.hpp>
#include <SFML/Window/Event.hpp>
int main() {
sf::RenderWindow window(sf::VideoMode(1920, 1080), "ImGui + SFML = <3");
// window.setFramerateLimit(60);
window.setVerticalSyncEnabled(true);
ImGui::SFML::Init(window);
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
sf::Clock deltaClock;
while (window.isOpen()) {
sf::Event event;
while (window.pollEvent(event)) {
ImGui::SFML::ProcessEvent(window, event);
if (event.type == sf::Event::Closed) {
window.close();
}
}
ImGui::SFML::Update(window, deltaClock.restart());
ImGui::ShowDemoWindow();
ImGui::Begin("Hello, world!");
ImGui::Button("Look at this pretty button");
ImGui::End();
window.clear();
window.draw(shape);
ImGui::SFML::Render(window);
window.display();
}
ImGui::SFML::Shutdown();
}
Loading…
Cancel
Save