diff --git a/.gitignore b/.gitignore index e52e292..3b01293 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,12 @@ *.iso xbox\source\shaders\sprite-frag.inl xbox\source\shaders\guideline-frag.inl + +#macOS' .DS_Store +*.DS_Store + +#build folder +*build/ + +#highscore +*/highscore.bin diff --git a/README.md b/README.md index 7fe4fa3..b3b0390 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,36 @@ After participating in Ludum Dare 46, I challenged myself to port my entry to as After installing [raylib](https://github.com/raysan5/raylib/releases), execute ``make`` in the ``/raylib`` directory. #### SDL2 Tested with msys2. Install the `SDL2`, `SDL2_image`, `SDL2_mixer` and `SDL2_ttf` packages with `pacman`, then execute `make` in the windows/sdl2 folder. Finally, copy the resources folder to the output executable location. +### Linux + - Clone this repo and cd into it. + - Install the `SDL2`, `SDL2_image`, `SDL2_mixer` and `SDL2_ttf` libraries with your package manager. + ```shell + #ArchLinux/Manjaro + sudo pacman -S sdl2 sdl2_image sdl2_mixer sdl2_ttf + ``` + + ```shell + #Debian/Ubuntu: + sudo apt install libsdl2-2.0-0 libsdl2-mixer-2.0-0 libsdl2-image-2.0-0 libsdl2-ttf-2.0-0 + ``` + + - Then, cd into the ``linux+macOS`` directory and execute: + ```shell + make + ``` + - The game binary will be located in ``build/bin`` directory +### macOS + - Clone this repo and cd into it. + - Install [Homebrew](https://brew.sh/). + - Install the `SDL2`, `SDL2_image`,`SDL2_mixer` and `SDL2_ttf` libraries using brew: + ```shell + brew install sdl2 sdl2_image sdl2_mixer sdl2_ttf + ``` + - Then, cd into the ``linux+macOS`` directory and execute: + ```shell + make + ``` + - The game binary will be located in ``build/bin`` directory ### PS Vita Compiling for PS Vita requires vitasdk. Then, execute ``cmake .&& make`` in the ``/psvita`` directory. ### Nintendo DS diff --git a/linux/Makefile b/linux+macOS/Makefile similarity index 100% rename from linux/Makefile rename to linux+macOS/Makefile diff --git a/linux/main.cpp b/linux+macOS/main.cpp similarity index 97% rename from linux/main.cpp rename to linux+macOS/main.cpp index eb804ed..e8825f7 100644 --- a/linux/main.cpp +++ b/linux+macOS/main.cpp @@ -116,11 +116,13 @@ void Draw_Font(SDL_Renderer *renderer, const char *str, int x, int y, int width, } int main(int argc, char **argv) { + srand(time(NULL)); - + resetScore(); + sprintf(highscore, "BEST: %d", highscoreInt); - + const int screenWidth = 800; const int screenHeight = 450; @@ -139,7 +141,6 @@ int main(int argc, char **argv) { SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO); IMG_Init(IMG_INIT_PNG); TTF_Init(); - window = SDL_CreateWindow( "Terri-Fried", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, @@ -315,7 +316,7 @@ int main(int argc, char **argv) { //DrawRectangle(player.getX(), player.getY(), player.getWidth(), player.getHeight(), WHITE); for (int i = 0; i < 4; i++) { - SDL_Rect platformSprite_rect = { platforms[i].getX(), platforms[i].getY(), 100, 32 }; + SDL_Rect platformSprite_rect = { (int)platforms[i].getX(), (int)platforms[i].getY(), 100, 32 }; SDL_RenderCopy(renderer, platformSprite, NULL, &platformSprite_rect); if (platforms[i].getHasCoin()) { @@ -324,10 +325,10 @@ int main(int argc, char **argv) { } } - SDL_Rect playerSprite_rect = { player.getX(), player.getY(), 32, 32 }; + SDL_Rect playerSprite_rect = { (int)(player.getX()), (int)(player.getY()), 32, 32 }; SDL_RenderCopy(renderer, playerSprite, NULL, &playerSprite_rect); - SDL_Rect lavaSprite_rect = { 0, lavaY, 800, 48 }; + SDL_Rect lavaSprite_rect = { 0, (int)lavaY, 800, 48 }; SDL_RenderCopy(renderer, lavaSprite, NULL, &lavaSprite_rect); SDL_Rect scoreBoxSprite_rect = { 17, 17, 102, 70 }; diff --git a/linux/platform.cpp b/linux+macOS/platform.cpp similarity index 98% rename from linux/platform.cpp rename to linux+macOS/platform.cpp index 0cd825e..5c3b0f2 100644 --- a/linux/platform.cpp +++ b/linux+macOS/platform.cpp @@ -1,5 +1,6 @@ #include "platform.h" #include +#include const int screenWidth = 800; const int screenHeight = 450; diff --git a/linux/platform.h b/linux+macOS/platform.h similarity index 100% rename from linux/platform.h rename to linux+macOS/platform.h diff --git a/linux/player.cpp b/linux+macOS/player.cpp similarity index 96% rename from linux/player.cpp rename to linux+macOS/player.cpp index 54b3de6..dec3b89 100644 --- a/linux/player.cpp +++ b/linux+macOS/player.cpp @@ -53,7 +53,7 @@ void Player::setOnPlatform(bool result) { } void Player::setVelocity(double x, double y) { - velocity = (Vector2){x, y}; + velocity = (Vector2){(int)x, (int)y}; } Vector2 Player::getVelocity() { diff --git a/linux/player.h b/linux+macOS/player.h similarity index 100% rename from linux/player.h rename to linux+macOS/player.h diff --git a/linux/resources/click.wav b/linux+macOS/resources/click.wav similarity index 100% rename from linux/resources/click.wav rename to linux+macOS/resources/click.wav diff --git a/linux/resources/coin.png b/linux+macOS/resources/coin.png similarity index 100% rename from linux/resources/coin.png rename to linux+macOS/resources/coin.png diff --git a/linux/resources/coin.wav b/linux+macOS/resources/coin.wav similarity index 100% rename from linux/resources/coin.wav rename to linux+macOS/resources/coin.wav diff --git a/linux/resources/die.wav b/linux+macOS/resources/die.wav similarity index 100% rename from linux/resources/die.wav rename to linux+macOS/resources/die.wav diff --git a/linux/resources/egg.png b/linux+macOS/resources/egg.png similarity index 100% rename from linux/resources/egg.png rename to linux+macOS/resources/egg.png diff --git a/linux/resources/font.otf b/linux+macOS/resources/font.otf similarity index 100% rename from linux/resources/font.otf rename to linux+macOS/resources/font.otf diff --git a/linux/resources/launch.wav b/linux+macOS/resources/launch.wav similarity index 100% rename from linux/resources/launch.wav rename to linux+macOS/resources/launch.wav diff --git a/linux/resources/lava.png b/linux+macOS/resources/lava.png similarity index 100% rename from linux/resources/lava.png rename to linux+macOS/resources/lava.png diff --git a/linux/resources/logo.png b/linux+macOS/resources/logo.png similarity index 100% rename from linux/resources/logo.png rename to linux+macOS/resources/logo.png diff --git a/linux/resources/platform.png b/linux+macOS/resources/platform.png similarity index 100% rename from linux/resources/platform.png rename to linux+macOS/resources/platform.png diff --git a/linux/resources/scorebox.png b/linux+macOS/resources/scorebox.png similarity index 100% rename from linux/resources/scorebox.png rename to linux+macOS/resources/scorebox.png diff --git a/linux/resources/select.wav b/linux+macOS/resources/select.wav similarity index 100% rename from linux/resources/select.wav rename to linux+macOS/resources/select.wav diff --git a/linux/resources/splash.wav b/linux+macOS/resources/splash.wav similarity index 100% rename from linux/resources/splash.wav rename to linux+macOS/resources/splash.wav diff --git a/linux/resources/splash_egg.png b/linux+macOS/resources/splash_egg.png similarity index 100% rename from linux/resources/splash_egg.png rename to linux+macOS/resources/splash_egg.png diff --git a/linux/winres/TF-icon.ico b/linux+macOS/winres/TF-icon.ico similarity index 100% rename from linux/winres/TF-icon.ico rename to linux+macOS/winres/TF-icon.ico diff --git a/linux/winres/TF-icon.rc b/linux+macOS/winres/TF-icon.rc similarity index 100% rename from linux/winres/TF-icon.rc rename to linux+macOS/winres/TF-icon.rc diff --git a/linux/winres/TF-icon.res b/linux+macOS/winres/TF-icon.res similarity index 100% rename from linux/winres/TF-icon.res rename to linux+macOS/winres/TF-icon.res