A basic cross-platform (Mac, Windows, Linux, HTML5, Android) 3D game engine making use of:
- SDL2 window library.
- stb_image.h image library.
- OpenGL 3 / OpenGL ES 2.0 / OpenGL ES 3.0 Graphics APIs.
- Assimp asset importing library.
- GLEW extension loading library.
First clone repo with the following command to download all submodules (which are located in the dependencies folder):
git clone --recursive git@github.com:Shervanator/Engine.git
All builds require cmake 3.6.0, so the first step is to download that here
- Run the cmake gui and point it to this projects folder, configure and then generate a project using whatever toolchain you want. Tested with visual studio 2015
- Build the project
Run:
./scripts/cmake-make.sh -j8
Then run with:
./bin/bin/game
This will run the first build for you! After that if you need to rebuild do the following:
cd bin
make -j8
To build the html5 engine:
First install emscripten:
brew install emscripten
Then build the engine:
./scripts/cmake-emscripten.sh -j8
Then run with:
cd bin-emscripten/bin
python -m SimpleHTTPServer
open http://localhost:8000/
If you make a change you can rebuild with the following command:
cd bin-emscripten/
make -j8
To build for android do the following:
First download the android ndk and sdk (https://developer.android.com/tools/sdk/ndk/) and (https://developer.android.com/sdk/index.html)
Then add the SDK and NDK to your path:
e.g. (you can add this to your .bash_profile for convenience)
export ANDROID_SDK=$HOME/Library/Android/sdk/
export ANDROID_NDK=$HOME/workspace/android-ndk-r12b
export PATH="$ANDROID_NDK:$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools:$PATH"
Then to build (connect phone in dev mode to computer if you want it to install and run):
./scripts/cmake-android.sh -j8
To rebuild do the following:
cd bin-android
make -j8
make android-build android-install android-start
If you want to view the backtrace (to see logs and errors do the following):
cd bin-android
make android-backtrace
To use the engine in a game build the engine library and include Engine.h in your game.
View the example in ./src/example/main.cpp
Or a simple case:
Eg:
#include "Engine.h"
class CoolGame : public Game
{
public:
virtual void init(void);
private:
Entity *test_entity;
};
void CoolGame::init(void)
{
test_entity = new Entity();
test_entity->addComponent(new MeshRenderer(new Mesh("../assets/monkey3.obj"), new Texture("../assets/t.jpg")));
addToScene(test_entity);
}
int main(int argc, char **argv){
CoolGame game;
Engine gm(&game);
gm.start();
return 0;
}
- Fork it ( http://github.com/Shervanator/Engine/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request