diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 7c704c4..301cd6d 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -4,7 +4,7 @@ { "label": "Cmake", "type": "shell", - "command": "cmake --build build", + "command": "cmake --build build -- -j", "group": { "kind": "build", "isDefault": true diff --git a/App.cpp b/App.cpp index 99d36f5..e9e6846 100644 --- a/App.cpp +++ b/App.cpp @@ -1,17 +1,26 @@ #include "App.hpp" -void App::run() { +void App::init() { SetConfigFlags(FLAG_WINDOW_ALWAYS_RUN); SetConfigFlags(FLAG_WINDOW_RESIZABLE); + + Image logo = LoadImage("../Assets/Logo/Logo.png"); InitWindow(1440, 750, "Floating Kingdom"); + + SetWindowIcon(logo); + UnloadImage(logo); + InitAudioDevice(); - MaximizeWindow(); SetTargetFPS(60); +} + +void App::run() { + init(); Game 🎮; } \ No newline at end of file diff --git a/App.hpp b/App.hpp index b828284..d6340c2 100644 --- a/App.hpp +++ b/App.hpp @@ -4,5 +4,7 @@ namespace App { + void init(); + void run(); } \ No newline at end of file diff --git a/Assets/Logo/Logo.png b/Assets/Logo/Logo.png new file mode 100644 index 0000000..915561e Binary files /dev/null and b/Assets/Logo/Logo.png differ diff --git a/Assets/Windows/app.rc b/Assets/Windows/app.rc new file mode 100644 index 0000000..feec0e6 --- /dev/null +++ b/Assets/Windows/app.rc @@ -0,0 +1,32 @@ +#include +IDI_ICON1 ICON "favicon.ico" + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,0 + PRODUCTVERSION 1,0,0,0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK + FILEFLAGS 0 + FILEOS VOS__WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE 0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + BEGIN + VALUE "CompanyName", "N/A" + VALUE "FileDescription", "Floating kingdom" + VALUE "FileVersion", "1.0.0" + VALUE "InternalName", "Floating_kingdom" + VALUE "OriginalFilename", "Floating_kingdom.exe" + VALUE "ProductName", "Floating kingdom" + VALUE "ProductVersion", "1.0.0" + VALUE "LegalCopyright", "N/A" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 1200, 0x0409 + END +END \ No newline at end of file diff --git a/Assets/Windows/favicon.ico b/Assets/Windows/favicon.ico new file mode 100644 index 0000000..68bdef2 Binary files /dev/null and b/Assets/Windows/favicon.ico differ diff --git a/Assets/sprites/Play.png b/Assets/sprites/Play.png new file mode 100644 index 0000000..6e5ac27 Binary files /dev/null and b/Assets/sprites/Play.png differ diff --git a/Assets/sprites/KnightLeft.png b/Assets/sprites/knightLeft.png similarity index 100% rename from Assets/sprites/KnightLeft.png rename to Assets/sprites/knightLeft.png diff --git a/CMakelists.txt b/CMakeLists.txt similarity index 52% rename from CMakelists.txt rename to CMakeLists.txt index 8e6f5e9..97568bf 100644 --- a/CMakelists.txt +++ b/CMakeLists.txt @@ -35,3 +35,26 @@ SOURCE_FILES add_executable(Floating_Kingdom ${SOURCE_FILES}) target_link_libraries(Floating_Kingdom raylib) + +if(WIN32) + + target_sources(Floating_Kingdom PRIVATE Assets/Windows/app.rc) + target_link_options(Floating_Kingdom PRIVATE $<$:-mwindows>) +elseif(APPLE) + + target_link_options(Floating_Kingdom PRIVATE $<$:-MACOSX_BUNDLE>) +endif() + +target_compile_definitions(Floating_Kingdom PUBLIC $<$:DEBUG_ENABLED>) + +if("${PLATFORM}" STREQUAL "Web") + + message(FATAL_ERROR "Do not build in this project in the Web as it doesn't work!") +endif() + +if(APPLE) + + target_link_libraries(${PROJECT_NAME} "-framework IOKit") + target_link_libraries(${PROJECT_NAME} "-framework Cocoa") + target_link_libraries(${PROJECT_NAME} "-framework OpenGL") +endif() \ No newline at end of file diff --git a/Classes/Player.cpp b/Classes/Player.cpp index d28801a..a83efb9 100644 --- a/Classes/Player.cpp +++ b/Classes/Player.cpp @@ -22,8 +22,11 @@ Player::Player( Player::~Player() { +#if !__linux__ UnloadTexture(image[0]); UnloadTexture(image[1]); +#endif + } void Player::update(MusicManager *musicManager) { @@ -46,15 +49,17 @@ void Player::update(MusicManager *musicManager) { if(jumpKey() && isOnGround) { musicManager->playSoundEffect(Jump); - velocity.y = -30 * (utils::getSize().y / 50); + if(IsWindowMaximized()) + velocity.y = -35; + else velocity.y = -35 * (utils::getSize().y / 51); } - const int speed = 5 * (utils::getSize().x / 50); + const float speed = 6.5 * (utils::getSize().x / 51); if(IsKeyDown(KEY_D) || IsKeyDown(KEY_RIGHT)) velocity.x = speed; else if(IsKeyDown(KEY_A) || IsKeyDown(KEY_LEFT)) velocity.x = -speed; - if(applyGravity()) musicManager->playSoundEffect(Hurt); + if(applyGravity() && (IsWindowResized() || IsWindowHidden())) musicManager->playSoundEffect(Hurt); move(); draw(); @@ -68,6 +73,8 @@ void Player::activateResetPosition() { void Player::move() { + if(IsWindowResized() || IsWindowHidden()) return; + object.x += velocity.x; checkCollisionX(); diff --git a/Floating Kingdom.code-workspace b/Floating Kingdom.code-workspace new file mode 100644 index 0000000..b474dbe --- /dev/null +++ b/Floating Kingdom.code-workspace @@ -0,0 +1,59 @@ +{ + "folders": [ + { + "path": "." + } + ], + "settings": { + "files.associations": { + "*.tcc": "cpp", + "array": "cpp", + "atomic": "cpp", + "bit": "cpp", + "cctype": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "compare": "cpp", + "concepts": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "deque": "cpp", + "map": "cpp", + "string": "cpp", + "unordered_map": "cpp", + "vector": "cpp", + "exception": "cpp", + "algorithm": "cpp", + "functional": "cpp", + "iterator": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "numeric": "cpp", + "optional": "cpp", + "random": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "fstream": "cpp", + "initializer_list": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "limits": "cpp", + "new": "cpp", + "numbers": "cpp", + "ostream": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "cinttypes": "cpp", + "typeinfo": "cpp" + } + } +} \ No newline at end of file diff --git a/Game.cpp b/Game.cpp index dc4204c..ec055bd 100644 --- a/Game.cpp +++ b/Game.cpp @@ -16,8 +16,10 @@ void Game::GameLoop() { while(!WindowShouldClose()) { BeginDrawing(); - ClearBackground(GRAY); - updateGame(); + levelManager.clearBackground(); + + if(startMainGame()) updateGame(); + EndDrawing(); } @@ -27,15 +29,6 @@ void Game::GameLoop() { void Game::updateGame() { - levelManager.clearBackground(); - musicManager.playMusic(); - - if(IsKeyDown(KEY_Q)) { - - levelManager.readData(); - levelManager.makeBackgroundTiles(); - } - if(IsWindowResized()) { levelManager.tiles.clear(); @@ -44,15 +37,57 @@ void Game::updateGame() { levelManager.readData(); levelManager.makeBackgroundTiles(); } - - if(IsKeyDown(KEY_C)) { - levelManager.tiles.clear(); - levelManager.items.clear(); - levelManager.slimes.clear(); + musicManager.playMusic(); + levelManager.update(&player, &musicManager); +} + +bool Game::startMainGame() { + + time += GetFrameTime(); + + float yOffset = sin(time * 2.0) * 25; + + Rectangle src = { + + 0, + playBtn.height / 2.0f, + (float) playBtn.width / 2, + (float) playBtn.height / 2 + }; + + Rectangle object = { + + (float) (GetScreenWidth() / 2) - 150, + (float) (GetScreenHeight() / 2), + 300, + 100 + }; + + if(utils::mouseOver(object)) { + src.x = src.width; + + if(IsMouseButtonDown(MOUSE_BUTTON_LEFT)) startGame = true; } - levelManager.update(&player, &musicManager); + if(!startGame) { + + DrawTexturePro( + playBtn, + src, object, + {0, 0}, 0, WHITE + ); + + DrawText( + "Floating Kingdom", + (GetScreenWidth() / 2) - 400, + ((GetScreenHeight() / 3) - 100) + yOffset, + 100, + GOLD + ); + } + + return startGame; } Game::~Game() { diff --git a/Game.hpp b/Game.hpp index 5896d8a..be90bbb 100644 --- a/Game.hpp +++ b/Game.hpp @@ -1,5 +1,7 @@ #pragma once +#include #include +#include "utils.hpp" #include "Classes/Sprite.hpp" #include "Classes/Player.hpp" #include "MusicManager/MusicManager.hpp" @@ -13,10 +15,14 @@ class Game { ~Game(); private: - + + Texture2D playBtn = LoadTexture("../Assets/sprites/Play.png"); + LevelManager levelManager; MusicManager musicManager; + float time = 0; + bool startGame = false; Player player = Player( { @@ -32,4 +38,5 @@ class Game { void GameLoop(); void updateGame(); + bool startMainGame(); }; \ No newline at end of file diff --git a/LevelManager/LevelManager.cpp b/LevelManager/LevelManager.cpp index 482d39e..49d2fc4 100644 --- a/LevelManager/LevelManager.cpp +++ b/LevelManager/LevelManager.cpp @@ -84,8 +84,17 @@ void LevelManager::update(Player *player, MusicManager *musicManager) { break; case 3: - playerResetPosition = {245, 502}; + playerResetPosition = {225, 502}; break; + + case 4: + + DrawText( + "THANK YOU!", + (GetScreenWidth() / 2) - 300, (GetScreenHeight() / 2) - 100, + 100, BLACK + ); + break; } player->resetPosition = playerResetPosition; @@ -102,11 +111,14 @@ void LevelManager::clearBackground() { void LevelManager::destroy() { +#if !__linux__ UnloadTexture(PlatFormTile::image[0]); UnloadTexture(PlatFormTile::image[1]); UnloadTexture(Item::image[0]); UnloadTexture(Item::image[1]); +#endif + } void LevelManager::readData() { @@ -117,6 +129,7 @@ void LevelManager::readData() { std::cerr << "\033[31mCould Not Open Level File\n\033[0m"; std::string line; + float y = 0.0f; float tileCounter = 0.0f; @@ -140,6 +153,14 @@ void LevelManager::readData() { for(size_t x = 0; x < line.length(); x++) { + object = { + + tileCounter * utils::getSize().x, + y * utils::getSize().y, + utils::getSize().x, + utils::getSize().y + }; + switch(line[x]) { case '/': tileCounter++; @@ -149,19 +170,22 @@ void LevelManager::readData() { case 'P': case 'S': - createTiles(y, tileCounter, line, x); + createTiles( tileCounter, line, x); + tileCounter++; break; case 'p': case 'g': - createSlime(y, tileCounter, line, x); + createSlime( tileCounter, line, x); + tileCounter++; break; case 'C': case 'F': - createItem(y, tileCounter, line, x); + createItem( tileCounter, line, x); + tileCounter++; break; } } if(line.find('#') == std::string::npos) y++; @@ -204,123 +228,50 @@ void LevelManager::makeBackgroundTiles() { } void LevelManager::createItem( - float y, float &tileCounter, + float &tileCounter, std::string line, size_t x ) { - bool skip = false; - - Rectangle object = { - - tileCounter * utils::getSize().x, - y * utils::getSize().y, - utils::getSize().x, - utils::getSize().y - }; - if(line[x] == 'F') object.y -= 10; - for(auto &item : items) { + items.push_back(Item( - if(item.object.x == object.x && item.object.y == object.y) { - - skip = true; - break; - } - } - - if(!skip) { - items.push_back(Item( - - object, - { - (float) line[x + 1] - adjust, - (float) line[x + 2] - adjust - }, - (line[x] == 'F') ? Fruit : Coin - )); - } - - tileCounter++; + object, + { + (float) line[x + 1] - adjust, + (float) line[x + 2] - adjust + }, + (line[x] == 'F') ? Fruit : Coin + )); } void LevelManager::createSlime( - float y, float &tileCounter, + float &tileCounter, std::string line, size_t x ) { - bool skip = false; - - Rectangle object = { - - tileCounter * utils::getSize().x, - y * utils::getSize().y, - utils::getSize().x, - utils::getSize().y - }; - - for(auto &slime : slimes) { - - if(slime.object.x == object.x && slime.object.y == object.y) { + slimes.push_back(Slime( - skip = true; - break; - } - } - - if(!skip) { - - slimes.push_back(Slime( - - object, - (line[x] == 'g') ? Green : Purple - )); - } - - tileCounter++; + object, + (line[x] == 'g') ? Green : Purple + )); } void LevelManager::createTiles( - float y, float &tileCounter, + float &tileCounter, std::string line, size_t x ) { - bool skip = false; - - // Screen Width Default: 1600 Screen Height Default: 811 - - Rectangle object = { - - tileCounter * utils::getSize().x, - y * utils::getSize().y, - utils::getSize().x, - utils::getSize().y - }; - - for(auto &tile : tiles) { - - if(tile.object.x == object.x && tile.object.y == object.y) { - - skip = true; - break; - } - } - - if(!skip) { - - tiles.push_back(PlatFormTile( - object, - (line[x] == 'P') ? PlatForm : Tile, - { - (float) line[x + 1] - adjust, - (float) line[x + 2] - adjust, - }, - (line[x] != 'T') ? true : false - )); - } - - tileCounter++; + tiles.push_back(PlatFormTile( + object, + (line[x] == 'P') ? PlatForm : Tile, + { + (float) line[x + 1] - adjust, + (float) line[x + 2] - adjust, + }, + (line[x] != 'T') ? true : false + )); } \ No newline at end of file diff --git a/LevelManager/LevelManager.hpp b/LevelManager/LevelManager.hpp index 4289651..297dc4f 100644 --- a/LevelManager/LevelManager.hpp +++ b/LevelManager/LevelManager.hpp @@ -36,19 +36,17 @@ struct LevelManager { private: const int adjust = 48; + Rectangle object; - void createItem( - float y, float &tileCounter, + void createItem( float &tileCounter, std::string line, size_t x ); - void createSlime( - float y, float &tileCounter, + void createSlime( float &tileCounter, std::string line, size_t x ); - void createTiles( - float y, float &tileCounter, + void createTiles( float &tileCounter, std::string line, size_t x ); }; \ No newline at end of file diff --git a/LevelManager/Levels/LevelDemo.txt b/LevelManager/Levels/LevelDemo.txt index f55217b..9dc7999 100644 --- a/LevelManager/Levels/LevelDemo.txt +++ b/LevelManager/Levels/LevelDemo.txt @@ -18,10 +18,10 @@ S00 P00 /00 /00 S73 S01 S00 C00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 T38 #Level 2 ~[ for line 35 & col 128] /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 C00 -/00 /00 T75 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 P01 /00 /00 T83 -T23 S20 S20 S22 /00 /00 /00 /00 /00 /00 /00 /00 T23 S20 S20 P01 /00 T34 /00 /00 /00 C00 C00 /00 /00 /00 /00 /00 /00 /00 S22 +/00 /00 T75 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 T18 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 P01 /00 /00 T83 +T23 S20 S20 S22 /00 /00 /00 /00 /00 /00 /00 /00 T23 S20 S20 P01 /00 T34 /00 /00 /00 C00 C00 T88 /00 /00 /00 /00 /00 /00 S22 /00 /00 S31 S21 /00 /00 /00 C00 /00 S20 S22 /00 /00 /00 /00 /00 T25 T35 T45 S20 S20 T23 T23 S20 S20 -/00 F01 S21 /00 /00 /00 /00 P01 S22 S21 /00 /00 /00 /00 /00 /00 /00 T36 /00 +/00 F01 S21 /00 /00 /00 /00 P01 S22 S21 /00 /00 /00 /00 /00 /00 /00 T36 /00 S20 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 T37 /00 /00 /00 C00 C00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 T28 /00 /00 /00 P11 P21 S20 S20 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 T28 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 C00 C00 @@ -34,18 +34,34 @@ P11 P21 /00 P01 S22 S20 /00 /00 /00 /00 /00 /00 /00 /00 S21 S21 /00 /00 /00 /00 #Level 3 ~[ for line 51 & col 128] -/00 /00 /00 /00 T84 /00 /00 /00 /00 /00 /00 C00 p00 -/00 /00 S40 S40 S40 S40 S40 S40 /00 /00 /00 P12 P22 /00 /00 S40 S40 S40 /00 /00 /00 /00 /00 /00 C00 +/00 /00 T48 /00 T83 /00 /00 /00 /00 /00 /00 C00 p00 /00 /00 /00 T76 +/00 /00 S40 S40 S40 S40 S40 S40 /00 /00 /00 P12 P22 /00 /00 S40 S40 S40 /00 /00 /00 /00 /00 T58 C00 /00 /00 /00 /00 S41 S50 S41 /00 /00 /00 /00 /00 /00 /00 /00 /00 S51 S41 S40 S40 /00 /00 P02 S40 P02 -/00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 C00 +/00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 C00 T57 /00 /00 /00 F21 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 P02 S40 -/00 /00 /00 P02 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 C00 -/00 /00 /00 /00 C00 C00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 S40 P02 -/00 /00 /00 /00 P12 P22 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 C00 C00 /00 /00 /00 /00 /00 /00 /00 /00 /00 C00 /00 F10 +/00 /00 /00 P02 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 T53 /00 /00 /00 /00 /00 /00 /00 T56 C00 +/00 /00 /00 /00 C00 C00 /00 /00 /00 /00 /00 /00 /00 /00 /00 T54 /00 /00 /00 /00 /00 /00 /00 S40 P02 +/00 /00 /00 /00 P12 P22 /00 /00 /00 /00 /00 /00 /00 /00 /00 T55 /00 C00 C00 /00 /00 /00 /00 /00 /00 /00 /00 /00 C00 /00 F10 /00 /00 /00 /00 /00 /00 /00 /00 C00 C00 /00 /00 /00 /00 S40 S40 S40 T52 T52 P02 /00 /00 /00 /00 /00 /00 /00 /00 P02 S40 T52 -/00 /00 /00 /00 /00 /00 /00 C00 /00 /00 C00 /00 /00 S40 S50 S41 S41 /00 /00 /00 /00 /00 /00 C00 C00 -/00 /00 /00 /00 /00 /00 S40 P02 /00 /00 P02 S40 S40 S41 S41 /00 /00 /00 /00 /00 /00 /00 /00 P12 P22 S40 S40 +/00 /00 /00 /00 /00 /00 /00 C00 /00 /00 C00 /00 /00 S40 S50 S41 S41 /00 /00 /00 /00 /00 /00 C00 C00 /00 T17 +/00 /00 /00 /00 T86 /00 S40 P02 /00 /00 P02 S40 S40 S41 S41 /00 /00 /00 /00 /00 /00 /00 /00 P12 P22 S40 S40 /00 /00 /00 T52 S40 S40 S51 /00 /00 /00 /00 /00 S51 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 S40 P12 P22 S40 S40 /00 C00 C00 C00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 /00 S51 S40 P02 -P12 P22 \ No newline at end of file +P12 P22 +#Level 4 ~[ for 🔚] +/00 /00 /00 /00 /00 /00 C00 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 C00 +/00 /00 /00 /00 /00 /00 C00 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 C00 +/00 /00 /00 /00 /00 /00 C00 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 C00 +/00 /00 /00 /00 /00 /00 C00 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 C00 +/00 /00 /00 /00 /00 /00 C00 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 C00 +/00 /00 /00 /00 /00 /00 C00 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 C00 +/00 /00 /00 /00 /00 /00 C00 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 C00 +/00 /00 /00 /00 /00 /00 C00 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 C00 +/00 /00 /00 /00 /00 /00 C00 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 C00 +/00 /00 /00 /00 /00 /00 C00 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 C00 +/00 /00 /00 /00 /00 /00 C00 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 C00 +/00 /00 /00 /00 /00 /00 C00 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 C00 +/00 /00 /00 /00 /00 /00 C00 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 C00 +/00 /00 /00 /00 /00 /00 C00 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 F21 C00 +/00 /00 /00 /00 P13 P23 P13 P23 P13 P23 P13 P23 P13 P23 P13 P23 P13 P23 P13 P23 P13 P23 P13 P23 P13 P23 \ No newline at end of file diff --git a/MusicManager/MusicManager.hpp b/MusicManager/MusicManager.hpp index 007ec80..89f887a 100644 --- a/MusicManager/MusicManager.hpp +++ b/MusicManager/MusicManager.hpp @@ -13,9 +13,9 @@ struct MusicManager { public: - void init() { PlayMusicStream(mainMusic); }; - void playMusic() { UpdateMusicStream(mainMusic); }; - void destroy() { UnloadMusicStream(mainMusic); }; + void init() { PlayMusicStream(mainMusic); }; + void playMusic() { UpdateMusicStream(mainMusic); }; + void destroy() { UnloadMusicStream(mainMusic); }; void playSoundEffect(SoundEffect soundEffect); diff --git a/README.md b/README.md new file mode 100644 index 0000000..8fdd4da --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +# How To Compile + +## Hopefully you have a **C++ Compiler**, **CMake**, **Make**, and **VsCode** installed to work + +1. Download as a Zip or use Git +2. Open the Project with Vscode and install the C/C++ Extension Pack +3. It should come with a option of what Compiler to use - you may have to reopen VsCode - use the compiler that fits you (a GCC is recommended) + +4. Once done, open the Terminal in this directory or you could use the built-in one in Vscode. +5. Check if Cmake has created the build file or you have done it wrong ❌ +6. Type this command + + cmake --build build + +## How To Play + +- Use WASD or Arrow keys to move +- To Jump use the W, Up Arrow or even the Space Bar +- Try to reach the Sign and Hopeful not fall due to Gravity +- Most Important: Have Fun! 🎮😊 + +## Info + +- The Assets are CC0 +- Use the Release Branch for the newer version! +- This is a Raylib C++ Project +- You can do anything with this project \ No newline at end of file diff --git a/utils.cpp b/utils.cpp index 50eebba..0ab93ab 100644 --- a/utils.cpp +++ b/utils.cpp @@ -10,4 +10,12 @@ Vector2 utils::getSize() { (GetScreenWidth() / 1600.0f) * defaultSize, (GetScreenHeight() / 811.0f) * defaultSize, }; -} \ No newline at end of file +} + +bool utils::mouseOver(Rectangle object) { + + if(CheckCollisionPointRec(GetMousePosition(), object)) + return true; + + return false; +} diff --git a/utils.hpp b/utils.hpp index c930417..f71bfac 100644 --- a/utils.hpp +++ b/utils.hpp @@ -6,4 +6,6 @@ namespace utils { extern Color testColor; Vector2 getSize(); + + bool mouseOver(Rectangle object); } \ No newline at end of file