SDL2
https://www.libsdl.org/
Files:
https://github.com/tcbrindle/sdl2-cmake-scripts
CMakeLists.txt
cmake_minimum_required(VERSION 3.6)
project(sdl_test)
set(CMAKE_CXX_STANDARD 11)
set(SOURCE_FILES main.cpp)
add_executable(sdl_test ${SOURCE_FILES})
# SDL2
set(SDL2_PATH "C:\\SDL2-2.0.5\\x86_64-w64-mingw32")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${sdl_test_SOURCE_DIR}/cmake")
find_package(SDL2 REQUIRED)
find_package(SDL2_Image REQUIRED)
find_package(SDL2_ttf REQUIRED)
include_directories(${SDL2_INCLUDE_DIR}
${SDL2_IMAGE_INCLUDE_DIR}
${SDL2_TTF_INCLUDE_DIR})
target_link_libraries(sdl_test ${SDL2_LIBRARY}
${SDL2_IMAGE_LIBRARIES}
${SDL2_TTF_LIBRARIES})
main.cpp
#include <SDL.h>
int main(int argc, char* argv[]) {
// Start SDL2
SDL_Init(SDL_INIT_EVERYTHING);
// Create a Window in the middle of the screen
SDL_Window *window = 0;
window = SDL_CreateWindow("Hello World!",
SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED,
640, 480,
SDL_WINDOW_SHOWN);
// Delay so that we can see the window appear
SDL_Delay(2000);
// Cleanup and Quit
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}
No comments:
Post a Comment