Create first hello world in SFML (Thank you LaurentGomila for your FindSFML.cmake)
This commit is contained in:
parent
9729ff528d
commit
4119ff9e3a
5 changed files with 62 additions and 0 deletions
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
CMakeFiles
|
||||||
|
cmake_install.cmake
|
||||||
|
Makefile
|
||||||
|
CMakeCache.txt
|
18
CMakeLists.txt
Normal file
18
CMakeLists.txt
Normal file
|
@ -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)
|
||||||
|
|
BIN
src/2P11
Executable file
BIN
src/2P11
Executable file
Binary file not shown.
15
src/CMakeLists.txt
Normal file
15
src/CMakeLists.txt
Normal file
|
@ -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}")
|
25
src/main.cpp
25
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;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue