MAKE STYLE
https://lazyfoo.net/tutorials/SDL/01_hello_SDL/index.php
CMAKE STYLE
https://www.willusher.io/sdl2 tutorials/2013/08/17/lesson-1-hello-world
https://trenki2.github.io/blog/2017/06/02/using-sdl2-with-cmake/
pacman -S mingw-w64-x86_64-gcc
pacman -S mingw-w64-x86_64-gdb
pacman -S mingw-w64-x86_64-global
pacman -S mingw-w64-x86_64-gcc
pacman -S mingw-w64-x86_64-gdb
pacman -S mingw-w64-x86_64-global
64bit
pacman -S mingw-w64-x86_64-SDL2
32bit
pacman -S mingw-w64-i686-SDL2
ucrt64
pacman -S mingw-w64-ucrt-x86_64-SDL2
cmake_minimum_required(VERSION 3.0.0)
project(SDL2_HELLOWLRD VERSION 0.1.0)
include(CTest)
enable_testing()
find_package(SDL2 REQUIRED)
include_directories(SDL2_HELLOWLRD ${SDL2_INCLUDE_DIRS})
add_executable(SDL2_HELLOWLRD main.c)
target_link_libraries(SDL2_HELLOWLRD ${SDL2_LIBRARIES})
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
#include "SDL.h"
int main(int argc, char *argv[])
{
SDL_Init(SDL_INIT_VIDEO);
SDL_Window *window = SDL_CreateWindow(
"SDL2Test",
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
640,
480,
0
);
SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_SOFTWARE);
SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
SDL_RenderClear(renderer);
SDL_RenderPresent(renderer);
SDL_Delay(3000);
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up