The PainterQML class is responsible for making our game visible within QML using Painter. This class is intended to be added and created within QML. As the element showing our game it recognizes resize events and update events needed by our application. Also it keeps our rendering alive. Furthermore, it is the interface between game logic and rendering.
More...
#include <painterqml.h>
|
void | synchronize () |
| Synchronizes game logic and rendering. Because QML uses different threads for ui and rendering, synchronization between these threads has to be done. This slot is connected by PainterQML to corresponding signals of QQuickItem. More...
|
|
void | cleanup () |
| Cleans up the rendering thread ressources. This slot is also connected by PainterQML to corresponding signal of QQuickItem. More...
|
|
The PainterQML class is responsible for making our game visible within QML using Painter. This class is intended to be added and created within QML. As the element showing our game it recognizes resize events and update events needed by our application. Also it keeps our rendering alive. Furthermore, it is the interface between game logic and rendering.
PainterQML::PainterQML |
( |
QQuickItem * |
parent = 0 | ) |
|
|
explicit |
PainterQML::~PainterQML |
( |
| ) |
|
|
virtual |
void PainterQML::cleanup |
( |
| ) |
|
|
protectedslot |
Cleans up the rendering thread ressources. This slot is also connected by PainterQML to corresponding signal of QQuickItem.
bool PainterQML::event |
( |
QEvent * |
ev | ) |
|
|
override |
Process incoming qt events.
- Parameters
-
ev | Event that should be handled. |
- Returns
- Returns true if the event was handled by QObject.
bool PainterQML::isActive |
( |
| ) |
const |
Checks if the game will be updated. This means there is no reason to not update the game.
- Returns
void PainterQML::isActiveChanged |
( |
| ) |
|
|
signal |
bool PainterQML::isAppActive |
( |
| ) |
const |
Checks if the PainterQML assumes the app is active or not.
- Returns
void PainterQML::isAppActiveChanged |
( |
| ) |
|
|
signal |
bool PainterQML::isGameActive |
( |
| ) |
const |
Checks if our painter and therfor aour game is active. Active means that the game should be updated and rendered. But updates and rendering will be done only if there are no reasons against (e.g. The app is not active)
- Returns
- Returns true if PainterQML is active.
- See also
- isAppActive(), isActive()
void PainterQML::isGameActiveChanged |
( |
| ) |
|
|
signal |
QEvent::Type PainterQML::paintingDoneEventType |
( |
| ) |
|
Queries registered event type, that should be sent after rendering of current frame is done.
- Returns
- Returns registered event type
void PainterQML::reloadEnvMap |
( |
| ) |
|
Reloads environment map of game using Config.
void PainterQML::resetTimer |
( |
| ) |
|
Resets update timer. This method is provided to allow manual resetting update time.
Scene* PainterQML::scene |
( |
| ) |
const |
void PainterQML::sceneChanged |
( |
| ) |
|
|
signal |
void PainterQML::setIsAppActive |
( |
bool |
active | ) |
|
Informs the painter if app is active or not. Setting this attribute to false leads to pause of game (stop updating and rendering).
- Parameters
-
void PainterQML::setIsGameActive |
( |
bool |
active | ) |
|
void PainterQML::setScene |
( |
Scene * |
scene | ) |
|
Sets the scene which should be drawn by PainterQML.
- Parameters
-
void PainterQML::synchronize |
( |
| ) |
|
|
protectedslot |
Synchronizes game logic and rendering. Because QML uses different threads for ui and rendering, synchronization between these threads has to be done. This slot is connected by PainterQML to corresponding signals of QQuickItem.
bool PainterQML::m_isAppActive |
|
protected |
bool PainterQML::m_isGameActive |
|
protected |
bool PainterQML::m_isSceneDeletionRequired |
|
protected |
bool PainterQML::m_isUpdatePending |
|
protected |
int PainterQML::m_paintingDoneEventType |
|
protected |
Scene* PainterQML::m_scene |
|
protected |
QTime* PainterQML::m_time |
|
protected |
The documentation for this class was generated from the following files: