# Windows

download from https://cmake.org/download/


Windows x64 Installer:	cmake-4.2.0-windows-x86_64.msi


download from https://github.com/libsdl-org/SDL/releases/tag/release-2.32.10

SDL2-2.32.10-win32-x64.zip 

SDL2-2.32.10:

```
cd C:\..\SDL-realese-2.32.10 
mkdir build
cd build
cmake -G "Visual Studio 18 2026" -DCMAKE_INSTALL_PREFIX=install ..
cmake --build . --config Debug
cmake --install . --config Debug
```

download from https://www.zlib.net/     

zlib source code, version 1.3.1, zipfile format (1616K, SHA-256 hash 72af66d44fcc14c22013b46b814d5d2514673dda3d115e64b690c1ad636e7b17):
 US (zlib.net)

zlib-1.3.1:

```
cd C:\..\zlib-1.3.1
mkdir build
cd build
cmake -G "Visual Studio 18 2026" -DCMAKE_INSTALL_PREFIX=install ..
cmake --build . --config Debug
cmake --install . --config Debug
```

download from https://github.com/pnggroup/libpng/releases/tag/v1.6.51

Source code (zip) 

libpng-1.6.51:

```
cd C:\..\libpng-1.6.51
mkdir build
cd build
```

To build libpng, you need to specify the path to the zlib installation directory as follows:

```
cmake -DCMAKE_PREFIX_PATH="../zlib-1.3.1/build/install" -DCMAKE_INSTALL_PREFIX=install -G "Visual Studio 18 2026" ..
cmake --build . --config Debug
cmake --install . --config Debug
```

Настройка проекта в Visual Studio:

Перейдите в Project Properties (правый клик на проект, "Properties").

C/C++ - ОБЩИЕ; Дополнительные каталоги включаемых файлов, проверить чтобы был добавлен путь к папке include:(пример)

..\SDL-release-2.32.10\include;..\libpng-1.6.51\build\install\include;C:\Work\OpenAL 1.1 SDK\include;..\Projects\libogg\include;..\vorbis\include


Компоновщик - ОБЩИЕ; Доподнительные каталоги библиотек (пример)

..\SDL-release-2.32.10\build\install\lib;..\libpng-1.6.51\build\install\lib;..\zlib-1.3.1\build\install\lib

Компоновщик - ВВОД; Дополнительные зависимости, добавить zlibstaticd.lib (пример)

zlibstaticd.lib;libpng16_staticd.lib;SDL2d.lib;SDL2maind.lib;opengl32.lib;glu32.lib;shell32.lib;opengl32.lib;glu32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib


в папку ..\projectGAME01\x64\Debug добавить файл SDL2d.dll
который можно скопировать из папки ..\SDL-release-2.32.10\build\Debug


# Script to run:

```
C:\Work\Projects\emsdk\emsdk.bat activate latest
C:\Work\Projects\emsdk\emsdk_env.bat
emcc main.cpp Game.cpp Math.cpp Physics.cpp Renderer.cpp ShaderManager.cpp TextureManager.cpp Utils.cpp OpenGlExtensions.cpp -O2 -std=c++14 -sTOTAL_MEMORY=33554432 -sUSE_SDL_IMAGE=2 -sSDL2_IMAGE_FORMATS="[""png""]" -sUSE_SDL=2 --preload-file background.bmp --preload-file bird.bmp32 --preload-file default.fragment --preload-file default.vertex --preload-file game_over.bmp32 --preload-file pipe.bmp32 -o space-game001.html
```

```


zlib-1.3.1:

mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=install ..

then run ALL_BUILD and INSTALL in Visual Studio

lpng1645:

mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=install -DZLIB_ROOT=C:\Work\Projects\zlib-1.3.1\build\install ..

then run ALL_BUILD and INSTALL in Visual Studio


```


https://github.com/Bly7/OBJ-Loader/blob/master/Source/OBJ_Loader.h


https://github.com/gametutorials/tutorials/blob/master/OpenGL/MD3%20Animation/Main.cpp



linux:
```
g++ Game.cpp main.cpp Math.cpp OpenGlExtensions.cpp Physics.cpp Renderer.cpp ShaderManager.cpp TextureManager.cpp Utils.cpp BoneAnimatedModel.cpp ObjLoader.cpp cmakeaudioplayer/src/AudioPlayer.cpp TextModel.cpp Inventory.cpp -o sdl_app -O2 -std=c++17 \
-I cmakeaudioplayer/include \
$(pkg-config --cflags --libs sdl2 gl) \
$(pkg-config --cflags --libs vorbis vorbisfile ogg) \
-lopenal
```

# Emscripten new

```

cd build-emcmake/

 emcmake cmake -DCMAKE_INSTALL_PREFIX=install ..
 cmake --build .

 cmake --install .


emcc main.cpp Game.cpp Environment.cpp GameObjectManager.cpp BoneAnimatedModel.cpp GameWorld.cpp InputManager.cpp Inventory.cpp ObjLoader.cpp QuestScripts.cpp RenderSystem.cpp  Math.cpp Physics.cpp Renderer.cpp TextModel.cpp  ShaderManager.cpp TextureManager.cpp Utils.cpp OpenGlExtensions.cpp -O2 -std=c++14 -IC:\Users\ASUS\Desktop\fishrungame2\ZeptoLabTest1\thirdparty\libzip-1.11.3\build-emcmake\install\include -LC:\Users\ASUS\Desktop\fishrungame2\ZeptoLabTest1\thirdparty\libzip-1.11.3\build-emcmake\install\lib -lzip -sTOTAL_MEMORY=33554432 -sUSE_SDL_IMAGE=2 -sSDL2_IMAGE_FORMATS="[""png""]" -sUSE_SDL=2 --preload-file background.bmp --preload-file bird.bmp32 --preload-file default.fragment --preload-file default.vertex --preload-file game_over.bmp32 --preload-file pipe.bmp32 -o jumpingbird.html

emcc main.cpp Game.cpp Environment.cpp GameObjectManager.cpp BoneAnimatedModel.cpp GameWorld.cpp InputManager.cpp Inventory.cpp ObjLoader.cpp QuestScripts.cpp RenderSystem.cpp Math.cpp Physics.cpp Renderer.cpp TextModel.cpp ShaderManager.cpp TextureManager.cpp Utils.cpp OpenGlExtensions.cpp -O2 -std=c++14 -pthread -sUSE_PTHREADS=1 -sPTHREAD_POOL_SIZE=4 -sTOTAL_MEMORY=4294967296 -sINITIAL_MEMORY=3221225472 -sMAXIMUM_MEMORY=4294967296 -sALLOW_MEMORY_GROWTH=1 -I./thirdparty/libzip-1.11.3/build-emcmake/install/include -I./thirdparty/zlib-1.3.1/install/include -L./thirdparty/libzip-1.11.3/build-emcmake/install/lib -L./thirdparty/zlib-1.3.1/install/lib -lzip -lz -sUSE_SDL_IMAGE=2 -sSDL2_IMAGE_FORMATS='["png"]' -sUSE_SDL=2 --preload-file data.zip -o jumpingbird.html


# Windows:
emcc --clear-cache
embuilder build sdl2 sdl2_ttf sdl2_image sdl2_image_jpg sdl2_image_png



emcc main.cpp Game.cpp Environment.cpp BoneAnimatedModel.cpp ZLMath.cpp Renderer.cpp TextModel.cpp ShaderManager.cpp TextureManager.cpp Utils.cpp OpenGlExtensions.cpp -O2 -std=c++14 -pthread -sUSE_PTHREADS=1 -sPTHREAD_POOL_SIZE=4 -sTOTAL_MEMORY=4294967296 -sINITIAL_MEMORY=3221225472 -sMAXIMUM_MEMORY=4294967296 -sALLOW_MEMORY_GROWTH=1 -I./thirdparty/libzip-1.11.3/build-emcmake/install/include -L./thirdparty/libzip-1.11.3/build-emcmake/install/lib -lzip -lz -sUSE_SDL_IMAGE=2 -sUSE_SDL=2 -sUSE_LIBPNG=1 --preload-file space-game001.zip -o space-game001.html

emrun --no_browser --port 8080 .
```

# License
Code: MIT

Art: CC-BY

# Cmake Run Linux
Run using cmakelist
make -j$(nproc) -C build #Компилируем
./build/sdl_app #Запускаем

Для постройки без звука
rm -rf build  #Очищаем build папку
cmake -B build -DAUDIO=1 #Пересоздаём конфигурацию CMake