0Engine is a 2D Game Engine / Framework developed using OpenGL as a graphics API
- Running Using Visual Studio in Windows
- Dependencies
- Directory Structure
- Directory Structure for 0Engine
- Building the project
- Components of the 0Engine
- Run the solution file
s00nya.slnto open the project using Visual Studio - Right Click the Game project and click on Set as Start Up Project
- Press [F5] or click the Local Windows Debugger button to run the project
Note that all the dependencies are readily avaible, so it is not required for installing them separately
- Root directory consists of the directories :
0Engine,Dependenciesand other directories - All the compiled / build files are (or should be) inside of the directory
binin the root directory - All other directories in the root directories except above mentioned are Example game projects made using the 0Engine
Dependenciesdirectory contains all the projects that 0Engine depends on0Enginedirectory contains the source code for the 0Engine
Directories and files inside of 0Engine directory ::
Debugger: Logger class and OpenGL debuggerGame: Wrapper for the whole framework and Locator of all required serviesGameObject: Base classes for Game Objects, Cameras, Lights, etcGraphics: GPU buffers, Renderer, Materials, Shaders, Sprites and WindowInput: Input systems and Input ManagerMath: Vectors, Matrices, Transformation, Dimensions and other mathematicsPhysics: Kinematics, Collision and Collision ResolutionUtility: Events Manager, Resources Manager, Timer and other utilities
Directories inside of the Headers directory contain decalrations of all the classes / functions that are defined in above mentioned directories
Note that s00nya.h file inside of 0Engine/Headers/ should include all the header files whose API are to be exposed to the game developers
- All dependencies should be compiled to static libraries
0Enginecontents depend onDependenciesand should be compiled to static / dyanamic library according to the macro defined in0Engine/Headers/s00nya_defs.h- Other game projects depend on
0Engineand should be linked with the0Enginelibrary - Game should output to executables
Information
Game2Dis a wrapper class for different components of the 0Engine- Maintains relationships between all different components of the 0Engine
- It contains Locator, Window, Timer, Input, Input Manager, Event Manager, Resources, Renderer, Shaders and Scenes
- All the components are instanced using Locator class
Game2Dloads an activeScene, only one scene can be active at a time- Tick(), FixedUpdate() and Update() method are called every second, 60 times a second and as fast as possible respectively in the game loop
API
Game2D(const Character* title, const Integer& width, const Integer& height, const Samples& sample)- title = Title to be displayed in the window, defaults to "s00nya Game"
- width = Width of the window, defaults to 800
- height = Height of the window, defaults to 600
- sample = Sample order for multisampling. Can be { NO_SAMPLE, SAMPLE_DOUBLE, SAMPLE_FOUR, SAMPLE_EIGHT } from
Samples
void Start()Begins the game loop
static Input& GetInput()Returns reference to Input
static Timer& GetTimer()Returns reference to Timer
static InputManager& GetInputManager()Returns reference to Input Manager
static EventManager& GetEventManager()Returns reference to Event Manager
static Resources& GetResourceManager()`Returns reference to Resources
static void ActivateScene(const PDUInteger& id)`static void ActivateNextScene()`Activate Scene in next order
static PDUInteger PushScene(Scene* scene)`- scene = pointer to Scene
- Adds given
scenein theGame2D - Scene passed must be created in heap, memory is then maintained by this wrapper so cleaning is not required
static void PopSceneBack()`Remove last placed Scene
static void PopSceneFront()`Remove first placed Scene
static Scene& GetCurrentScene()`Get reference to currently active Scene
Information
- Locator is a singleton class
- It is used for creating instances of Window, Timer, Input, Input Manager, Event Manager, Resources, Renderer
- It is used by Game2D
- It returns pointer to these classes allocated in heap
- It is not responsible for cleaning the allocated memory, caller (in our case Game2D) is reponsible for cleaning the allocated memory
API
This class is not intended to be used as a part of the Game development process
Information
- Window class maintains Window creation, resizing, destruction and other window related functions
- Window class automatically creates instance of Debug during window creation and shut down Debug during window destruction
- Window class is required for creation of Input System
- Timer must be constructed after window construction because Timer depends on window class
API
void Resize(const Integer& width, const Integer& height);- width = Width of the window to be resized to
- height = Height of the window to be resized to
void ToggleFullscreen();- Toggles full screen mode
- On window construction, the window will be in windowed mode by default
void ChangeCursor(const RawImage& image);- image = RawImage that is to be placed as cursor within the window
- Changes the cursor within the window
void SetIcon(const RawImage& image);- image = RawImage that is to be placed as window icon
- Sets / Changes the window icon
void DisableCursor() const;Disables cursor and sets a virtual cursor in the middle of the window client area
void HideCursor() const;Hides cursor within the window
void EnableCursor() const;Resets cursor properties (Hidden / Disabled cursor)
const Integer& Width() const;Returns Width of the window
const Integer& Height() const;Returns Height of the window
Information
- Debug lets the debug information to be displayed in console and file
- This class automatically finds and displays OpenGL errors & warnings
- It is automatically constructed during Window creation and destroyed during Window destruction
API
static void Add(const std::string& logStr, Integer level)- logStr = string data that is to be logged
- level = the level of the log. Can be { S00NYA_LOG_INFO, S00NYA_LOG_ERROR, S00NYA_LOG_WARNING } inside of
Debug
Information
This class records information about time and timing of the program
API
Float DeltaTime() const;Returns the time spent between 2 sucessive frame / game loop
static Float ElaspedTime();Returns the time spent after the program ran
Information
- This class maintains keyboard and mouse input
- This class is constructed using the Window class
API
Boolean Pressed(const Keys& key);Returns true if the given key is pressed otherwise false
Boolean Held(const Keys& key);Returns true if the given key is held otherwise false
Boolean Combined(const Keys& hold, const Keys& press);Returns true if the hold is held and press is pressed otherwise false
Boolean Combined(const Keys& hold1, const Keys& hold2, const Keys& press);Returns true if the hold1 and hold2 is held and press is pressed otherwise false
Boolean Pressed(const Buttons& button);Returns true if the button Mouse button is pressed otherwise false
Boolean Held(const Buttons& button);Returns true if the button Mouse button is held otherwise false
const Float& CursorPositionX();Returns Horizontal position of the mouse cursor
const Float& CursorPositionY();Returns Vertical position of the mouse cursor
const Float& HorizontalAxis();- Returns horizontal offset when the mouse is moved
- Value lies between -1.0f to 1.0f
const Float& VerticalAxis();- Returns horizontal offset when the mouse is moved
- Value lies between -1.0f to 1.0f
const Float& ScrollHorizontalAxis();Returns the number of scroll wheels scrolled horizontally
const Float& ScrollVerticalAxis();Returns the number of scroll wheels scrolled vertically
static const Character* GetName(const Keys& key);Returns name of the given key
static const Character* GetName(const Buttons& button);Returns name of the mouse button button
Information
API
Information
API
Information
API
Information
API
Information
API
Information
API
Information
API
Information
API
Information
API
Information
API
Information
API
Information
API
Information
API
Information
API
Information
API
Information
API
Information
API
Information
API
Information
API
Information
API
Information
API
Information
API
Information
API
Information
API