How to build for all these different platforms
I wanted to make a video game using C and find out how I could port it to these different platforms. I started with RayLib, as I could use C and make it for Windows, Linux, Mac and Android. But then I started to think, this is such a simple game, can I build it for DOS? How do I go about creating such a thing? After reading lots of articles online, I stumbled upon Allegro. Not the latest version, but one that's several years old. I could now build for DOS! There were restrictions, but I got it done!
After speaking with the RayLib developer, they stated RayLib cannot currently build for iOS devices. So, I started seeking out a new library to build from. OpenGL/Vulken seemed like a great alternative, but both have a very steep learning curve. That’s when I found SDL. This library is perfect for 2D games, has the ability to build with a very large amount of platforms and is very easy to understand. The only issue being, SDL1 was compatible with Dreamcast, 3DS, Wii, DS while SDL2 is compatible with PS2, PS3, PS4, Xbox, Switch, iOS, Android, etc.
For my goal being to target as many platforms as possible, I would have to mix these calls together and use what works for both versions of SDL. When approaching this method, I started building a simple show PNG image, then adding methods that check if using SDL1 or SDL2 then calling the required methods for audio and video initialization and screen refreshing (Flip vs UpdateWindowSurface). From there I added different Makefile’s and IDE solutions. However, once I started to actually build out my game, I realized I had to now modify all the Makefiles and IDE solutions a second time to include any additional library files needed. Such as Mixer, TTF, etc. or joystick, keyboard, calls that now need to be separated into their own SDL 1 or 2 checks.
If anyone is looking to accomplish this goal, I would recommend first making your game using an IDE such as Xcode or Visual Studio, then adding checks for SDL 1 or 2 based on systems you’re compiling for, then making the other system’s Makefiles, in that order.
Leave a comment
Log in with itch.io to leave a comment.