Ports: Added a Super-Mario clone port.

Added a minimal dependency super mario port. (Only depends on SDL, SDL_image and SDL_mixer).
This commit is contained in:
Manuel Palenzuela 2021-04-04 00:41:48 +02:00 committed by Andreas Kling
parent ceafc5eea0
commit 4f690408af
Notes: sideshowbarker 2024-07-18 20:44:03 +09:00
6 changed files with 175 additions and 0 deletions

View file

@ -85,6 +85,7 @@ Please make sure to keep this list up to date when adding and updating ports. :^
| [`sl`](sl/) | Steam Locomotive (SL) | | https://github.com/mtoyoda/sl |
| [`sqlite`](sqlite/) | SQLite | 3350300 | https://www.sqlite.org/ |
| [`stress-ng`](stress-ng/) | stress-ng | 0.11.23 | https://github.com/ColinIanKing/stress-ng |
| [`Super-Mario`](Super-Mario/) | Super-Mario Clone | |https://github.com/Bennyhwanggggg/Super-Mario-Clone-Cpp|
| [`termcap`](termcap/) | GNU termcap | 1.3.1 | https://www.gnu.org/software/termutils/ |
| [`tinycc`](tinycc/) | Tiny C Compiler (TinyCC) | dev | https://github.com/TinyCC/tinycc |
| [`tinyscheme`](tinyscheme/) | TinyScheme Interpreter | 1.42 | https://sourceforge.net/projects/tinyscheme/ |

18
Ports/Super-Mario/package.sh Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env -S bash ../.port_include.sh
port=Super-Mario
useconfigure=true
version=git
depends="SDL2 SDL2_mixer SDL2_image"
workdir=Super-Mario-Clone-Cpp-master
configopts="-DCMAKE_TOOLCHAIN_FILE=$SERENITY_ROOT/Toolchain/CMakeToolchain.txt"
files="https://github.com/Bennyhwanggggg/Super-Mario-Clone-Cpp/archive/refs/heads/master.zip master.zip"
install_location="Root/opt/Super_Mario"
configure() {
run cmake $configopts
}
install() {
run mkdir -p "${SERENITY_BUILD_DIR}/${install_location}"
run cp -r uMario app.ico icon2.ico files "${SERENITY_BUILD_DIR}/${install_location}"
}

View file

@ -0,0 +1,20 @@
diff --git a/src/Core.cpp b/src/Core.cpp
index c04581b..f0c0308 100644
--- a/src/Core.cpp
+++ b/src/Core.cpp
@@ -36,7 +36,7 @@ CCore::CCore(void) {
quitGame = true;
}
- rR = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
+ rR = SDL_CreateRenderer(window, -1, 0);
// ----- ICO
std::string filename = "files/images/ico.bmp";
@@ -376,4 +376,4 @@ void CCore::resetMove() {
Map* CCore::getMap() {
return oMap;
-}
\ No newline at end of file
+}

View file

@ -0,0 +1,69 @@
diff --git a/src/Music.cpp b/src/Music.cpp
index 5bf5047..a82dfb2 100644
--- a/src/Music.cpp
+++ b/src/Music.cpp
@@ -111,23 +111,23 @@ void Music::changeMusic(bool musicByLevel, bool forceChange) {
}
void Music::PlayMusic() {
- if(currentMusic != mNOTHING) {
+ /*if(currentMusic != mNOTHING) {
Mix_PlayMusic(vMusic[currentMusic - 1], -1);
musicStopped = false;
} else {
StopMusic();
- }
+ }*/
}
void Music::PlayMusic(eMusic musicID) {
- if(musicID != mNOTHING) {
+ /*if(musicID != mNOTHING) {
Mix_PlayMusic(vMusic[musicID - 1], -1);
musicStopped = false;
currentMusic = musicID;
} else {
StopMusic();
currentMusic = mNOTHING;
- }
+ }*/
}
void Music::StopMusic() {
@@ -150,8 +150,8 @@ void Music::PauseMusic() {
/* ******************************************** */
void Music::PlayChunk(eChunk chunkID) {
- Mix_VolumeChunk(vChunk[chunkID], iVolume);
- Mix_PlayChannel(-1, vChunk[chunkID], 0);
+ //Mix_VolumeChunk(vChunk[chunkID], iVolume);
+ //Mix_PlayChannel(-1, vChunk[chunkID], 0);
}
/* ******************************************** */
diff --git a/src/MusicManager.cpp b/src/MusicManager.cpp
index d992e6c..d5b70f1 100644
--- a/src/MusicManager.cpp
+++ b/src/MusicManager.cpp
@@ -9,14 +9,14 @@ MusicManager::~MusicManager(void) {
}
void MusicManager::PlayMusic() {
- vMusic.push_back(Mix_LoadMUS("files/sounds/overworld.wav"));
- vMusic.push_back(Mix_LoadMUS("files/sounds/overworld.wav"));
- Mix_VolumeMusic(100);
- Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 2048);
- Mix_PlayMusic(vMusic[0], -1);
+ //vMusic.push_back(Mix_LoadMUS("files/sounds/overworld.wav"));
+ //vMusic.push_back(Mix_LoadMUS("files/sounds/overworld.wav"));
+ //Mix_VolumeMusic(100);
+ //Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 2048);
+ //Mix_PlayMusic(vMusic[0], -1);
}
Mix_Music* MusicManager::loadMusic(std::string fileName) {
fileName = "files/sounds/" + fileName + ".wav";
return Mix_LoadMUS("files/sounds/overworld.wav");
-}
\ No newline at end of file
+}

View file

@ -0,0 +1,30 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 616d876..d1aa020 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,10 +18,13 @@ elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
endif()
endif()
-find_package(SDL2 REQUIRED)
-find_package(SDL2_Image REQUIRED)
-find_package(SDL2_Mixer REQUIRED)
-include_directories(${SDL2_INCLUDE_DIR} ${SDL2_IMAGE_INCLUDE_DIR} ${SDL2_MIXER_INCLUDE_DIR})
+INCLUDE(FindPkgConfig)
+
+PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2)
+PKG_SEARCH_MODULE(SDL2IMAGE REQUIRED SDL2_image>=2.0.0)
+PKG_SEARCH_MODULE(SDL2MIXER REQUIRED SDL2_mixer>=2.0.0)
+
+include_directories(${SDL2_INCLUDE_DIRS} ${SDL2_IMAGE_INCLUDE_DIRS} ${SDL2_MIXER_INCLUDE_DIRS})
file(COPY src/files DESTINATION .)
@@ -30,6 +33,6 @@ include_directories(src)
file(GLOB_RECURSE uMario_SOURCES "src/*.cpp")
add_executable (uMario ${uMario_SOURCES})
-target_link_libraries(uMario ${SDL2_LIBRARY} ${SDL2_IMAGE_LIBRARY} ${SDL2_MIXER_LIBRARY})
+target_link_libraries(uMario ${SDL2_LIBRARIES} ${SDL2_IMAGE_LIBRARIES} ${SDL2_MIXER_LIBRARIES}-lSDL2_mixer -lpthread -lm -lgfx -lgui -lipc -lcore)
install(TARGETS uMario RUNTIME DESTINATION ${BIN_DIR})

View file

@ -0,0 +1,37 @@
diff --git a/src/FireBall.cpp b/src/FireBall.cpp
index 6f3eacc..6f5eade 100644
--- a/src/FireBall.cpp
+++ b/src/FireBall.cpp
@@ -1,4 +1,4 @@
-#include "FireBall.h"
+#include "Fireball.h"
#include "Core.h"
#include <math.h>
@@ -68,4 +68,4 @@ void FireBall::updateXPos() {
void FireBall::collisionWithPlayer(bool TOP) {
CCore::getMap()->playerDeath(true, false);
-}
\ No newline at end of file
+}
diff --git a/src/Map.h b/src/Map.h
index b812b49..f6abbb9 100644
--- a/src/Map.h
+++ b/src/Map.h
@@ -28,7 +28,7 @@
#include "Flower.h"
#include "Lakito.h"
#include "Spikey.h"
-#include "FireBall.h"
+#include "Fireball.h"
#include "Fire.h"
#include "Pipe.h"
#include "Spring.h"
@@ -406,4 +406,4 @@ public:
void setInEvent(bool inEvent);
};
-#endif
\ No newline at end of file
+#endif