Skip to content

v0.8

Choose a tag to compare

@Dr20Ervin Dr20Ervin released this 26 May 20:12
· 15 commits to master since this release

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.ico and icon.jpg directly 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 #define aliasing and #undef guards.
  • Added LoadTextureFromResource(int id): Extracts PNG data from executable memory using Raylib's LoadImageFromMemory.
  • Added LoadSoundFromResource(int id): Extracts OGG audio data from memory using Raylib's LoadWaveFromMemory.

3. Refactoring Game Entities (src/main.cpp, include/game.h)

  • Updated Constructors: Modified Paddle and Ball signatures to accept integer textureId resource definitions instead of std::string texturePath strings.
  • Refactored Initializations: Updated ctx loading routines in main.cpp to use the new memory-based functions instead of standard disk-bound LoadTexture and LoadSound calls.

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.0f to screen_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.cpp and include/resource.h into the Visual Studio solution compilation groups.
  • Added <ResourceCompile Include="resources.rc"/> step to automatically build and link binary resources on project compilation.