Compare commits

...

129 Commits

Author SHA1 Message Date
60d6a9e740 Merge branch 'release/v0.1.0'
Some checks failed
Build and Package Spacetris / build-windows (push) Has been cancelled
Build and Package Spacetris / build-linux (push) Has been cancelled
2025-12-25 10:03:42 +01:00
e1921858ed Merge branch 'feature/NetworkMultiplayerCooperate' into develop 2025-12-25 09:38:19 +01:00
14cb96345c Added intro video 2025-12-25 09:38:06 +01:00
d28feb3276 minor fixes 2025-12-23 20:24:50 +01:00
a7a3ae9055 added basic network play 2025-12-23 19:03:33 +01:00
5ec4bf926b added rules 2025-12-23 17:16:12 +01:00
0e04617968 Merge branch 'feature/CooperateAiPlayer' into develop 2025-12-23 16:50:51 +01:00
b450e2af21 fixed menu 2025-12-23 14:49:55 +01:00
a65756f298 fixed menu 2025-12-23 14:12:37 +01:00
dac312ef2b updated main menu for cooperate mode 2025-12-23 12:21:33 +01:00
953d6af701 fixed cooperate play 2025-12-22 21:26:56 +01:00
c14e305a4a Merge branch 'feature/CooperativeMode' into develop 2025-12-22 18:50:05 +01:00
fb036dede5 removed 2025-12-22 18:49:54 +01:00
3c9dc0ff65 update visually 2025-12-22 18:49:06 +01:00
d3ca238a51 updated sync line 2025-12-22 17:18:29 +01:00
a729dc089e sync line added in cooperate mode 2025-12-22 17:13:35 +01:00
18463774e9 fixed for cooperate mode 2025-12-22 13:48:54 +01:00
694243ac89 fixed highscore in main menu 2025-12-22 13:09:36 +01:00
60ddc9ddd3 fixed name entry 2025-12-21 21:37:04 +01:00
70946fc720 fixed highscores 2025-12-21 21:33:31 +01:00
fb82ac06d0 fixed highscores 2025-12-21 21:17:58 +01:00
494f906435 supabase integration instead firebase 2025-12-21 20:50:44 +01:00
50c869536d highscore fixes 2025-12-21 19:45:20 +01:00
0b99911f5d fixed i block 2025-12-21 18:43:40 +01:00
33d5eedec8 fixed I block in coop mode 2025-12-21 18:11:21 +01:00
744268fedd added pause option coop gameplay 2025-12-21 17:59:21 +01:00
06aa63f548 fixed score display 2025-12-21 17:52:07 +01:00
a9943ce8bf when clearing lines play voices 2025-12-21 17:26:53 +01:00
b46af7ab1d removed s shortcut for sound fx toggle 2025-12-21 17:22:30 +01:00
ab22d4c34f hard drop shake effect added 2025-12-21 17:04:46 +01:00
e2d6ea64a4 added hard drop 2025-12-21 16:37:20 +01:00
322744c296 fixed first row 2025-12-21 16:31:23 +01:00
cf3e897752 added clear line effect 2025-12-21 16:25:09 +01:00
4efb60bb5b added ghost block 2025-12-21 15:59:46 +01:00
afd7fdf18d basic gameplay for cooperative 2025-12-21 15:33:37 +01:00
5b9eb5f0e3 updates 2025-12-21 10:42:28 +01:00
09c8d3c0ef added readme 2025-12-21 10:34:36 +01:00
a6c2c78cb5 refactoring app name to spacetris and new icon 2025-12-21 10:29:01 +01:00
18c29fed1e Merge branch 'feature/ChallengeMode' into develop 2025-12-21 09:01:35 +01:00
f3064e9dad minor fixes 2025-12-21 09:01:09 +01:00
a1f16a7d94 updated gameplay 2025-12-21 08:41:35 +01:00
eb9822dac7 added challenge level text 2025-12-20 20:47:04 +01:00
6c48af0bec minor fixes 2025-12-20 20:17:43 +01:00
b69b090e45 asteroid explode 2025-12-20 19:49:05 +01:00
ad014e1de0 fixed gameplay 2025-12-20 15:17:35 +01:00
9a3c1a0688 updated asteroids 2025-12-20 14:19:50 +01:00
970259e3d6 used tileset sprite sheet for asteroids 2025-12-20 13:50:56 +01:00
34447f0245 Added challenge mode 2025-12-20 13:08:16 +01:00
fd29ae271e Merge branch 'feature/ReafctoringGame' into develop 2025-12-20 12:13:58 +01:00
737dc71d8c seperate assets as constants 2025-12-20 12:05:40 +01:00
8a4dc2771d Refactoring game render 2025-12-20 11:31:02 +01:00
212dd4c404 refactor hold element drawing 2025-12-20 11:22:18 +01:00
a520de6c1f Added hold block and minor fixes 2025-12-20 11:10:23 +01:00
38dbc17ace refactor main game loop 2025-12-19 20:07:48 +01:00
783c12790d refactor main.cpp 2025-12-19 19:25:56 +01:00
64fce596ce fillRect moved 2025-12-19 18:22:26 +01:00
adf418dff9 refactored some functions from main.cpp 2025-12-19 18:16:17 +01:00
fe0cd289e2 fix 2025-12-19 16:48:26 +01:00
989b98002c new background image 2025-12-18 07:20:20 +01:00
0ab7121c5b Hold block added 2025-12-17 21:05:32 +01:00
492abc09bc fixed menu in help options 2025-12-17 20:35:39 +01:00
fe6c5e3c8a Updated bottom menu 2025-12-17 20:12:06 +01:00
122de2b36f Bottom menu reorganized 2025-12-17 19:23:16 +01:00
a671825502 fixed menu 2025-12-17 18:55:55 +01:00
cecf5cf68e fixed main screen 2025-12-17 18:13:59 +01:00
3264672be0 Fixed gameplay 2025-12-16 18:51:23 +01:00
29c1d6b745 fixed loader and music playback 2025-12-16 14:18:15 +01:00
81586aa768 fixed progress bar 2025-12-16 12:09:33 +01:00
ec086b2cd4 Merge branch 'feature/macVersion' into develop 2025-12-15 19:51:13 +01:00
8be2d68b98 update for VisualStudio 18 (2026) 2025-12-15 19:50:01 +01:00
b0cec977a5 create dmg file script 2025-12-10 20:40:14 +01:00
41d39b9bf7 script to create dmg 2025-12-10 20:40:01 +01:00
9e0e1b2873 fixed bundlle 2025-12-10 20:37:31 +01:00
afcc1dd77d script 2025-12-10 20:10:35 +01:00
d53a1cde34 fix 2025-12-10 20:05:54 +01:00
8569b467e0 icon fix 2025-12-10 20:00:16 +01:00
5a755e9995 mac icon added 2025-12-10 19:53:11 +01:00
1e97b3cfa3 N keyboard to skip to next song 2025-12-10 19:48:07 +01:00
b9791589f2 resources fix 2025-12-10 19:42:38 +01:00
108caf7ffd fox fonts on macc 2025-12-10 19:40:43 +01:00
3c6466e2a0 fix mac resources 2025-12-10 19:38:06 +01:00
d2fa5b2782 Added N to play next song 2025-12-10 18:40:46 +01:00
d1d0d891fa fix. sound fx 2025-12-10 18:35:05 +01:00
ea74af146d mac fix 2025-12-10 18:24:48 +01:00
e8a7b19213 space warp fixes 2025-12-10 17:57:32 +01:00
57eac01bcb feat(renderer): polish gameplay visuals — transport, starfield, sparkles, smooth piece motion
Add transport/transfer effect for NEXT → grid with cross-fade and preview swap
Integrate in-grid Starfield3D with magnet targeting tied to active piece
Spawn ambient sparkles and impact sparks (hard-drop crackle + burst on expiry)
Smooth horizontal/fall interpolation for active piece (configurable smooth scroll)
Refactor next panel / preview rendering and connector drawing
Tweak stats/score panel layout, progress bars and typography for compact view
Preserve safe alpha handling and restore renderer blend/scale state after overlays
2025-12-08 20:43:51 +01:00
815913b15b Merge branch 'feature/RedesignMainScene' into develop 2025-12-07 19:10:51 +01:00
972588fa59 removed line 2025-12-07 19:05:32 +01:00
9d989ab395 new next block 2025-12-07 19:02:03 +01:00
a74d7135e6 fixed combo count 2025-12-07 18:46:23 +01:00
e27d1b60b1 fixed statistics panel 2025-12-07 18:25:13 +01:00
12bc4870b1 fix statistics 2025-12-07 17:51:54 +01:00
2b4b07ae6a fixed statistics 2025-12-07 17:30:18 +01:00
24779755a5 aligment fix in next block 2025-12-07 13:00:05 +01:00
d2ba311c5f fixed next block 2025-12-07 12:27:00 +01:00
f5424e8f72 Addes some sparkles 2025-12-07 11:24:32 +01:00
5a95c9180c I block rotation fix 2025-12-07 10:45:12 +01:00
59dc3a1638 fixed statistics panel 2025-12-07 10:29:20 +01:00
262ae49496 fixed exit popup window 2025-12-06 21:20:25 +01:00
ec9eb45cc3 gameplay score board 2025-12-06 21:07:17 +01:00
1355ce49fe visual makeover of backgrounds for each level 2025-12-06 20:07:04 +01:00
8a549d14dc Fixed menu 2025-12-06 18:18:27 +01:00
12110bd8b4 fixed 2025-12-06 17:51:54 +01:00
f086ed3021 fixed main menu background 2025-12-06 15:44:05 +01:00
f24d484496 fixed highscore 2025-12-06 15:10:41 +01:00
26b4454eea fixed highscore 2025-12-06 14:54:56 +01:00
b531bbc798 fix 2025-12-06 14:08:24 +01:00
cb8293175b new main screen 2025-12-06 12:42:29 +01:00
fff14fe3e1 New fonts 2025-12-06 11:09:12 +01:00
ffdb67ce9b Fixed button text 2025-12-06 10:48:59 +01:00
b44de25113 latest state 2025-12-06 09:43:33 +01:00
294e935344 stars directions 2025-12-01 21:01:53 +01:00
383b2e48ec new background for main screen 2025-12-01 20:52:26 +01:00
cfbb4e4c86 Merge branch 'feature/GridAnimationFx' into develop 2025-11-30 16:48:57 +01:00
9d89106275 fix particle 2025-11-30 16:48:45 +01:00
ace2e6acdc updated stars in game play grid 2025-11-30 16:30:47 +01:00
e35aeee5ab Merge branch 'feature/mac' into develop 2025-11-30 15:52:51 +01:00
b46246b74f fixed assertion 2025-11-30 15:52:39 +01:00
7f07036f07 fixes for mac music 2025-11-30 15:19:14 +01:00
da32b5be1a fixed paths 2025-11-30 14:50:27 +01:00
d206b7b1af path fix 2025-11-30 14:47:03 +01:00
69b3a60564 fix 2025-11-30 14:39:08 +01:00
dc8a317837 fix 2025-11-30 14:35:45 +01:00
dd0ac54ee5 cmake fix 2025-11-30 14:32:52 +01:00
33994ec9db fix for max 2025-11-30 14:16:33 +01:00
344a27a336 fix 2025-11-30 14:07:00 +01:00
0e4064a187 installer script for mac 2025-11-30 14:04:27 +01:00
59a9915570 Merge branch 'feature/GridGameplayMoreImpressive' into develop 2025-11-30 14:00:45 +01:00
9ea0183339 added stars to gameplay grid 2025-11-30 14:00:32 +01:00
221 changed files with 16354 additions and 3311 deletions

168
.copilot-rules.md Normal file
View File

@ -0,0 +1,168 @@
# Copilot Rules — Spacetris (SDL3 / C++20)
These rules define **non-negotiable constraints** for all AI-assisted changes.
They exist to preserve determinism, performance, and architecture.
If these rules conflict with `.github/copilot-instructions.md`,
**follow `.github/copilot-instructions.md`.**
---
## Project Constraints (Non-Negotiable)
- Language: **C++20**
- Runtime: **SDL3** + **SDL3_ttf**
- Build system: **CMake**
- Dependencies via **vcpkg**
- Assets must use **relative paths only**
- Deterministic gameplay logic is mandatory
Do not rewrite or refactor working systems unless explicitly requested.
---
## Repo Layout & Responsibilities
- Core gameplay loop/state: `src/Game.*`
- Entry point: `src/main.cpp`
- Text/TTF: `src/Font.*`
- Audio: `src/Audio.*`, `src/SoundEffect.*`
- Effects: `src/LineEffect.*`, `src/Starfield*.cpp`
- High scores: `src/Scores.*`
- Packaging: `build-production.ps1`
When adding a module:
- Place it under `src/` (or an established subfolder)
- Register it in `CMakeLists.txt`
- Avoid circular includes
- Keep headers minimal
---
## Build & Verification
Prefer existing scripts:
- Debug: `cmake --build build-msvc --config Debug`
- Release:
- Configure: `cmake -S . -B build-release -DCMAKE_BUILD_TYPE=Release`
- Build: `cmake --build build-release --config Release`
- Packaging (Windows): `./build-production.ps1`
Before finalizing changes:
- Debug build must succeed
- Packaging must succeed if assets or DLLs are touched
Do not introduce new build steps unless required.
---
## Coding & Architecture Rules
- Match local file style (naming, braces, spacing)
- Avoid large refactors
- Prefer small, testable helpers
- Avoid floating-point math in core gameplay state
- Game logic must be deterministic
- Rendering code must not mutate game state
---
## Rendering & Performance Rules
- Do not allocate memory per frame
- Do not load assets during rendering
- No blocking calls in render loop
- Visual effects must be time-based (`deltaTime`)
- Rendering must not contain gameplay logic
---
## Threading Rules
- SDL main thread:
- Rendering
- Input
- Game simulation
- Networking must be **non-blocking** from the SDL main loop
- Either run networking on a separate thread, or poll ENet frequently with a 0 timeout
- Never wait/spin for remote inputs on the render thread
- Cross-thread communication via queues or buffers only
---
## Assets, Fonts, and Paths
- Runtime expects adjacent `assets/` directory
- `FreeSans.ttf` must remain at repo root
- New assets:
- Go under `assets/`
- Must be included in `build-production.ps1`
Never hardcode machine-specific paths.
---
## AI Partner (COOPERATE Mode)
- AI is **supportive**, not competitive
- AI must respect sync timing and shared grid logic
- AI must not “cheat” or see hidden future pieces
- AI behavior must be deterministic per seed/difficulty
---
## Networking (COOPERATE Network Mode)
Follow `docs/ai/cooperate_network.md`.
If `network_cooperate_multiplayer.md` exists, keep it consistent with the canonical doc.
Mandatory model:
- **Input lockstep**
- Transmit inputs only (no board state replication)
Determinism requirements:
- Fixed tick (e.g. 60 Hz)
- Shared RNG seed
- Deterministic gravity, rotation, locking, scoring
Technology:
- Use **ENet**
- Do NOT use SDL_net or TCP-only networking
Architecture:
- Networking must be isolated (e.g. `src/network/NetSession.*`)
- Game logic must not care if partner is local, AI, or network
Robustness:
- Input delay buffer (46 ticks)
- Periodic desync hashing
- Graceful disconnect handling
Do NOT implement:
- Rollback
- Full state sync
- Server-authoritative sim
- Matchmaking SDKs
- Versus mechanics
---
## Agent Behavior Rules (IMPORTANT)
- Always read relevant markdown specs **before coding**
- Treat markdown specs as authoritative
- Do not invent APIs
- Do not assume external libraries exist
- Generate code **file by file**, not everything at once
- Ask before changing architecture or ownership boundaries
---
## When to Ask Before Proceeding
Ask the maintainer if unclear:
- UX or menu flow decisions
- Adding dependencies
- Refactors vs local patches
- Platform-specific behavior

View File

@ -1,4 +1,4 @@
# Copilot Instructions — Tetris (C++ SDL3)
# Copilot Instructions — Spacetris (C++ SDL3)
Purpose: Speed up development on this native SDL3 Tetris. Follow these conventions to keep builds reproducible and packages shippable.
@ -9,11 +9,9 @@ Purpose: Speed up development on this native SDL3 Tetris. Follow these conventio
- Assets: `assets/` (images/music/fonts), plus `FreeSans.ttf` at repo root.
## Build and run
- Configure and build Release:
- CMake picks up vcpkg toolchain if found (`VCPKG_ROOT`, local `vcpkg/`, or user path). Required packages: `sdl3`, `sdl3-ttf` (see `vcpkg.json`).
- Typical sequence (PowerShell): `cmake -S . -B build-release -DCMAKE_BUILD_TYPE=Release` then `cmake --build build-release --config Release`.
- Packaging: `.\build-production.ps1` creates `dist/TetrisGame/` with exe, DLLs, assets, README, and ZIP; it can clean via `-Clean` and package-only via `-PackageOnly`.
- MSVC generator builds are under `build-msvc/` when using Visual Studio.
Packaging: `.\build-production.ps1` creates `dist/SpacetrisGame/` with exe, DLLs, assets, README, and ZIP; it can clean via `-Clean` and package-only via `-PackageOnly`.
## Runtime dependencies
- Links: `SDL3::SDL3`, `SDL3_ttf::SDL3_ttf`; on Windows also `mfplat`, `mfreadwrite`, `mfuuid` for media.

View File

@ -1,4 +1,4 @@
name: Build and Package Tetris
name: Build and Package Spacetris
on:
push:
@ -43,20 +43,20 @@ jobs:
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: tetris-windows-x64
path: dist/TetrisGame/
name: spacetris-windows-x64
path: dist/SpacetrisGame/
- name: Create Release ZIP
if: startsWith(github.ref, 'refs/tags/v')
run: |
cd dist
7z a ../TetrisGame-Windows-x64.zip TetrisGame/
7z a ../SpacetrisGame-Windows-x64.zip SpacetrisGame/
- name: Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
files: TetrisGame-Windows-x64.zip
files: SpacetrisGame-Windows-x64.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -83,32 +83,32 @@ jobs:
- name: Package
run: |
mkdir -p dist/TetrisGame-Linux
cp build/tetris dist/TetrisGame-Linux/
cp -r assets dist/TetrisGame-Linux/
cp FreeSans.ttf dist/TetrisGame-Linux/
echo '#!/bin/bash' > dist/TetrisGame-Linux/launch-tetris.sh
echo 'cd "$(dirname "$0")"' >> dist/TetrisGame-Linux/launch-tetris.sh
echo './tetris' >> dist/TetrisGame-Linux/launch-tetris.sh
chmod +x dist/TetrisGame-Linux/launch-tetris.sh
chmod +x dist/TetrisGame-Linux/tetris
mkdir -p dist/SpacetrisGame-Linux
cp build/spacetris dist/SpacetrisGame-Linux/
cp -r assets dist/SpacetrisGame-Linux/
cp FreeSans.ttf dist/SpacetrisGame-Linux/
echo '#!/bin/bash' > dist/SpacetrisGame-Linux/launch-spacetris.sh
echo 'cd "$(dirname "$0")"' >> dist/SpacetrisGame-Linux/launch-spacetris.sh
echo './spacetris' >> dist/SpacetrisGame-Linux/launch-spacetris.sh
chmod +x dist/SpacetrisGame-Linux/launch-spacetris.sh
chmod +x dist/SpacetrisGame-Linux/spacetris
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: tetris-linux-x64
path: dist/TetrisGame-Linux/
name: spacetris-linux-x64
path: dist/SpacetrisGame-Linux/
- name: Create Release TAR
if: startsWith(github.ref, 'refs/tags/v')
run: |
cd dist
tar -czf ../TetrisGame-Linux-x64.tar.gz TetrisGame-Linux/
tar -czf ../SpacetrisGame-Linux-x64.tar.gz SpacetrisGame-Linux/
- name: Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
files: TetrisGame-Linux-x64.tar.gz
files: SpacetrisGame-Linux-x64.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
# .gitignore for Tetris (native C++ project and web subproject)
# .gitignore for Spacetris (native C++ project and web subproject)
# Visual Studio / VS artifacts
.vs/

View File

@ -15,7 +15,7 @@ if(DEFINED CMAKE_TOOLCHAIN_FILE)
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_TOOLCHAIN_FILE}" CACHE STRING "" FORCE)
endif()
project(tetris_sdl3 LANGUAGES CXX)
project(spacetris_sdl3 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@ -28,10 +28,14 @@ find_package(SDL3_ttf CONFIG REQUIRED)
find_package(SDL3_image CONFIG REQUIRED)
find_package(cpr CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
find_package(unofficial-enet CONFIG REQUIRED)
add_executable(tetris
set(TETRIS_SOURCES
src/main.cpp
src/app/TetrisApp.cpp
src/gameplay/core/Game.cpp
src/gameplay/coop/CoopGame.cpp
src/gameplay/coop/CoopAIController.cpp
src/core/GravityManager.cpp
src/core/state/StateManager.cpp
# New core architecture classes
@ -42,26 +46,73 @@ add_executable(tetris
src/core/Settings.cpp
src/graphics/renderers/RenderManager.cpp
src/persistence/Scores.cpp
src/network/supabase_client.cpp
src/network/NetSession.cpp
src/graphics/effects/Starfield.cpp
src/graphics/effects/Starfield3D.cpp
src/graphics/effects/SpaceWarp.cpp
src/graphics/ui/Font.cpp
src/graphics/ui/HelpOverlay.cpp
src/graphics/renderers/GameRenderer.cpp
src/graphics/renderers/SyncLineRenderer.cpp
src/graphics/renderers/UIRenderer.cpp
src/audio/Audio.cpp
src/gameplay/effects/LineEffect.cpp
src/audio/SoundEffect.cpp
src/video/VideoPlayer.cpp
src/ui/MenuLayout.cpp
src/ui/BottomMenu.cpp
src/app/BackgroundManager.cpp
src/app/Fireworks.cpp
src/app/AssetLoader.cpp
src/app/TextureLoader.cpp
src/states/LoadingManager.cpp
# State implementations (new)
src/states/LoadingState.cpp
src/states/VideoState.cpp
src/states/MenuState.cpp
src/states/OptionsState.cpp
src/states/LevelSelectorState.cpp
src/states/PlayingState.cpp
)
if(APPLE)
set(APP_ICON "${CMAKE_SOURCE_DIR}/assets/favicon/AppIcon.icns")
if(EXISTS "${APP_ICON}")
add_executable(spacetris MACOSX_BUNDLE ${TETRIS_SOURCES} "${APP_ICON}")
set_source_files_properties("${APP_ICON}" PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
set_target_properties(spacetris PROPERTIES
MACOSX_BUNDLE_ICON_FILE "AppIcon"
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/cmake/MacBundleInfo.plist.in"
)
else()
message(WARNING "App icon not found at ${APP_ICON}; bundle will use default icon")
add_executable(spacetris MACOSX_BUNDLE ${TETRIS_SOURCES})
set_target_properties(spacetris PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/cmake/MacBundleInfo.plist.in"
)
endif()
else()
add_executable(spacetris ${TETRIS_SOURCES})
endif()
# Ensure the built executable is named `spacetris`.
set_target_properties(spacetris PROPERTIES OUTPUT_NAME "spacetris")
if (WIN32)
# No compatibility copy; built executable is `spacetris`.
endif()
if (WIN32)
# Embed the application icon into the executable
set_source_files_properties(src/app_icon.rc PROPERTIES LANGUAGE RC)
target_sources(tetris PRIVATE src/app_icon.rc)
target_sources(spacetris PRIVATE src/app_icon.rc)
endif()
if(MSVC)
# Prevent PDB write contention on MSVC by enabling /FS for this target
target_compile_options(spacetris PRIVATE /FS)
endif()
if (WIN32)
@ -76,22 +127,58 @@ if (WIN32)
COMMENT "Copy favicon.ico to build dir for resource compilation"
)
add_custom_target(copy_favicon ALL DEPENDS ${FAVICON_DEST})
add_dependencies(tetris copy_favicon)
add_dependencies(spacetris copy_favicon)
else()
message(WARNING "Favicon not found at ${FAVICON_SRC}; app icon may not compile")
endif()
# Also copy favicon into the runtime output folder (same dir as exe)
add_custom_command(TARGET tetris POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FAVICON_SRC} $<TARGET_FILE_DIR:tetris>/favicon.ico
add_custom_command(TARGET spacetris POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FAVICON_SRC} $<TARGET_FILE_DIR:spacetris>/favicon.ico
COMMENT "Copy favicon.ico next to executable"
)
endif()
target_link_libraries(tetris PRIVATE SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image cpr::cpr nlohmann_json::nlohmann_json)
if(APPLE)
set(_mac_copy_commands)
if(EXISTS "${CMAKE_SOURCE_DIR}/assets")
list(APPEND _mac_copy_commands
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/assets" "$<TARGET_FILE_DIR:spacetris>/assets"
)
endif()
if(EXISTS "${CMAKE_SOURCE_DIR}/fonts")
list(APPEND _mac_copy_commands
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/fonts" "$<TARGET_FILE_DIR:spacetris>/fonts"
)
endif()
if(EXISTS "${CMAKE_SOURCE_DIR}/FreeSans.ttf")
list(APPEND _mac_copy_commands
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/FreeSans.ttf" "$<TARGET_FILE_DIR:spacetris>/FreeSans.ttf"
)
endif()
if(_mac_copy_commands)
add_custom_command(TARGET spacetris POST_BUILD
${_mac_copy_commands}
COMMENT "Copying game assets into macOS bundle"
)
endif()
endif()
target_link_libraries(spacetris PRIVATE SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image cpr::cpr nlohmann_json::nlohmann_json unofficial::enet::enet)
find_package(FFMPEG REQUIRED)
if(FFMPEG_FOUND)
target_include_directories(spacetris PRIVATE ${FFMPEG_INCLUDE_DIRS})
target_link_directories(spacetris PRIVATE ${FFMPEG_LIBRARY_DIRS})
target_link_libraries(spacetris PRIVATE ${FFMPEG_LIBRARIES})
endif()
if (WIN32)
target_link_libraries(tetris PRIVATE mfplat mfreadwrite mfuuid)
target_link_libraries(spacetris PRIVATE mfplat mfreadwrite mfuuid ws2_32 winmm)
endif()
if(APPLE)
# Needed for MP3 decoding via AudioToolbox on macOS
target_link_libraries(spacetris PRIVATE "-framework AudioToolbox" "-framework CoreFoundation")
endif()
# Include production build configuration
@ -102,22 +189,23 @@ enable_testing()
# Unit tests (simple runner)
find_package(Catch2 CONFIG REQUIRED)
add_executable(tetris_tests
add_executable(spacetris_tests
tests/GravityTests.cpp
src/core/GravityManager.cpp
)
target_include_directories(tetris_tests PRIVATE ${CMAKE_SOURCE_DIR}/src)
target_link_libraries(tetris_tests PRIVATE Catch2::Catch2WithMain)
add_test(NAME GravityTests COMMAND tetris_tests)
target_include_directories(spacetris_tests PRIVATE ${CMAKE_SOURCE_DIR}/src)
target_link_libraries(spacetris_tests PRIVATE Catch2::Catch2WithMain)
add_test(NAME GravityTests COMMAND spacetris_tests)
if(EXISTS "${CMAKE_SOURCE_DIR}/vcpkg_installed/x64-windows/include")
target_include_directories(tetris_tests PRIVATE "${CMAKE_SOURCE_DIR}/vcpkg_installed/x64-windows/include")
target_include_directories(spacetris_tests PRIVATE "${CMAKE_SOURCE_DIR}/vcpkg_installed/x64-windows/include")
endif()
# Add new src subfolders to include path so old #includes continue to work
target_include_directories(tetris PRIVATE
target_include_directories(spacetris PRIVATE
${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/src/audio
${CMAKE_SOURCE_DIR}/src/video
${CMAKE_SOURCE_DIR}/src/gameplay
${CMAKE_SOURCE_DIR}/src/graphics
${CMAKE_SOURCE_DIR}/src/persistence

View File

@ -1,4 +1,4 @@
# Tetris SDL3 - Production Deployment Guide
# Spacetris SDL3 - Production Deployment Guide
## 🚀 Build Scripts Available
@ -9,7 +9,7 @@
- Uses existing Debug/Release build from build-msvc
- Creates distribution package with all dependencies
- **Size: ~939 MB** (includes all assets and music)
- **Output:** `dist/TetrisGame/` + ZIP file
- **Output:** `dist/SpacetrisGame/` + ZIP file
### 2. Full Production Build
```powershell
@ -31,8 +31,8 @@ build-production.bat
The distribution package includes:
### Essential Files
-`tetris.exe` - Main game executable
-`Launch-Tetris.bat` - Safe launcher with error handling
-`spacetris.exe` - Main game executable
-`Launch-Spacetris.bat` - Safe launcher with error handling
-`README.txt` - User instructions
### Dependencies
@ -49,9 +49,9 @@ The distribution package includes:
## 🎯 Distribution Options
### Option 1: ZIP Archive (Recommended)
- **File:** `TetrisGame-YYYY.MM.DD.zip`
- **File:** `SpacetrisGame-YYYY.MM.DD.zip`
- **Size:** ~939 MB
- **Usage:** Users extract and run `Launch-Tetris.bat`
- **Usage:** Users extract and run `Launch-Spacetris.bat`
### Option 2: Installer (Future)
- Use CMake CPack to create NSIS installer
@ -60,14 +60,14 @@ The distribution package includes:
```
### Option 3: Portable Folder
- Direct distribution of `dist/TetrisGame/` folder
Direct distribution of `dist/SpacetrisGame/` folder
- Users copy folder and run executable
[ ] Launch-Spacetris.bat works
## 🔧 Build Requirements
**Solution:** Use `Launch-Spacetris.bat` for better error reporting
### Development Environment
- **CMake** 3.20+
- **Visual Studio 2022** (or compatible C++ compiler)
- **Visual Studio 2026 (VS 18)** with Desktop development with C++ workload
- **vcpkg** package manager
- **SDL3** libraries (installed via vcpkg)
@ -87,18 +87,21 @@ vcpkg install sdl3 sdl3-ttf --triplet=x64-windows
- [ ] Font rendering works (both FreeSans and PressStart2P)
- [ ] Game saves high scores
### Package Validation
### Package Validation
- [ ] All DLL files present
- [ ] Assets folder complete
- [ ] Launch-Tetris.bat works
- [ ] Launch-Spacetris.bat works
- [ ] README.txt is informative
- [ ] Package size reasonable (~939 MB)
### Distribution
- [ ] ZIP file created successfully
### "spacetris.exe is not recognized"
- **Solution:** Ensure all DLL files are in same folder as executable
- [ ] Test extraction on clean system
- [ ] Verify game runs on target machines
- [ ] No missing dependencies
### Game won't start
- **Solution:** Use `Launch-Spacetris.bat` for better error reporting
## 📋 User System Requirements
@ -118,7 +121,7 @@ vcpkg install sdl3 sdl3-ttf --triplet=x64-windows
## 🐛 Common Issues & Solutions
### "tetris.exe is not recognized"
### "spacetris.exe is not recognized"
- **Solution:** Ensure all DLL files are in same folder as executable
### "Failed to initialize SDL"

34
README.md Normal file
View File

@ -0,0 +1,34 @@
Spacetris SDL3
=============
A native C++20 SDL3-based Tetris-style game.
Quick Start (Windows)
- Install vcpkg and packages: `vcpkg install sdl3 sdl3-ttf --triplet=x64-windows`
- Configure: `cmake -S . -B build-msvc -DCMAKE_BUILD_TYPE=Debug`
- Build: `cmake --build build-msvc --config Debug`
- Run (helper): `.
build-debug-and-run.ps1` or run `build-msvc\Debug\spacetris.exe`
Production Packaging
- Quick package (uses existing build): `.
package-quick.ps1`
- Full production (clean Release build + package): `.
build-production.ps1 -Clean`
Tests
- Unit tests target: `spacetris_tests` → exe `spacetris_tests.exe`
- Run tests: configure+build then `ctest -C Debug` or run the test exe directly
Where to look
- Main app sources: `src/` (entry `src/main.cpp`, app `src/app`)
- Build control: `CMakeLists.txt` and `cmake/ProductionBuild.cmake`
- Packaging helpers: `build-production.ps1`, `package-quick.ps1`
Notes
- The canonical executable name is `spacetris` (`spacetris.exe` on Windows).
- Assets live in `assets/` and are copied into the distribution package.
If you want, I can:
- Run a Debug build and confirm the test executable name,
- Replace remaining legacy "tetris" tokens across generated files and docs.

View File

@ -1,4 +1,4 @@
# Tetris — Upgrade Roadmap
# Spacetris — Upgrade Roadmap
This document lists recommended code, architecture, tooling, and runtime upgrades for the native SDL3 Tetris project. Items are grouped, prioritized, and mapped to target files and effort estimates so you can plan incremental work.
@ -20,7 +20,7 @@ This document lists recommended code, architecture, tooling, and runtime upgrade
- [x] Replace ad-hoc printf with SDL_Log or injected Logger service
- Note: majority of printf/fprintf debug prints were replaced with `SDL_Log*` calls; a quick grep audit is recommended to find any remaining ad-hoc prints.
- [x] Add unit tests (gravity conversion, level progression, line clear behavior)
- Note: a small test runner (`tests/GravityTests.cpp`) and the `tetris_tests` CMake target were added and run locally; gravity tests pass (see build-msvc test run). Converting to broader Catch2 suites is optional.
- Note: a small test runner (`tests/GravityTests.cpp`) and the `spacetris_tests` CMake target were added and run locally; gravity tests pass (see build-msvc test run). Converting to broader Catch2 suites is optional.
- [ ] Add CI (build + tests) and code style checks
- [ ] Improve input hit-testing for level popup and scalable UI
- [ ] Add defensive guards (clamps, null checks) and const-correctness

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 1.0 MiB

BIN
assets/fonts/Exo2.ttf Normal file

Binary file not shown.

BIN
assets/fonts/Orbitron.ttf Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 513 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 420 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 930 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 MiB

After

Width:  |  Height:  |  Size: 1.9 MiB

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 253 KiB

After

Width:  |  Height:  |  Size: 253 KiB

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 55 KiB

View File

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 KiB

BIN
assets/images/spacetris.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 756 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1007 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 957 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 805 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 947 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 825 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 970 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1007 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 638 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 828 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1010 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

Some files were not shown because too many files have changed in this diff Show More