nflsilva / C3DGE

Very basic 3D Game Engine in CPP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


C3DGE

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Acknowledgments

About The Project

C3DGE is an experimental implementation of a 3D Game Engine in C++.

I stopped developing this C++ engine and migrated the code into a Kotlin based solution.

Built With

This section should list any major libraries used in this project.

Getting Started

Prerequisites

Install GLFW, GLM and GLEW on the target system.

  • Arch Linux
    # pacman -S glfw glm glew

Compiling

Compiling C3DGE requires gcc and cmake.

  1. Install the basic tools
  • Arch Linux
    # pacman -S gcc cmake
  1. Clone the repo

    $ git clone https://github.com/nflsilva/C3DGE.git
  2. Navigate into 3DGE directory and build the library

    $ cd 3DGE
    $ mkdir build
    $ cd build
    $ cmake ..
    $ make

Usage

It is possible to implement custom made game objects by sub-classing the Base engine objects.

To use this engine you need to create a game engine delegate. Create your game logic class and implement the delegate methods

class Game : public CoreEngineDelegate {
   private:
     CoreEngine* engine;
     BaseCamera* camera;
     Tree* tree;
   public:
     Game(CoreEngine* engine) : engine(engine) {}
     ~Game(){};
     void OnStart(){
       // Called when the engine starts.
       // Create your game objects here. 
       camera = new MovingCamera(
         glm::vec3(0, 0, 2), 
         glm::vec3(0, 0,-1), 
         glm::vec3(0, 1, 0));
       engine->SetCamera(camera);

       tree = new Tree(
         glm::vec3(0, 0, 0), 
         glm::vec3(0, 0, 0), 
         glm::vec3(1, 1, 1));
       engine->AddGameObject(tree);

     }
     void OnUpdate(float elapsedTime, InputState input){
       // Called once every game tick.
       // Useful for input processing.
     }
     void OnRender(){
       // Called once every game frame.
     }
     void OnDestroy(){
       // Called when the game stops.
       // Free any objects you needed.
     }
 };

For more examples, please refer to the TesterGame Project

License

Distributed under the MIT License. See LICENSE.txt for more information.

Acknowledgments

As guide and study material I would like to acknowledge the following:

About

Very basic 3D Game Engine in CPP

License:Apache License 2.0


Languages

Language:C 63.1%Language:C++ 36.0%Language:GLSL 0.6%Language:CMake 0.3%