2D game engine utilizing modern C++ to provide an intuitive API and a decoupled plugin system.
Note: this software is ALPHA, it is not stable, it's API can and will change.
Win64 | Win32 | |
---|---|---|
Build & Test |
The following are the primary goals for this project:
- Cross-Platform
- Realtime Resource Modification
- Modern C++
- Intuitive and Concise API
- Minimal Dependencies
The engine consists of one or more Worlds that contain zero or more Objects. The World is responsible for stepping the Objects forward in time based on some Input, storing newly created Objects, and removing any Objects that were destroyed. This simulation loop is executed indefinitely until the world is manually ended.
A simple but complete Hello World in Pineapple could be:
#include <Pineapple/Pineapple.h>
struct HelloWorld : public pa::Object
{
HelloWorld(pa::World& world)
: pa::Object(world)
{
pa::Log::info("Hello World");
getWorld().end();
}
};
int main()
{
// Create the world
pa::World world;
// Create the first object
world.create<HelloWorld>();
// Process main loop without any Input
while (world.step(pa::Time(1.f / 60.f)));
return 0;
}
There are three types of plugins: Platform, Graphics and Sound. The interface for each plugin type is predefined and set in stone and therefore makes plugins of the same type completely interchangeable.
Currently the following plugins are provided:
- Platform
- Windows - Win32 application 32/64bit (tested on Windows 10)
- X11 - Unix with X Window System (tested on Ubuntu)
- Android - Native application with some java code (tested with NDK r18b)
- Graphics
- OpenGL - OpenGL rendering (uses glad, stb_image/stb_truetype, fontstash and glm)
- OpenGL 4.1 (Compatibility mode) on Windows and Unix
- OpenGLES 1.0 on Android
- OpenGL - OpenGL rendering (uses glad, stb_image/stb_truetype, fontstash and glm)
- Sound
- FMOD - FMOD wrapper (requires FMOD installation)
- SoundPool - Android SoundPool wrapper
To build the source, demos and tests you will need the following:
It is recommended to do an out of source build, to avoid polluting the source tree. Run the following:
mkdir builddir
cd builddir
cmake ..
You can give a specific generator to cmake using the -G flag. The following generators are supported:
- Win32 - "Visual Studio 15 2017"
- Win64 - "Visual Studio 15 2017 Win64"
- Unix - Use the default (not actively tested)
For Android use Android Studio to load the root Pineapple CMakeLists.txt file.
Note: To run the tests within Visual Studio you will need to install the Google Test Adapter, which can be installed via Tools -> Extensions and Updates. For Visual Studio 2017 there is an official Test Adapter for Google Test that is maintained by the Visual C++ Team.
Please create an issue if you experience any problems (likely!)
TODO
Please download the source and build the demos. If there are any problems, or if you have suggestions then create an issue and I will follow up as soon as I can. Pull requests are also welcome for fixes (please create an issue first).