diff --git a/README.md b/README.md index aa3451c..68949d9 100644 --- a/README.md +++ b/README.md @@ -146,19 +146,39 @@ How to run (PowerShell + VS 2013): restore C++ REST SDK CTRL+F5 to run the project -Simple DirectMedia Layer 2 --------------------------- +## Simple DirectMedia Layer 2 SDL2 is multiplatform library suitable for developing applications like games. -Example is based on SDL2. -You can download version for Visual Studio at: http://libsdl.org/release/SDL2-devel-2.0.1-VC.zip -This library is also available in all common Linux ditributions. +You can use Gradle to build SDL2 examples. -How to run (PowerShell + VS 2013): +### Preparing dependencies for Windows - cd sdl - .\DownloadLibrary.ps1 - ii .\sdl2-sample.sln +Root project contains reference to SDL2 library. Type: + + gradle prepare + +It will download Windows version of SDL2 library for all projects. +Libraries will be placed in directory build. +Now you can build earch of subprojects. + +### 01-sdl2-init + +Simple example - init and quit SDL. +How to build: + + gradle clean mainExecutable + +Shorter version: + + gradle clean mE + +It is possible to generate project for Visual Studio: + + gradle mainVisualStudio + +Compiled binary will be stored in: + + build\binaries\mainExecutable node ---- diff --git a/sdl/01-sdl2-init/build.gradle b/sdl/01-sdl2-init/build.gradle index 87fff9e..dcc79c3 100644 --- a/sdl/01-sdl2-init/build.gradle +++ b/sdl/01-sdl2-init/build.gradle @@ -19,7 +19,8 @@ executables { main { binaries.all { if (toolChain in VisualCpp) { - linker.args "/machine:X86", "/SUBSYSTEM:WINDOWS", "../build/SDL2-2.0.3/lib/x86/SDL2.lib" + cCompiler.args "/MD" + linker.args "/SUBSYSTEM:CONSOLE", "/LIBPATH:../build/SDL2-2.0.3/lib/x86/", "SDL2main.lib", "SDL2.lib" //linker.args "/SUBSYSTEM:WINDOWS", "/LIBPATH:../build/SDL2-2.0.3/lib/x86/", "SDL2.lib" } } diff --git a/sdl/01-sdl2-init/src/main/c/sdl-init.c b/sdl/01-sdl2-init/src/main/c/sdl-init.c index f2db19a..04e029d 100644 --- a/sdl/01-sdl2-init/src/main/c/sdl-init.c +++ b/sdl/01-sdl2-init/src/main/c/sdl-init.c @@ -1,11 +1,10 @@ -// sdl2-sample.cpp : SDL2 example - initialize and quit -// +// SDL2 example - initialize and quit #include "SDL.h" -int main(int argc, char* argv[]) { - SDL_Init(SDL_INIT_EVERYTHING); +int main(int argc, char** argv){ + SDL_Init(SDL_INIT_EVERYTHING); SDL_Quit(); + return 0; } - diff --git a/sdl/README.md b/sdl/README.md deleted file mode 100644 index d45751a..0000000 --- a/sdl/README.md +++ /dev/null @@ -1,7 +0,0 @@ -Dependencies ------------- - -Download and unzip dependency http://libsdl.org/release/SDL2-devel-2.0.1-VC.zip -to this directory. You should see directory SDL2-2.0.1 with SDL2 files. - -Alternatively you can download library by DownloadLibrary.ps1 script.