Developing with the PlayDate C API
My development environment is Arch Linux and I used the PlayDateSDK C_API.
Why C?
I have a lot of old code lying around, mostly in C. The racetrack generator was in C, and I did not want to redo the entire thing in LUA. A lot of old games in github are also waiting to be ported to this nice console. Also the game with realtime AI and physics might require more than what the scripting engine can give.
Setup on Linux
To setup for linux simply follow the instructions from the playdate site. Download the SDK. Run ```setup.sh```
However, to build for the device, you'll need to install ```arm-none-eabi-newlib``` and ```arm-none-eabi-gcc```
The Examples folder is where I started. It is straight forward to build for the simulator. But building for the device - the tutorial is not up to date.
You'll need to add the following lines in the CMakeLists.txt file:
```cmake
if ($ENV{BUILD_DEVICE})
include(${SDK}/C_API/buildsupport/arm.cmake)
endif()
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
```
When you build for the device, Make a separated ```build_arm``` directory and call ```BUILD_DEVICE=1 cmake ../```
The simulator app has a functionality to upload your game.
There are other details that needs to be taken care of like the pdxinfo. The playdate site helps with these.
On MacOS
The SDK readily builds for the device but you'll still need the cmake switch above.
SDL
I used SDL to develop faster on the PC. I needed only a few wrapper functions to jump from SDL to playdate API:
```
context.drawLine = _drawLine;
context.drawRect = _drawRect;
sound.loadSound = _loadSoundFunction;
sound.freeSound = _freeSoundFunction;
sound.playSound = _playSoundFunction;
sound.setSoundVolume = _setSoundVolumeFunction;
file.open = _openFileFunction;
file.close = _closeFileFunction;
file.readLine = _readLineFileFunction;
file.write = _writeFileFunction;
```
The game does not load images so no wrapper for bitmaps yet.
Conclusion
I'm not sure now many developers are using the C api. But it takes more work but it is definitely doable.
Get Hyperion AG
Hyperion AG
Race against AI on endless Anti-Gravity tracks.
Status | In development |
Author | AshlarCode |
Genre | Racing |
Tags | anti-gravity, Endless, Playdate, wipeout |
More posts
- Track Editor48 days ago
- Progress Alpha 002 - 10.10.2461 days ago
- Progress Alpha 001 - 10.08.2465 days ago
Leave a comment
Log in with itch.io to leave a comment.