v0.8
Summary of Changes
Transitioned the game from loading asset files directly from disk paths to a robust Windows resource-embedding system (.rc), packaging all textures, audio, and application icons directly into the executable.
Detailed Breakdown
1. Resource Architecture & Asset Embedding
-
Added Window Resource Script (
resources.rc): Created to map resource IDs to physical asset paths for compiling directly into the binary. -
Asset Resource Mapping (
include/resource.h): Created a new header defining unique resource IDs (RCDATA) for the application icon, all game textures, and audio effects: -
IDI_ICON1(100) -
Textures:
IDR_TEX_BASIC_SPACE,IDR_TEX_WALLS,IDR_TEX_LINE,IDR_TEX_BALL,IDR_TEX_PADDLE,IDR_TEX_PADDLE2 -
Audio:
IDR_SND_PADDLE_HIT,IDR_SND_WALL_HIT,IDR_SND_SCORE,IDR_SND_BANANA -
Added Executable Icons: Bundled
icon.icoandicon.jpgdirectly into the project root and build pipeline.
2. Backend Engine & Asset Loading
- Created Memory Resource Loader (
src/resource_loader.cpp): - Implemented Win32 API interactions (
FindResource,LoadResource,LockResource) to access embedded binary data safely. - Resolved Win32 and Raylib naming collisions (e.g.,
Rectangle,CloseWindow,PlaySound,ShowCursor) using explicit#definealiasing and#undefguards. - Added
LoadTextureFromResource(int id): Extracts PNG data from executable memory using Raylib'sLoadImageFromMemory. - Added
LoadSoundFromResource(int id): Extracts OGG audio data from memory using Raylib'sLoadWaveFromMemory.
3. Refactoring Game Entities (src/main.cpp, include/game.h)
- Updated Constructors: Modified
PaddleandBallsignatures to accept integertextureIdresource definitions instead ofstd::string texturePathstrings. - Refactored Initializations: Updated
ctxloading routines inmain.cppto use the new memory-based functions instead of standard disk-boundLoadTextureandLoadSoundcalls.
4. Game Rules & Gameplay Tweaks (src/game.cpp)
- Scoring Boundary Adjustment: Adjusted the right-side scoring threshold check for Player 2. The ball position trigger padding was modified from
screen_width - 20.0ftoscreen_width - 30.0f. - Visual Guarding: Added explicit background rendering routines for the boundary walls to prevent transparent edge-bleeding issues.
5. Build Pipeline Updates (pong-reloaded.vcxproj & Filters)
- Integrated
src/resource_loader.cppandinclude/resource.hinto the Visual Studio solution compilation groups. - Added
<ResourceCompile Include="resources.rc"/>step to automatically build and link binary resources on project compilation.