This commit is contained in:
Jie 2024-06-18 10:04:50 +08:00
commit 8a494d7939
3 changed files with 56 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build/

27
CMakeLists.txt Normal file
View File

@ -0,0 +1,27 @@
cmake_minimum_required(VERSION 3.26)
set(PROJECT_N "mp")
project(${PROJECT_N} VERSION 1.0)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
include_directories(${PROJECT_SOURCE_DIR}/include)
file(GLOB_RECURSE srcs ${PROJECT_SOURCE_DIR}/src/*.cc)
IF(UNIX)
find_package(SFML 2.5 COMPONENTS system window graphics network audio REQUIRED)
add_executable(${PROJECT_N}
main.cc
${srcs}
)
target_link_libraries(${PROJECT_N}
sfml-system
sfml-window
sfml-graphics
sfml-network
sfml-audio
)
ELSE(WIN32)
ENDIF()

28
main.cc Normal file
View File

@ -0,0 +1,28 @@
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
int main(int argc, char** const argv){
sf::RenderWindow window(sf::VideoMode(800, 600), "mp");
sf::Texture texture;
sf::Sprite sprite;
bool running = true;
while(running){
sf::Event event;
while(window.pollEvent(event)){
if(event.type == sf::Event::Closed){
running = false;
}
if(event.type == sf::Event::KeyPressed){
if(event.key.code == sf::Keyboard::Escape){
running = false;
}
}
}
window.clear();
window.display();
}
return 0;
}