Uploading assets & developing multiplayer implementations

This commit is contained in:
2026-05-20 12:11:04 +03:00
parent 446d0ede8e
commit 67f5fcf374
19 changed files with 59 additions and 14 deletions
+16
View File
@@ -0,0 +1,16 @@
# Asset Credits & Attribution
The multimedia resources (graphics, sprites, and audio files) contained within this folder are not my personal creations. They have been curated and adapted from the open-source community for educational development.
## Original Source Information
* **Project:** Moddable Pong
* **Author / Creator:** Endless OS Foundation & Endless Studios
* **Website:** [endlessos.org](https://endlessos.org)
* **Source Code Repository:** [github.com/endlessm/moddable-pong](https://github.com/endlessm/moddable-pong/)
---
## Usage Notice
These assets are integrated strictly for non-commercial, academic layout validation and development milestones. This work is part of a student engineering project within the **Helios Additional_activity** initiative at the **Technical University of Cluj-Napoca (UTCN) - Faculty of Electronics, Telecommunications and Information Technology (ETTI)**.
All rights, ownership, and copyrights belong entirely to the original creators at the Endless OS Foundation.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

+1 -2
View File
@@ -7,6 +7,7 @@
// Game States & Configurations // Game States & Configurations
enum class GameState { enum class GameState {
MainMenu, MainMenu,
DifficultySelect,
Playing, Playing,
Paused, Paused,
GameOver GameOver
@@ -28,8 +29,6 @@ class GameObject {
public: public:
Vector2 position; Vector2 position;
Color color; Color color;
public:
GameObject(Vector2 pos, Color c) : position(pos), color(c) {} GameObject(Vector2 pos, Color c) : position(pos), color(c) {}
virtual ~GameObject() = default; virtual ~GameObject() = default;
+1 -1
View File
@@ -16,6 +16,6 @@ public:
: title(menuTitle), options(menuOptions), selectedIndex(0) { : title(menuTitle), options(menuOptions), selectedIndex(0) {
} }
void Update(GameState& currentState); int Update();
void Draw(); void Draw();
}; };
+35 -1
View File
@@ -48,6 +48,7 @@ int main() {
GameState currentState = GameState::MainMenu; GameState currentState = GameState::MainMenu;
Menu mainMenu("PONG RELOADED", { "Start Game", "Quit" }); Menu mainMenu("PONG RELOADED", { "Start Game", "Quit" });
Menu difficultyMenu("SELECT DIFFICULTY", { "Easy", "Normal", "Hard", "Back" });
// --- Main Game Loop --- // --- Main Game Loop ---
@@ -58,11 +59,44 @@ int main() {
switch (currentState) { switch (currentState) {
case GameState::MainMenu: case GameState::MainMenu:
{ {
mainMenu.Update(currentState); int selected = mainMenu.Update();
if (selected == 0) {
currentState = GameState::DifficultySelect;
}
else if (selected == 1) {
currentState = GameState::GameOver;
}
mainMenu.Draw(); mainMenu.Draw();
break; break;
} }
case GameState::DifficultySelect:
{
int selected = difficultyMenu.Update();
if (selected >= 0 && selected <= 2) {
if (selected == 0) {
cpu.SetDifficulty(Difficulty::Easy);
}
else if (selected == 1) {
cpu.SetDifficulty(Difficulty::Normal);
}
else if (selected == 2) {
cpu.SetDifficulty(Difficulty::Hard);
}
// Reset game session stats
player_score = 0;
cpu_score = 0;
ResetBall(ball, screen_width, screen_height);
currentState = GameState::Playing;
}
else if (selected == 3) {
currentState = GameState::MainMenu;
}
difficultyMenu.Draw();
break;
}
case GameState::Playing: case GameState::Playing:
{ {
ball.Update(); ball.Update();
+6 -10
View File
@@ -1,25 +1,21 @@
#include "menu.h" #include "menu.h"
void Menu::Update(GameState& currentState) { int Menu::Update() {
// Handle Navigation // Handle Navigation
if (IsKeyPressed(KEY_DOWN)) { if (IsKeyPressed(KEY_DOWN)) {
selectedIndex++; selectedIndex++;
if (selectedIndex >= options.size()) selectedIndex = 0; if (selectedIndex >= static_cast<int>(options.size())) selectedIndex = 0;
} }
if (IsKeyPressed(KEY_UP)) { if (IsKeyPressed(KEY_UP)) {
selectedIndex--; selectedIndex--;
if (selectedIndex < 0) selectedIndex = options.size() - 1; if (selectedIndex < 0) selectedIndex = static_cast<int>(options.size()) - 1;
} }
// Handle Selection // Handle Selection
if (IsKeyPressed(KEY_ENTER)) { if (IsKeyPressed(KEY_ENTER)) {
if (options[selectedIndex] == "Start Game") { return selectedIndex;
currentState = GameState::Playing;
}
else if (options[selectedIndex] == "Quit") {
currentState = GameState::GameOver;
}
} }
return -1;
} }
void Menu::Draw() { void Menu::Draw() {
@@ -30,7 +26,7 @@ void Menu::Draw() {
DrawText(title.c_str(), screenWidth / 2 - MeasureText(title.c_str(), 60) / 2, screenHeight / 4, 60, WHITE); DrawText(title.c_str(), screenWidth / 2 - MeasureText(title.c_str(), 60) / 2, screenHeight / 4, 60, WHITE);
// Draw Options // Draw Options
for (int i = 0; i < options.size(); i++) { for (int i = 0; i < static_cast<int>(options.size()); i++) {
Color textColor = (i == selectedIndex) ? YELLOW : WHITE; Color textColor = (i == selectedIndex) ? YELLOW : WHITE;
DrawText(options[i].c_str(), screenWidth / 2 - MeasureText(options[i].c_str(), 40) / 2, screenHeight / 2 + (i * 60), 40, textColor); DrawText(options[i].c_str(), screenWidth / 2 - MeasureText(options[i].c_str(), 40) / 2, screenHeight / 2 + (i * 60), 40, textColor);
} }