[CPP] API and Extensions

Playdate CPP Extensions library

As promised a few months ago while resurrecting the old PlaydateCPP project, I'm happy to introduce the Playdate CPP Extensions library.

View the PlaydateCPP Extensions library on GitHub here

The goal of this project is to take the initial PlaydateCPP project a step further by:

  • replicating the C API in C++ so that you can work with honest-to-goodness RIIA-compliant, C++ objects and patterns.
  • providing a codebase of classes to streamline the development of games and Lua extensions.

This is all standing on the shoulders of the boilerplate PlaydateCPP project that enables this goofy dream to begin with so please start over there:

There's a README.md that goes over the basics of building it into your project, TL;DR it's all CMake, so if you're building with PlaydateCPP already, building the extensions lib is just one more submodule and one more line of code in your CMakeLIsts.txt file.

CPPong

There's a version of Pong in the repo to help demonstrate how one can reasonably create a full game using the extensions.

Obviously a game as simple as Pong cannot cover everything you can imagine, but it does touch on more than one might immediately expect, highlighting the basics of how to handle user control, graphics, and sound. Expect the range of examples to expand in the future to cover more of the codebase.

Contribute!

I'm heavily invested in this library so it's going to get updates and bug fixes regularly, take a dependency with confidence. That said, if left to my own devices, the updates are going to generally follow my own needs, so this project will need contributors.

If there's something that you've developed that you think others would find useful, or if there's a bug that needs to be fixed, please DM me and/or file a PR. Read more here.

What happens if/when Panic releases a C++ API?

There have been rumblings for some time that Panic has interest in doing this.

The guidance will always be to use their version of any object which overlaps with functionality from this library, and whatever is in this library will be deprecated. Anything that doesn't overlap will live on, and will be refactored to use Panic's APIs under the hood if necessary.
1 Like

i already used playdate-cpp as a module in a fork of the arduboy collection to make it compile again see GitHub - joyrider3774/playdate-arduboy at SDK_2.XX_SUPPORT . Also before this was working again and when i ported my older games to playdate i converted c++ (classes mostly) to C using struct constructs and function pointers, but now that playdate cpp is there and working for rev b units for my next port i'm not going todo this anymore and i'm actually using c++ code i initally had along with playdate-cpp. It saves me a lot of time and tedious editing code from converting c++ code to c and makes the projects remain more readable / editable as well

So for me as a user of library / repo it works great, but i can not contribute any code related to the project iself as well i just have no clue about this all to get this working and c++ specifics but i am a happy enduser of your project

1 Like