Skip to content

fix: resolve C++ build errors in games#254

Open
seventhback777 wants to merge 1 commit into
thoth-tech:mainfrom
seventhback777:fix/game-cpp-build-errors
Open

fix: resolve C++ build errors in games#254
seventhback777 wants to merge 1 commit into
thoth-tech:mainfrom
seventhback777:fix/game-cpp-build-errors

Conversation

@seventhback777
Copy link
Copy Markdown

Replace center_point() with point_at() in BelowTheSurface (API removed from SplashKit). Replace to_string() with std::to_string() in HomemadePong, Pingpong, car-race. DLL files excluded.

…ong, car-race

BelowTheSurface/behaviour.h, player.h:
  Replace center_point(sprite) with manual point_at() calculation using
  sprite_x/y + width/height. center_point() was removed from the SplashKit
  API; this restores equivalent behaviour without that function.

HomemadePong/program.cpp, Pingpong/game.cpp, car-race/game.cpp, car-race/program.cpp:
  Replace unqualified to_string() calls with std::to_string(). The
  unqualified form is ambiguous in strict C++ compilation and fails
  on some compilers/platforms.
Copy link
Copy Markdown

@RealH4D35 RealH4D35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review for PR #254 (Build Fixes)

Tested on: Arch Linux (g++ 14, SplashKit latest)

Compilation fixes needed (add these upstream):

  • None. The PR itself provides the necessary fixes to make the listed games compile.

Features work as expected:

  • BelowTheSurface – The manual centre‑point calculation using sprite_x, sprite_width, sprite_y, sprite_height and point_at correctly replaces the removed center_point(). Enemy and player positions are identical; no behavioural change.
  • HomemadePong, Pingpong, car-race – Qualifying to_string calls with std:: resolves ambiguous‑overload errors in strict C++17/C++20 mode. Score display, game logic, and all runtime behaviour remain unchanged.
  • All four games now compile cleanly with -std=c++17 and -std=c++20; no new warnings.

Pre‑existing issues (not caused by this PR):

  • The removed center_point() function is part of a broader SplashKit API update. Other games may still use deprecated functions and will need similar fixes.
  • DLL files were correctly excluded from the commit – this is expected and appropriate.

Relationship to PR #253:

  • PR #253 introduces a multi‑platform CI pipeline that would immediately fail on these games without these fixes. Merging PR #254 first ensures the CI stays green from day one.

Ready to merge – changes are minimal, correct, and have no negative impact on functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants