143 Commits

Author SHA1 Message Date
Kieran Kihn
1b52c87b0e feat(ui): add scroll support for hand cards 2025-12-18 23:34:24 +08:00
Kieran Kihn
150e29c25c feat(ui): add dynamic scaling support
- Introduced `scale` property across components for responsive design.
- Adjusted dimensions and positions dynamically based on scale.
- Enhanced flexibility for varying display resolutions.
2025-12-18 11:42:29 +08:00
Kieran Kihn
6276dbdea3 fix(ui): reset selected-card-index on card draw button click 2025-12-17 23:37:36 +08:00
Kieran Kihn
68ccfe2147 fix(game): ensure drawCount_ is reset in GameState::endGame 2025-12-17 23:37:25 +08:00
Kieran Kihn
5f11c609c1 feat(logging): enable fine-grained spdlog levels based on build type 2025-12-11 23:07:46 +08:00
Kieran Kihn
2fa428a493 fix(game): add initialization for drawCount_ in GameState classes 2025-12-11 23:07:22 +08:00
Kieran Kihn
49b30a7d5a chore: copy assets to output directory post-build
- Added logic to copy the `assets` directory to the output folder for `uno-client` and `uno-server`.
2025-12-11 22:47:54 +08:00
Kieran Kihn
c2a57dba81 feat(logging): integrate spdlog for enhanced logging and debugging
- Added spdlog dependency to `CMakeLists.txt`.
- Implemented a centralized `Logger` with file rotation and console output support.
- Added detailed logging across server, client, and game modules for improved traceability.
2025-12-11 22:47:33 +08:00
Kieran Kihn
11fc7cd74d chore: restructure build targets and add runtime DLL copy logic
- Split `uno-client` and `uno-server` as separate executables.
- Adjusted `uno-game-lib` linking and updated runtime output directory.
- Enabled post-build DLL copying for Windows compatibility.
2025-12-11 12:32:19 +08:00
Kieran Kihn
b0212161ac fix(ui): simplify GamePage animation logic
- Replaced `cycle` property with constant `base-angle`.
- Removed `Timer` and associated counter logic.
- Enabled infinite animation with `iteration-count: -1`.
2025-12-11 11:18:10 +08:00
Kieran Kihn
d494f1af75 style: style library linking in CMakeLists.txt 2025-12-11 10:48:11 +08:00
Kieran Kihn
206286d191 feat(assets): add Windows resource file and icon to executables 2025-12-11 10:47:16 +08:00
Kieran Kihn
f1f61516f7 chore: correct debug configuration check on Windows 2025-12-10 22:37:46 +08:00
Kieran Kihn
a3b6117580 feat(game): update card comparison to exclude wild cards
- Adjusted `<` operator to properly handle `WILD` and `WILDDRAWFOUR` types during comparison.
2025-12-10 22:31:43 +08:00
Kieran Kihn
d8d39f713d fix(ui): correct player rotation logic in GameUI 2025-12-10 22:31:28 +08:00
Kieran Kihn
84d81cf2f0 fix(ui): handle unreachable default case in GameUI switch statement 2025-12-10 22:31:19 +08:00
Kieran Kihn
3fa3dbcb2a fix(ui): bind turn state to TouchArea and player component
- Enabled `TouchArea` based on the current player's turn.
- Updated player component to reflect dynamic turn state.
2025-12-10 22:30:44 +08:00
Kieran Kihn
955aa0956d feat(ui): add AFTER_GAME state and restart flow in GameUI
- Introduced `AFTER_GAME` state to handle post-game logic.
- Updated `GameUI` to show restart prompt when the game ends.
- Modified `StartPage` and `MainWindow` to support restart behavior.
- Adjusted `endGame` method to transition to `AFTER_GAME`.
2025-12-10 22:30:25 +08:00
Kieran Kihn
bdc1252259 feat(assets): add card SVG assets for gameplay
- Included SVG representations for yellow, green, blue, and red cards (numbers 0-3).
- Organized assets for enhanced visual representation in UI.
2025-12-10 21:48:11 +08:00
Kieran Kihn
df6bbee5d7 feat(ui): add GamePage with player actions and game state display
- Integrated `GamePage` into `MainWindow` for active game state.
- Added player actions: play card, draw card, and call UNO.
- Implemented discard pile, game direction, and current color indicators.
- Designed player hand and opponent details with interactive components.
2025-12-10 21:47:01 +08:00
Kieran Kihn
79c4170aa8 refactor(ui): reorder properties in StartPage and ConnectPage for consistency 2025-12-10 21:46:44 +08:00
Kieran Kihn
a161b55f35 test: update assertions to use player ID and standardize card serialization format 2025-12-10 21:45:44 +08:00
Kieran Kihn
fb9f308635 feat(ui): enhance GameUI with active game state updates and player actions
- Added callbacks for playing and drawing cards.
- Integrated hand card and player list updates during active game stages.
- Implemented discard pile, current color, and game direction display.
2025-12-10 21:44:34 +08:00
Kieran Kihn
4420552a84 feat(game): add getSelfId method to ClientGameState 2025-12-10 21:44:05 +08:00
Kieran Kihn
d1f87d8113 refactor(game): replace player iterator with player ID in GameState functions 2025-12-10 21:43:53 +08:00
Kieran Kihn
8d9f76eab3 refactor(game): standardize card color and type serialization format 2025-12-10 21:41:30 +08:00
Kieran Kihn
59f8ac8186 fix(client): add destructor to UnoClient for resource cleanup 2025-12-10 21:40:58 +08:00
Kieran Kihn
5ff38c2bde feat(client): validate and handle wild card type in handlePlayerPlayCard
- Added validation for wild card types and ensured proper color assignment.
- Updated `PlayerPlayCardPayload` to use ID and color instead of card object.
2025-12-10 21:40:37 +08:00
Kieran Kihn
592ae1ad23 refactor(ui): update Slint UI paths and update CMakeList.txt accordingly 2025-12-09 20:17:12 +08:00
Kieran Kihn
bea9caa078 feat(ui): add ConnectPage, StartPage, and MainWindow components
- Implemented `ConnectPage` to handle server connection input and initiation.
- Added `StartPage` to manage player readiness before starting the game.
- Created `MainWindow` to manage page transitions and callbacks.
2025-12-09 20:07:12 +08:00
Kieran Kihn
63e87aa3e9 feat(ui): add reusable Button and LabeledInput components using Slint 2025-12-09 20:06:58 +08:00
Kieran Kihn
7bb302a672 chore: include PlayerAction and GameUI in build targets 2025-12-09 20:06:22 +08:00
Kieran Kihn
4eecc0a269 feat(ui): add GameUI class for handling game UI and player actions
- Implemented `GameUI` for managing game state transitions and player interactions.
- Integrated Slint `MainWindow` for UI rendering and event handling.
2025-12-09 20:06:13 +08:00
Kieran Kihn
095a34af1c chore: integrate Slint UI framework and update build configuration
- Added Slint as a required dependency in the CMake configuration.
- Integrated Slint sources into `uno-game-lib`.
- Modified Windows debug build to create a GUI executable.
2025-12-09 20:05:35 +08:00
Kieran Kihn
c6342469df test(game): remove player name from ClientGameState constructor in test
- Simplified `ClientGameState` initialization in `GameStateTest`.
2025-12-09 20:03:37 +08:00
Kieran Kihn
25a0a66c93 feat(client): introduce UnoClient with network and UI integration
- Added `UnoClient` class to handle network, UI, and player actions.
- Implemented methods for processing network and player events.
- Created entry point in `main.cpp` for client execution.
2025-12-09 20:03:21 +08:00
Kieran Kihn
5eee316acf feat(game): add player name management methods
- Added `setPlayerName` and `getPlayerName` to `ClientGameState`.
- Introduced `setName` method for `Player`.
- Updated constructors for `Player` and `ClientGameState` to support name management.
2025-12-09 19:43:51 +08:00
Kieran Kihn
3b31dd2dcc feat(game): add setClientGameStageConnected method to manage client state transitions 2025-12-09 19:43:41 +08:00
Kieran Kihn
41936b3525 test(network): expand NetworkClientTest with connection and send tests
- Added `onConnect` callback to test constructor.
- Introduced thread-based tests for connection and message sending.
2025-12-09 19:42:45 +08:00
Kieran Kihn
98a7ef7d41 feat(network): add async connect with onConnect callback
- Replaced synchronous `connect` with asynchronous connection logic.
- Introduced `onConnect` callback to handle connection success events.
- Ensured proper `io_context` work guard management.
2025-12-09 19:42:26 +08:00
Kieran Kihn
d5f996df6c feat(client): add PlayerAction struct and payload types
- Introduced `PlayerAction` to encapsulate player actions, including type and payload.
- Added specific payload structures for connect, start game, play card, and draw card actions.
2025-12-09 17:10:44 +08:00
Kieran Kihn
6ab5550fd3 fix(server): update playerId type in UnoServer lambda 2025-12-09 17:10:17 +08:00
Kieran Kihn
f968b4d3f2 test(network): add empty player list to InitGamePayload serialization tests
- Updated `InitGamePayload` to include an empty `players` array.
- Adjusted related serialization and deserialization test cases in `MessageSerializerTest`.
2025-12-07 19:33:43 +08:00
Kieran Kihn
9ae3b9cc89 test(game): simplify card play and player initialization in tests
- Updated `HandCard::play` usage to accept a dereferenced card.
- Replaced sequential `addPlayer` calls with `init` method in `GameStateTest`.
2025-12-07 19:33:29 +08:00
Kieran Kihn
d266f1c514 refactor(server): move addPlayer implementation to ServerGameState
- Relocated `addPlayer` method from template-based `GameState` to `ServerGameState`.
- Updated method signature and comments for better clarity.
2025-12-07 19:32:40 +08:00
Kieran Kihn
a1c46b8c9b refactor(server): enhance turn validation and game state handling
- Added `ServerGameStage` check in turn validation logic.
- Switched to `ClientPlayerState` in `handleStartGame` for player initialization.
- Integrated `endGame` in `handleEndGame` and removed redundant `reset` call.
2025-12-07 19:03:45 +08:00
Kieran Kihn
0802d989f8 refractor(game): enhance state management with clear and endGame methods
- Added `clear` methods to `PlayerState`, `ServerPlayerState`, and `HandCard`.
- Introduced `endGame` methods to `GameState`, `ClientGameState`, and `ServerGameState`.
- Improved `init` and `nextPlayer` logic in `ClientGameState`.
- Added `getClientGameStage` and `getServerGameStage` methods to retrieve game stages.
2025-12-07 19:03:13 +08:00
Kieran Kihn
ebb49a02ef refactor(network): replace PlayerPublicState with ClientPlayerState
- Updated `InitGamePayload` to use `ClientPlayerState` instead of `PlayerPublicState`.
- Adjusted serialization and deserialization methods in `MessageSerializer` accordingly.
2025-12-07 13:59:40 +08:00
Kieran Kihn
5196de460a refactor(game): simplify card play logic
- Replaced iterator-based `play` methods with a single card-based method.
- Streamlined logic in `ServerPlayerState`, `ClientGameState`, and `HandCard`.
2025-12-07 13:57:54 +08:00
Kieran Kihn
ea87fca1fd fix(network): ensure write continuation upon successful async_write
- Added a check in `Session::doWrite` to invoke subsequent writes when the message queue is not empty.
2025-12-04 17:17:32 +08:00