summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormanzerbredes <loic.guegan_secondary@yahoo.fr>2015-04-28 19:15:36 +0200
committermanzerbredes <loic.guegan_secondary@yahoo.fr>2015-04-28 19:15:36 +0200
commit4119ff9e3a57d197e36b34f8f6ef4208871b032e (patch)
treeb917ca7f069f9447420c47eefb1447d9d27916fe
parent9729ff528df0919630e0668484c52ce3182c5d19 (diff)
Create first hello world in SFML (Thank you LaurentGomila for your FindSFML.cmake)
-rw-r--r--.gitignore4
-rw-r--r--CMakeLists.txt18
-rwxr-xr-xsrc/2P11bin0 -> 18576 bytes
-rw-r--r--src/CMakeLists.txt15
-rw-r--r--src/main.cpp25
5 files changed, 62 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..9be2b10
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+CMakeFiles
+cmake_install.cmake
+Makefile
+CMakeCache.txt
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..c822dc4
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,18 @@
+#Defined project name
+project(2P11)
+
+#Assign Modules path
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
+
+#Defined project VERSION
+set(VERSION_MAJOR 0)
+set(VERSION_MINOR 1)
+set(VERSION_REV 0)
+set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REV}")
+
+#Minimum cmake VERSION
+cmake_minimum_required(VERSION 2.6)
+
+#Add source directory
+add_subdirectory(src)
+
diff --git a/src/2P11 b/src/2P11
new file mode 100755
index 0000000..1313b4c
--- /dev/null
+++ b/src/2P11
Binary files differ
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..b30833e
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,15 @@
+#Defined executable
+add_executable(
+ 2P11
+ ./main.cpp
+)
+
+#Find all libraries
+find_package(SFML 2.2 COMPONENTS system window graphics audio REQUIRED)
+
+
+#Include "Includes" and "Libraries"
+include_directories(${SFML_INCLUDE_DIR})
+target_link_libraries(2P11 ${SFML_LIBRARIES})
+
+message("${SFML_LIBRARIES}")
diff --git a/src/main.cpp b/src/main.cpp
index e69de29..0d3b950 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -0,0 +1,25 @@
+#include <SFML/Graphics.hpp>
+#include <string>
+
+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;
+}