diff --git a/samples/tetris/README.md b/samples/tetris/README.md index 334c4730850..287aea840f5 100644 --- a/samples/tetris/README.md +++ b/samples/tetris/README.md @@ -10,11 +10,19 @@ using binary distribution). Install SDL2 development files (see https://www.libsdl.org/download-2.0.php). For Mac - copy `SDL2.framework` to `$HOME/Library/Frameworks`. For Debian-like Linux - use `apt-get install libsdl2-dev`. +For Windows - `pacman -S mingw-w64-x86_64-SDL2` in MinGW64 console, if you do +not have MSYS2-MinGW64 installed - install it first as described in http://www.msys2.org To build Tetris application for your host platform use +For Mac and Linux: + ./build.sh - + +For Windows: + + build.bat + You also may use gradle to build this sample: `../gradlew build`. This task builds the sample for all platforms supported by the host. Note that SDL2 must be installed on the host. @@ -34,3 +42,5 @@ To deploy executable to iPhone device take Info.plist, then use XCode and your o To run on Raspberry Pi one need to install SDL package with `apt-get install libsdl2-2.0.0` on the Pi. Also GLES2 renderer is recommended (use `SDL_RENDER_DRIVER=opengles2 ./Tetris.kexe`). +For Windows `set SDL_RENDER_DRIVER=software` may be needed on some machines. + diff --git a/samples/tetris/build.bat b/samples/tetris/build.bat new file mode 100644 index 00000000000..d294c1cc482 --- /dev/null +++ b/samples/tetris/build.bat @@ -0,0 +1,14 @@ +@echo off +setlocal +set DIR=. +set "PATH=..\..\dist\bin;..\..\bin;%PATH%" +if "%TARGET%" == "" set TARGET=mingw + +set CFLAGS=-I\msys64\mingw64\include\SDL2 +set LFLAGS=-L\msys64\mingw64\lib -lSDL2 + +call cinterop -def "%DIR%\sdl.def" -compilerOpts "%CFLAGS%" -target "%TARGET%" -o sdl || exit /b +call konanc -target "%TARGET%" "%DIR%\Tetris.kt" -library sdl -linkerOpts "%LFLAGS%" -opt -o Tetris || exit /b + +copy Tetris.kexe Tetris.exe +copy \msys64\mingw64\bin\SDL2.dll SDL2.dll