VoltAir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
Signals | Public Member Functions | Protected Member Functions | Properties | List of all members
Level Class Reference

Representation of an in-game level. More...

Inheritance diagram for Level:
QQuickItem QObject QQmlParserStatus

Signals

void cameraBoundaryChanged ()
 Emitted when cameraBoundary changes. More...
 
void fillCameraChanged ()
 Emitted when fillCamera changes. More...
 
void nameChanged ()
 Emitted when name changes. More...
 
void fileNameChanged ()
 Emitted when fileName changes. More...
 
void gravityChanged ()
 Emitted when gravity changes. More...
 
void parallaxOriginChanged ()
 Emitted when parallaxOrigin changes. More...
 
void parallaxStrengthChanged ()
 Emitted when parallaxStrength changes. More...
 
void particleLayerChanged ()
 Emitted when particleLayer changes. More...
 
void particleAlphaChanged ()
 Emitted when particleAlpha changes. More...
 
void particleLayersChanged ()
 Emitted when particleLayers changes. More...
 
void completionThresholdChanged ()
 Emitted when completionThreshold changes. More...
 

Public Member Functions

 Level ()
 Construct a Level. More...
 
QRectF getCameraBoundary () const
 Returns cameraBoundary. More...
 
void setCameraBoundary (const QRectF &value)
 Sets cameraBoundary. More...
 
bool shouldFillCamera () const
 Returns fillCamera. More...
 
void setFillCamera (bool value)
 Sets fillCamera. More...
 
const QStringgetName () const
 Returns name. More...
 
void setName (const QString &value)
 Sets name. More...
 
const QStringgetFileName () const
 Returns fileName. More...
 
void setFileName (const QString &value)
 Sets fileName. More...
 
QPointF getGravity () const
 Returns gravity. More...
 
void setGravity (const QPointF &value)
 Sets name. More...
 
int getStartingNumPickups () const
 Returns startingNumPickups. More...
 
QPointF getParallaxOrigin () const
 Returns parallaxOrigin. More...
 
void setParallaxOrigin (const QPointF &value)
 Sets parallaxOrigin. More...
 
QPointF getParallaxStrength () const
 Returns parallaxStrength. More...
 
void setParallaxStrength (const QPointF &value)
 Sets parallaxStrength. More...
 
int getParticleLayer () const
 Returns particleLayer. More...
 
void setParticleLayer (int value)
 Sets particleLayer. More...
 
float getParticleAlpha ()
 Returns particleAlpha. More...
 
void setParticleAlpha (float value)
 Sets particleAlpha. More...
 
const QList< ParticleLayer * > & getParticleLayers () const
 Returns particleLayers as a QList. More...
 
void setParticleLayers (const QList< ParticleLayer * > &value)
 Sets particleLayers from a QList. More...
 
QQmlListProperty< ParticleLayergetParticleLayerListProperty ()
 Returns particleLayers as a QML mutable list. More...
 
int getCompletionThreshold () const
 Returns completionThreshold. More...
 
void setCompletionThreshold (int value)
 Sets completionThreshold. More...
 
ActorgetPortal () const
 Returns portal. More...
 
void addActor (Actor *actor)
 Dynamically inserts the specified actor into the level-based scene graph, assuming it does not already exist. More...
 
const QSet< Actor * > & getActors (Actor::ActorType type) const
 Returns the set of actors in the level scene graph of the specified type. More...
 
b2World * getWorld () const
 Returns the physics world (b2World) owned by this Level. More...
 
- Public Member Functions inherited from QQuickItem
 QQuickItem (QQuickItem *parent)
 
QQuickWindowwindow () const
 
QQuickItemparentItem () const
 
void setParentItem (QQuickItem *parent)
 
void stackBefore (const QQuickItem *sibling)
 
void stackAfter (const QQuickItem *sibling)
 
QRectF childrenRect ()
 
QList< QQuickItem * > childItems () const
 
bool clip () const
 
void setClip (bool)
 
QString state () const
 
void setState (const QString &)
 
qreal baselineOffset () const
 
void setBaselineOffset (qreal)
 
qreal x () const
 
qreal y () const
 
void setX (qreal)
 
void setY (qreal)
 
qreal width () const
 
void setWidth (qreal)
 
void resetWidth ()
 
void setImplicitWidth (qreal)
 
qreal implicitWidth () const
 
qreal height () const
 
void setHeight (qreal)
 
void resetHeight ()
 
void setImplicitHeight (qreal)
 
qreal implicitHeight () const
 
TransformOrigin transformOrigin () const
 
void setTransformOrigin (TransformOrigin)
 
qreal z () const
 
void setZ (qreal)
 
qreal rotation () const
 
void setRotation (qreal)
 
qreal scale () const
 
void setScale (qreal)
 
qreal opacity () const
 
void setOpacity (qreal)
 
bool isVisible () const
 
void setVisible (bool)
 
bool isEnabled () const
 
void setEnabled (bool)
 
bool smooth () const
 
void setSmooth (bool)
 
bool activeFocusOnTab () const
 
void setActiveFocusOnTab (bool)
 
bool antialiasing () const
 
void setAntialiasing (bool)
 
void resetAntialiasing ()
 
Flags flags () const
 
void setFlag (Flag flag, bool enabled)
 
void setFlags (QFlags< QQuickItem::Flag > flags)
 
bool hasActiveFocus () const
 
bool hasFocus () const
 
void setFocus (bool)
 
void setFocus (bool focus, Qt::FocusReason reason)
 
bool isFocusScope () const
 
QQuickItemscopedFocusItem () const
 
Qt::MouseButtons acceptedMouseButtons () const
 
void setAcceptedMouseButtons (Qt::MouseButtons buttons)
 
bool acceptHoverEvents () const
 
void setAcceptHoverEvents (bool enabled)
 
QCursor cursor () const
 
void setCursor (const QCursor &cursor)
 
void unsetCursor ()
 
void grabMouse ()
 
void ungrabMouse ()
 
bool keepMouseGrab () const
 
void setKeepMouseGrab (bool keep)
 
bool filtersChildMouseEvents () const
 
void setFiltersChildMouseEvents (bool filter)
 
void grabTouchPoints (const QVector< int > &ids)
 
void ungrabTouchPoints ()
 
bool keepTouchGrab () const
 
void setKeepTouchGrab (bool keep)
 
virtual bool contains (const QPointF &point) const
 
QPointF mapToItem (const QQuickItem *item, const QPointF &point) const
 
QPointF mapToScene (const QPointF &point) const
 
QRectF mapRectToItem (const QQuickItem *item, const QRectF &rect) const
 
QRectF mapRectToScene (const QRectF &rect) const
 
QPointF mapFromItem (const QQuickItem *item, const QPointF &point) const
 
QPointF mapFromScene (const QPointF &point) const
 
QRectF mapRectFromItem (const QQuickItem *item, const QRectF &rect) const
 
QRectF mapRectFromScene (const QRectF &rect) const
 
void polish ()
 
void forceActiveFocus ()
 
void forceActiveFocus (Qt::FocusReason reason)
 
QQuickItemnextItemInFocusChain (bool forward)
 
QQuickItemchildAt (qreal x, qreal y) const
 
virtual QVariant inputMethodQuery (Qt::InputMethodQuery query) const
 
virtual bool isTextureProvider () const
 
virtual QSGTextureProvidertextureProvider () const
 
void update ()
 
void windowChanged (QQuickWindow *window)
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
virtual const QMetaObjectmetaObject () const
 
QString objectName () const
 
void setObjectName (const QString &name)
 
bool isWidgetType () const
 
bool isWindowType () const
 
bool signalsBlocked () const
 
bool blockSignals (bool block)
 
QThreadthread () const
 
void moveToThread (QThread *targetThread)
 
int startTimer (int interval, Qt::TimerType timerType)
 
void killTimer (int id)
 
findChild (const QString &name, QFlags< Qt::FindChildOption > options) const
 
QList< T > findChildren (const QString &name, QFlags< Qt::FindChildOption > options) const
 
QList< T > findChildren (const QRegExp &regExp, QFlags< Qt::FindChildOption > options) const
 
QList< T > findChildren (const QRegularExpression &re, QFlags< Qt::FindChildOption > options) const
 
const QObjectList & children () const
 
void setParent (QObject *parent)
 
void installEventFilter (QObject *filterObj)
 
void removeEventFilter (QObject *obj)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const
 
bool disconnect (const QObject *receiver, const char *method) const
 
void dumpObjectTree ()
 
void dumpObjectInfo ()
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const
 
QList< QByteArraydynamicPropertyNames () const
 
void destroyed (QObject *obj)
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const
 
bool inherits (const char *className) const
 
void deleteLater ()
 
- Public Member Functions inherited from QQmlParserStatus
virtual void classBegin ()=0
 
virtual void componentComplete ()=0
 

Protected Member Functions

virtual void componentComplete () override
 Post-initialization of the Level after all child Actors have been created and set. More...
 
- Protected Member Functions inherited from QQuickItem
virtual bool event (QEvent *ev)
 
bool isComponentComplete () const
 
virtual void itemChange (ItemChange change, const ItemChangeData &value)
 
void updateInputMethod (Qt::InputMethodQueries queries)
 
bool widthValid () const
 
bool heightValid () const
 
virtual void classBegin ()
 
virtual void keyPressEvent (QKeyEvent *event)
 
virtual void keyReleaseEvent (QKeyEvent *event)
 
virtual void inputMethodEvent (QInputMethodEvent *event)
 
virtual void focusInEvent (QFocusEvent *event)
 
virtual void focusOutEvent (QFocusEvent *event)
 
virtual void mousePressEvent (QMouseEvent *event)
 
virtual void mouseMoveEvent (QMouseEvent *event)
 
virtual void mouseReleaseEvent (QMouseEvent *event)
 
virtual void mouseDoubleClickEvent (QMouseEvent *event)
 
virtual void mouseUngrabEvent ()
 
virtual void touchUngrabEvent ()
 
virtual void wheelEvent (QWheelEvent *event)
 
virtual void touchEvent (QTouchEvent *event)
 
virtual void hoverEnterEvent (QHoverEvent *event)
 
virtual void hoverMoveEvent (QHoverEvent *event)
 
virtual void hoverLeaveEvent (QHoverEvent *event)
 
virtual void dragEnterEvent (QDragEnterEvent *event)
 
virtual void dragMoveEvent (QDragMoveEvent *event)
 
virtual void dragLeaveEvent (QDragLeaveEvent *event)
 
virtual void dropEvent (QDropEvent *event)
 
virtual bool childMouseEventFilter (QQuickItem *item, QEvent *event)
 
virtual void geometryChanged (const QRectF &newGeometry, const QRectF &oldGeometry)
 
virtual QSGNodeupdatePaintNode (QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData)
 
virtual void releaseResources ()
 
virtual void updatePolish ()
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 
bool isSignalConnected (const QMetaMethod &signal) const
 
virtual void timerEvent (QTimerEvent *event)
 
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 

Properties

QRectF cameraBoundary
 Rectangular region in world coordinates outside of which the Camera must not display. More...
 
bool fillCamera
 true if the Camera should be fixed to the cameraBoundary, and always view the extents of that region. More...
 
QString name
 Name of this Level. More...
 
QString fileName
 Path to the file that this Level was loaded from. More...
 
QPointF gravity
 Strength of gravity. More...
 
int startingNumPickups
 Number of Actors with PickupLogics, representing the total number of objects that can be collected in the Level (e.g. the number of Orb Actors in the Level). More...
 
QPointF parallaxOrigin
 Location of the parallax origin. More...
 
QPointF parallaxStrength
 Amount of offset Graphics under a ParallaxTransformItem will receive. More...
 
int particleLayer
 Z-depth that the particles rendered by ParticleRendererItem should be at. More...
 
float particleAlpha
 Overall transparency of the particles rendered by ParticleRendererItem, with 0.0f being completely transparent, and 1.0f being maximally opaque. More...
 
QQmlListProperty< ParticleLayerparticleLayers
 QML mutable list of ParticleLayers, each representing a physically independent layer of LiquidFun particles. More...
 
int completionThreshold
 Points threshold for which the level can be considered "complete". More...
 
Actor portal
 Helper property to find the Portal for this Level. More...
 
- Properties inherited from QQuickItem
 parent
 
 x
 
 y
 
 z
 
 width
 
 height
 
 opacity
 
 enabled
 
 visible
 
 state
 
 childrenRect
 
 baselineOffset
 
 clip
 
 focus
 
 activeFocus
 
 activeFocusOnTab
 
 rotation
 
 scale
 
 transformOrigin
 
 smooth
 
 antialiasing
 
 implicitWidth
 
 implicitHeight
 
- Properties inherited from QObject
 objectName
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
- Public Attributes inherited from QQuickItem
typedef Flags
 

Detailed Description

Representation of an in-game level.

A Level is a discrete section of the game, each with a well defined start and end. Most Levels in VoltAir start at the Robot's spawn point and end when the Robot successfully enters an activated Portal.

Levels are comprised of a collection of Actors (for example, the Robot). The data describing the initial state of these Actors is loaded from data (QML) and instantiated into a tree structure. Nodes are QQuickItems or QObjects, and form part of the QML tree. The Level object itself becomes the parent of all of these objects.

Aside from containing Actors, the Level is responsible for maintaining some of the state that is global to the Level, such as the intensity of gravity. The Level is also the owner of the physics world (b2World).

Constructor & Destructor Documentation

Level::Level ( )
explicit

Construct a Level.

Member Function Documentation

void Level::addActor ( Actor actor)

Dynamically inserts the specified actor into the level-based scene graph, assuming it does not already exist.

Parameters
actorActor to add to the level's scene graph
void Level::cameraBoundaryChanged ( )
signal

Emitted when cameraBoundary changes.

void Level::completionThresholdChanged ( )
signal

Emitted when completionThreshold changes.

virtual void Level::componentComplete ( )
overrideprotectedvirtual

Post-initialization of the Level after all child Actors have been created and set.

Reimplemented from QQuickItem.

void Level::fileNameChanged ( )
signal

Emitted when fileName changes.

void Level::fillCameraChanged ( )
signal

Emitted when fillCamera changes.

const QSet<Actor*>& Level::getActors ( Actor::ActorType  type) const

Returns the set of actors in the level scene graph of the specified type.

Parameters
typeType (Actor::ActorType) of Actors to get
QRectF Level::getCameraBoundary ( ) const
inline

Returns cameraBoundary.

int Level::getCompletionThreshold ( ) const
inline
const QString& Level::getFileName ( ) const
inline

Returns fileName.

QPointF Level::getGravity ( ) const
inline

Returns gravity.

const QString& Level::getName ( ) const
inline

Returns name.

QPointF Level::getParallaxOrigin ( ) const
inline

Returns parallaxOrigin.

QPointF Level::getParallaxStrength ( ) const
inline

Returns parallaxStrength.

float Level::getParticleAlpha ( )
inline

Returns particleAlpha.

int Level::getParticleLayer ( ) const
inline

Returns particleLayer.

QQmlListProperty<ParticleLayer> Level::getParticleLayerListProperty ( )

Returns particleLayers as a QML mutable list.

const QList<ParticleLayer*>& Level::getParticleLayers ( ) const
inline

Returns particleLayers as a QList.

Actor* Level::getPortal ( ) const
inline

Returns portal.

int Level::getStartingNumPickups ( ) const
inline
b2World* Level::getWorld ( ) const
inline

Returns the physics world (b2World) owned by this Level.

void Level::gravityChanged ( )
signal

Emitted when gravity changes.

void Level::nameChanged ( )
signal

Emitted when name changes.

void Level::parallaxOriginChanged ( )
signal

Emitted when parallaxOrigin changes.

void Level::parallaxStrengthChanged ( )
signal

Emitted when parallaxStrength changes.

void Level::particleAlphaChanged ( )
signal

Emitted when particleAlpha changes.

void Level::particleLayerChanged ( )
signal

Emitted when particleLayer changes.

void Level::particleLayersChanged ( )
signal

Emitted when particleLayers changes.

void Level::setCameraBoundary ( const QRectF value)

Sets cameraBoundary.

Parameters
valueQRectF to set cameraBoundary to
void Level::setCompletionThreshold ( int  value)

Sets completionThreshold.

Parameters
valueInteger to set completionThreshold to
void Level::setFileName ( const QString value)

Sets fileName.

Parameters
valueQString to set fileName to
void Level::setFillCamera ( bool  value)

Sets fillCamera.

Parameters
valueBoolean to set fillCamera to
void Level::setGravity ( const QPointF value)

Sets name.

Parameters
valueQPointF to set name to
void Level::setName ( const QString value)

Sets name.

Parameters
valueQString to set name to
void Level::setParallaxOrigin ( const QPointF value)

Sets parallaxOrigin.

Parameters
valueQPointF to set parallaxOrigin to
void Level::setParallaxStrength ( const QPointF value)

Sets parallaxStrength.

Parameters
valueQPointF to set parallaxStrength to
void Level::setParticleAlpha ( float  value)

Sets particleAlpha.

Parameters
valueFloat to set particleAlpha to
void Level::setParticleLayer ( int  value)

Sets particleLayer.

Parameters
valueInteger to set particleLayer to
void Level::setParticleLayers ( const QList< ParticleLayer * > &  value)

Sets particleLayers from a QList.

Parameters
valueQList of ParticleLayers to set particleLayers to
bool Level::shouldFillCamera ( ) const
inline

Returns fillCamera.

Property Documentation

QRectF Level::cameraBoundary
readwrite

Rectangular region in world coordinates outside of which the Camera must not display.

int Level::completionThreshold
readwrite

Points threshold for which the level can be considered "complete".

See also
Game
QString Level::fileName
readwrite

Path to the file that this Level was loaded from.

bool Level::fillCamera
readwrite

true if the Camera should be fixed to the cameraBoundary, and always view the extents of that region.

If false, the Camera tries to follow the location of the Actors marked as Actor::PlayerActor.

See also
CameraMovementLogic
QPointF Level::gravity
readwrite

Strength of gravity.

QString Level::name
readwrite

Name of this Level.

QPointF Level::parallaxOrigin
readwrite

Location of the parallax origin.

See also
ParallaxTransformItem
QPointF Level::parallaxStrength
readwrite

Amount of offset Graphics under a ParallaxTransformItem will receive.

See also
ParallaxTransformItem
float Level::particleAlpha
readwrite

Overall transparency of the particles rendered by ParticleRendererItem, with 0.0f being completely transparent, and 1.0f being maximally opaque.

int Level::particleLayer
readwrite

Z-depth that the particles rendered by ParticleRendererItem should be at.

This controls what Graphics they appear in front and behind.

QQmlListProperty<ParticleLayer> Level::particleLayers
read

QML mutable list of ParticleLayers, each representing a physically independent layer of LiquidFun particles.

See also
ParticleLayer
Actor Level::portal
read

Helper property to find the Portal for this Level.

int Level::startingNumPickups
read

Number of Actors with PickupLogics, representing the total number of objects that can be collected in the Level (e.g. the number of Orb Actors in the Level).