Menu

Home

Benedict Jäggi

Welcome to the Q Engine!

Intended to be a Level editor/game engine like Half-Life 2 and its glorious Hammer Editor.

This shall be a little game engine/graphics engine wrapper, in C++.
It's done in one header file so you don't have to link something or include other stuff than engine.hpp.
Except of course for all the graphics engine stuff where I cannot do anything.
Just use the makefile provided with the source. (or the build file).

IIt's currently running with the Irrlicht engine:
https://sourceforge.net/projects/irrlicht/

To compile, you need to copy the irrlicht folder into your main folder.
You should have a folder named irrlicht-1.8.5 then.

Classes, Variables and Stuff

[qEngine] - The main class which you use all over. It's a singleton, look below how to use it.
[qEventReceiver] - derive a class from that and set it with engine->setEventReceiver(...)to receive clicks on GUI buttons, single key presses, mouse events, listbox changes and other stuff.

[qEntity] - The objects of this engine.
[qMeshNodeEntity] - An object with a node (mesh, cube, spere or something). Derived from qEntity.
Create them with engine->createNodeEntity(...), NOT with new.

[typedefs] - some typedefs which you can use, and which change when you change the (now Irrlicht-) engine.

Examples

[example_01] - a main loop with two entities.
[example_02] - learn how to use the GUI.
[example_03] - a little editor. (No saving right now, though)

Installation:

Download the Irrlicht engine and put it into the repository folder.
My version is 1.8.5 - you should have a folder called irrlicht-1.8.5 then.

Type ./build

OR

cd source
make

Source

First include the engine:
#include "engine.hpp"

Maybe you need to set up an event receiver:
See [qEventReceiver] for more information.

class cevt : public qEventReceiver
{
    virtual void OnClick(qEMouseButton b, int x, int y)
    {
        printf("Mouse clicked at %d, %d",x,y);
    }
    ...
}

Get an instance to the engine with:

qEngine* e = qEngine::getInstance();

// register the event receiver
cevt ce;
e->setEventReceiver(&ce);

Then call createWindow:

if(!e->createWindow("Title", screenWidth, screenHeight, fullScreen)
{
    printf("Could not create window.\n");
    return 1;
}

Now you can create your entities and other stuff, then you go into the main loop:

while(e->isRunning())
{
    // ... your update code here
    e->update();
}

After that you can call quit and end the program:
e->quit();

The wiki uses Markdown syntax.

Project Members:


Related

Wiki: example_01
Wiki: example_02
Wiki: example_03
Wiki: qEngine
Wiki: qEntity
Wiki: qEventReceiver
Wiki: qMeshNodeEntity
Wiki: typedefs