Skip to content

2D game engine with a modern intuitive API and a decoupled plugin system

License

Notifications You must be signed in to change notification settings

adamyaxley/Pineapple

Repository files navigation

Pineapple License: Zlib

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. Please create an issue if you experience any problems (likely!)

Win64 Win32
Build & Test Build Build

Goals

The following are the primary goals for this project:

  • Simple object system
  • Cross-platform
  • Modern C++
  • Intuitive and concise API
  • Minimal dependencies

Architecture

Engine

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;
}

Plugins

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)
    • iOS - Native application with some Objective C code (tested on iOS 13)
  • Graphics
  • Sound
    • FMOD - FMOD wrapper (requires FMOD Studio API installation, tested on Windows 10, Ubuntu, iOS and Android)
    • SoundPool - Android SoundPool wrapper (deprecated, use FMOD instead)

Build

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)
  • Xcode - Use DCMAKE_SYSTEM_NAME=iOS for iOS applications

For Android use Android Studio to load the root Pineapple CMakeLists.txt file.

See also the cmake documentation for additional information.

Tutorial

TODO

How can you help?

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).

About

2D game engine with a modern intuitive API and a decoupled plugin system

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published