This is a modern take on the classic Breakout game, developed for the Playdate handheld gaming system. The game features enhanced gameplay mechanics, visual effects, and power-ups, all implemented in C using the Playdate SDK.
Playdate-Breakout/
│
├── CMakeLists.txt
├── README.md
├── .gitignore
├── docs/
└── Source/
├── include/
│ ├── game.h
│ ├── paddle.h
│ ├── ball.h
│ ├── brick.h
│ └── utils.h
├── src/
│ ├── main.c
│ ├── game.c
│ ├── paddle.c
│ ├── ball.c
│ ├── brick.c
│ └── utils.c
├── lib/
└── assets/
├── images/
├── sounds/
├── music/
└── levels/
To build this project, you'll need the Playdate SDK and CMake installed on your system. Playdate Building on Windows
-
Set up the Playdate SDK:
- Download and install the Playdate SDK.
- Set the
PLAYDATE_SDK_PATH
andSDK
environment variables to point to your SDK installation.
-
Set up GNU ARM Embedded Toolchain
- Download and install the GNU Arm Embedded Toolchain.
- Set the
PLAYDATE_ARM_GCC
environment variable to point to C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2021.10
-
Clone this repository:
git clone https://github.com/ramo1606/Playdate-Breakout.git cd breakout_playdate
-
Create a build directory and run CMake:
mkdir build cd build cmake ..
-
Build the project:
- For Visual Studio: Open the generated
.sln
file and build the project. - For Make: Run
make
in the build directory.
- For Visual Studio: Open the generated
-
To build for the Playdate device:
- Open a Visual Studio Developer Command Prompt from the Start Menu or from within Visual Studio
cmake .. -G "NMake Makefiles" --toolchain=C:/Users/Ramo/Documents/PlaydateSDK/C_API/buildsupport/arm.cmake -DCMAKE_BUILD_TYPE=Release nmake
-
The output will be a
.pdx
file, which can be run on the Playdate simulator or transferred to a Playdate device.
This project follows a specific coding style to maintain consistency and readability:
-
C Standard: We use C89 (ANSI C) to ensure maximum compatibility with the Playdate SDK.
-
Naming Conventions:
- Use descriptive names for functions, variables, and types.
- Functions use camelCase:
updateGameState()
,drawPaddle()
. - Variables use camelCase:
playerScore
,ballSpeed
. - Constants and macros use UPPER_SNAKE_CASE:
MAX_PLAYERS
,INITIAL_BALL_SPEED
. - Typedef structs use PascalCase:
typedef struct { ... } GameState;
-
Braces: We use Allman style braces:
if (condition) { // code } else { // code }
-
Indentation: Use 4 spaces for indentation, not tabs.
-
Comments:
- Use C-style comments for multi-line explanations:
/* ... */
- Use C++-style comments for single-line comments:
// ...
- Each function should have a brief comment explaining its purpose.
- Use C-style comments for multi-line explanations:
-
File Structure:
- Each
.c
file should have a corresponding.h
file. - Use include guards in header files:
#ifndef GAME_H #define GAME_H // content #endif /* GAME_H */
- Each
-
Modularity: Keep functions small and focused on a single task. If a function grows too large, consider breaking it into smaller functions.
-
Error Handling: Use appropriate error handling mechanisms. Return error codes or use the Playdate SDK's error handling functions where appropriate.
-
Documentation: Use C-style documentation comments for functions in header files:
/** * @brief Updates the game state for one frame * @param game_state Pointer to the current game state * @param delta_time Time elapsed since last frame in seconds * @return 0 on success, non-zero error code on failure */ int update_game_state(GameState* game_state, float delta_time);
Please adhere to these guidelines when contributing to the project. Consistent style helps maintain code readability and makes collaboration easier.
[Include your chosen license here]
[If you want to accept contributions, include guidelines here]