Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

port to macOS #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
13 changes: 7 additions & 6 deletions linux/main.cpp → linux+macOS/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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,
Expand Down Expand Up @@ -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()) {
Expand All @@ -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 };
Expand Down
1 change: 1 addition & 0 deletions linux/platform.cpp → linux+macOS/platform.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "platform.h"
#include <math.h>
#include <stdlib.h>

const int screenWidth = 800;
const int screenHeight = 450;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion linux/player.cpp → linux+macOS/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.