Bacon2D

Game QML Type

The root element containing one or more Scene. More...

Import Statement: import Bacon2D 1.0

Properties

Methods

Detailed Description

The Game component is the root game component which contains one or more Scene components. Only one Scene will be set as currentScene.

Example usage:

import QtQuick 2.0
import Bacon2D 1.0

Game {
    id: game
    width: 800
    height: 600

    Scene {
        id: scene
        width: 300
        height: 300
    }
}

Property Documentation

currentScene : Scene

The current Scene


gameName : string

Name of the game, required if using Settings


gameState : Bacon2D.State

This property holds the current gameState.

This enum type is used to specify the current state of the game.
StateDescription
Bacon2D.ActiveGame is active and the currentScene is not running
Bacon2D.InactiveGame is inactive
Bacon2D.RunningGame is active and the currentScene is running
Bacon2D.PausedGame is paused by user request.
Bacon2D.SuspendedGame is suspended, usually means the platform has stopped the process or the game is no longer focused.

See also Qt.ApplicationState.


mouse : QPointF

The point in the plane of the mouse pointer


stackLevel : int

Indicates how many Scenes are stacked in the scene stack


ups : int

This property holds the number of times update is called per second.

Updates per second can be used to control the speed of the game loop. The default is 30.


Method Documentation

Scene * popScene()

Suspends and remove the top Scene from the scene stack. Suspends and remove the current Scene from stack. If exitAnimation property the exit will be animated. When there is no scene on stack, it will do nothing.

See also pushScene.


void pushScene(Scene * scene)

Suspends the execution of the running scene, while add a new Scene to the Scene stack. If the Scene has the enterAnimation property set, the push will be animated.

Warning: Pushing scenes already on stack will remove it from the current position and place it on top of the stack.

See also popScene.