This is the main class of the engine wrapper.
It connects the user to the underlying graphics and game engine.
Get the singleton instance with:
qEngine* e = qEngine::getInstance();
Then you can do all your stuff with e
.
Returns the qEngine Singleton instance and creates it if it does not exist.
Creates the main window with the given title, width and height.
Fullscreen is false by default.
Call this function right after you got the engine instance.
Other functions depend on the stuff created with createWindow.
Use that for your main loop. Returns true if running, false if not.
Call this once in your main loop. It refreshes and updates the window, gets the delta time and does some other stuff.
Call this after your main loop, when exiting the program.
Use this to create an entity, load its mesh and texture and add it to the scenemanager.
DON'T CREATE ENTITIES WITH NEW,
CREATE THEM WITH engine->createEntity(...)
You can create different entities with the mesh file name:
@sphere
creates a sphere.
@cube
creates a cube.
fileName
tries to load the fileName mesh.
Use this to delete an entity.
All entities will be deleted when quit()
gets called.
Remove all entities from the scene and delete them.
Creates a GUI window with a close button and a title.
Creates a messagebox with a title, text and OK button.
Adds a static GUI text window with the given width and height, on posX, posY with the given text to display.
createWindow
must be called before.
Adds a GUI button. You can catch its clicks by deriving a class from qGUIClickReceiver
and setting it with engine->setGUIClickReceiver()
.
Just overwrite the virtual function OnClick(int id)
of qGUIClickReceiver
.
Also you can get the pressed status by calling button->isPressed()
, but this will be set continuously and not just once.
Returns the entity at the mouse x and y position.
Returns the entity at the given screen position, seen from the actual camera.
You can use this in ego shooters with screenWidth/2, screenHeight/2 as parameters.
Returns the entity with the given ID.
Returns the FIRST entity with the given name.
Returns the time passed since the last frame, in seconds.
Returns the camera instance.
Returns if the key with the given code is down (true) or up (false).
Returns the current X position of the mouse.
Returns the current Y position of the mouse.
Creates a texture and loads the given fileName image into it.
Sets the background color. Note that the alpha value comes last in the function but first in the qColor4i constructor.
Sets the given click receiver.
Derive a class from qClickReceiver,
over write the functions
OnGUIButtonClick
, OnMouseDown
, OnMouseUp
and register it with this function.
See [qClickReceiver] for more information, or [example_02].
Removes the actual camera and replaces it with a camera that is controllable like the camera on the 3d application Maya.
Returns the graphics engine's scenemanager. You should not use this.
Returns the GUI environment where you can create buttons, text boxes, scroll bars and stuff.
The most important GUI elements have their own function on the engine.