Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
c85ded4
Update initial level value in LevelManager to 3
AaronCode2 Feb 17, 2025
aa40701
Adjust player reset position and update level value; add README for c…
AaronCode2 Feb 17, 2025
3513d7f
Update initial level value in LevelManager to 1 and adjust LevelDemo.…
AaronCode2 Feb 17, 2025
50ba2fb
Refactor LevelManager methods to simplify object creation and remove …
AaronCode2 Feb 17, 2025
c415eee
Update LevelManager to set initial level to 4 and display "THANK YOU!…
AaronCode2 Feb 17, 2025
78b3a47
Refactor Game and LevelManager to improve game loop logic and reset i…
AaronCode2 Feb 17, 2025
c639251
Refactor Game loop and add floating text effect; implement mouseOver …
AaronCode2 Feb 17, 2025
199cc91
Implement mouseOver utility function and integrate it into the game l…
AaronCode2 Feb 17, 2025
2093c9d
Refactor MusicManager methods for improved readability and consistency
AaronCode2 Feb 17, 2025
fac2051
Update README.md for clarity on compiler selection process
AaronCode2 Feb 17, 2025
002abd2
Update README.md to clarify compiler selection instructions
AaronCode2 Feb 17, 2025
79103e9
Update README.md for improved clarity on compiler selection instructions
AaronCode2 Feb 17, 2025
a80804f
Add initial workspace configuration with folder structure and editor …
AaronCode2 Feb 17, 2025
8126b82
Replace workspace configuration with a new structure and settings
AaronCode2 Feb 17, 2025
188510e
Remove unnecessary blank lines in App.cpp for cleaner code
AaronCode2 Feb 17, 2025
df9a8da
Fix typo in LevelDemo.txt by correcting T84 to T83 and ensure proper …
AaronCode2 Feb 17, 2025
bf1d531
Fix typo in README.md by correcting "Hoepful" to "Hopeful"
AaronCode2 Feb 17, 2025
0f179fc
Update README.md
AaronCode2 Feb 17, 2025
51fd979
Update README.md to add project information and clarify asset usage
AaronCode2 Feb 17, 2025
1977a90
Merge branch 'Release' of https://github.com/AaronCode2/Floating-King…
AaronCode2 Feb 17, 2025
75ac0df
Remove duplicate information in README.md
AaronCode2 Feb 17, 2025
247ae33
Add initialization function and logo loading to App
AaronCode2 Feb 18, 2025
fb04fa9
Refactor logo handling in App initialization
AaronCode2 Feb 18, 2025
5d2f298
Reorder audio device initialization in App to improve startup sequence
AaronCode2 Feb 18, 2025
a4d5587
Reorder audio device initialization in App to improve startup sequence
AaronCode2 Feb 18, 2025
9613709
Remove unnecessary blank line in App initialization
AaronCode2 Feb 18, 2025
419f6db
Fix formatting in README and ensure newline at end of files in CMakeL…
AaronCode2 Mar 23, 2025
4f49dce
Add Dockerfile for containerized build environment
AaronCode2 May 10, 2025
d7b40c2
Enhance Dockerfile by adding missing dependencies for build environment
AaronCode2 May 10, 2025
017b5c7
Merge branch 'Release' of https://github.com/AaronCode2/Floating-King…
AaronCode2 May 10, 2025
647f963
Remove Dockerfile as it is no longer needed for the build process
AaronCode2 Dec 26, 2025
7c82f04
Add note about using the Release branch for newer versions in README
AaronCode2 Dec 26, 2025
f9ab91e
Update CMake tasks and add Windows resource file for application
AaronCode2 Dec 27, 2025
b9997bd
Adjust jump velocity and speed calculation based on window state
AaronCode2 Dec 27, 2025
717b211
Add early return in move() method for window resize handling
AaronCode2 Dec 27, 2025
e2eb47a
Unload textures conditionally for non-Linux platforms in Player and L…
AaronCode2 Dec 27, 2025
34c798c
Remove CMakeLists.txt as part of project restructuring
AaronCode2 Jan 26, 2026
18210f4
Add CMakeLists.txt for project configuration and dependency management
AaronCode2 Jan 26, 2026
c90b685
Replace KnightLeft.png with knightLeft.png for Windows platform compa…
AaronCode2 Jan 26, 2026
6f44963
Replace knightLeft.png with new sprite file for improved graphics
AaronCode2 Jan 26, 2026
f3b241d
Fix typos in README.md for clarity and consistency
AaronCode2 Feb 14, 2026
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
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"label": "Cmake",
"type": "shell",
"command": "cmake --build build",
"command": "cmake --build build -- -j",
"group": {
"kind": "build",
"isDefault": true
Expand Down
13 changes: 11 additions & 2 deletions App.cpp
Original file line number Diff line number Diff line change
@@ -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 🎮;
}
2 changes: 2 additions & 0 deletions App.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@

namespace App {

void init();

void run();
}
Binary file added Assets/Logo/Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions Assets/Windows/app.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include <windows.h>
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
Binary file added Assets/Windows/favicon.ico
Binary file not shown.
Binary file added Assets/sprites/Play.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
23 changes: 23 additions & 0 deletions CMakelists.txt → CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<$<CONFIG:Release>:-mwindows>)
elseif(APPLE)

target_link_options(Floating_Kingdom PRIVATE $<$<CONFIG:Release>:-MACOSX_BUNDLE>)
endif()

target_compile_definitions(Floating_Kingdom PUBLIC $<$<CONFIG:Debug>: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()
13 changes: 10 additions & 3 deletions Classes/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ Player::Player(

Player::~Player() {

#if !__linux__
UnloadTexture(image[0]);
UnloadTexture(image[1]);
#endif

}

void Player::update(MusicManager *musicManager) {
Expand All @@ -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();
Expand All @@ -68,6 +73,8 @@ void Player::activateResetPosition() {

void Player::move() {

if(IsWindowResized() || IsWindowHidden()) return;

object.x += velocity.x;
checkCollisionX();

Expand Down
59 changes: 59 additions & 0 deletions Floating Kingdom.code-workspace
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
69 changes: 52 additions & 17 deletions Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ void Game::GameLoop() {
while(!WindowShouldClose()) {

BeginDrawing();
ClearBackground(GRAY);
updateGame();
levelManager.clearBackground();

if(startMainGame()) updateGame();

EndDrawing();
}

Expand All @@ -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();
Expand All @@ -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() {
Expand Down
9 changes: 8 additions & 1 deletion Game.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once
#include <cmath>
#include <raylib.h>
#include "utils.hpp"
#include "Classes/Sprite.hpp"
#include "Classes/Player.hpp"
#include "MusicManager/MusicManager.hpp"
Expand All @@ -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(
{
Expand All @@ -32,4 +38,5 @@ class Game {

void GameLoop();
void updateGame();
bool startMainGame();
};
Loading