From e527de08f923932059a50f86da87c5be8ef893f8 Mon Sep 17 00:00:00 2001 From: incredibleLeitman Date: Wed, 18 Nov 2020 15:33:12 +0100 Subject: [PATCH] simple test project setup for SFML --- Makefile | 20 ++++++++++++++++++++ main.cpp | 29 +++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 Makefile create mode 100644 main.cpp diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..afbc00a --- /dev/null +++ b/Makefile @@ -0,0 +1,20 @@ +CXX = g++ +CXXFLAGS = -Wall -O3 + +# In case you installed SFML to a non-standard path, you'll need to tell the compiler where to find the SFML headers (.hpp files): +# g++ -c main.cpp -I/include + +# If SFML is not installed in a standard path, you need to tell the dynamic linker where to find the SFML libraries first by specifying LD_LIBRARY_PATH: +# export LD_LIBRARY_PATH=/lib && ./sfml-app + +quickhull: main.o Timing.o + # link with sfml libs; -lsfml-network -lsfml-audio currently not needed + $(CXX) $(CXXFLAGS) -o quickhull main.o Timing.o -lsfml-system -lsfml-window -lsfml-graphics + +main.o: main.cpp Timing.h + $(CXX) $(CXXFLAGS) -c main.cpp + +Timing.o: Timing.h + +clean : + -rm *.o quickhull \ No newline at end of file diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..819b99c --- /dev/null +++ b/main.cpp @@ -0,0 +1,29 @@ +// make sure sfml is installed: +// linux - sudo apt-get install libsfml-dev +// windows - manual dl from https://www.sfml-dev.org/download.php +#include + +#include "Timing.h" + +int main() +{ + sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!"); + sf::CircleShape shape(100.f); + shape.setFillColor(sf::Color::Green); + + while (window.isOpen()) + { + sf::Event event; + while (window.pollEvent(event)) + { + if (event.type == sf::Event::Closed) + window.close(); + } + + window.clear(); + window.draw(shape); + window.display(); + } + + return 0; +} \ No newline at end of file