Platforms API examples

Hi!

You can see examples of the first Platform API shown by Casey in SDL and cocos2dx code.

SDL has a function called SDL_CreateWindow that internally calls the platform dependant functions to create the window: https://hg.libsdl.org/SDL/file/6c469ea796e4/src/video
You can see that for every different platform there's dedicated folder that do the actual code (SDL_video.c has that function)

In cocos2dx, there's the FileUtils class that the actual implementation is picked at compile time. https://github.com/cocos2d/cocos2d-x/tree/v3/cocos/platform

Actually cocos2dx uses both techniques, they have a platform layer that calls the init part of your game but then you have to call other parts of the platform api yourself.

Cheers!
Another one worth mentioning is Burgerlib. I wouldn't normally mention stuff randomly found on Github, however:

  1. This has been used in over 30 shipped games and applications.
  2. It supports lots of platforms, including most mobile platforms, most previous-gen consoles (even the OUYA) and at least one current-gen (PS4).