VoltAir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
StopwatchLogic.h
1 /*
2  * Copyright (C) 2014 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef STOPWATCHLOGIC_H
18 #define STOPWATCHLOGIC_H
19 
20 #include "Logic.h"
21 
28 class StopwatchLogic : public Logic {
29  Q_OBJECT
30 
34  Q_PROPERTY(float time READ getTime WRITE setTime NOTIFY timeChanged)
35 
36 public:
40  float getTime() const { return mTime; }
45  void setTime(float value);
46 
50  virtual void update() override;
51 
52 signals:
56  void timeChanged();
62  void timeElapsed();
63 
64 private:
65  float mTime = 0.0f;
66 };
67 Q_DECLARE_METATYPE(StopwatchLogic*)
68 
69 #endif // STOPWATCHLOGIC_H
float time
Time remaining on countdown.
Definition: StopwatchLogic.h:34
virtual void update() override
Updates the time remaining on the countdown.
void timeChanged()
Emitted when time is explicitly (re)set.
void setTime(float value)
Sets time.
Non-visual entities in the QML item tree that define behavior for their parent Actor.
Definition: Logic.h:31
void timeElapsed()
Emitted when the stopwatch timer expires.
float getTime() const
Returns time.
Definition: StopwatchLogic.h:40
Defines a stopwatch which triggers any callbacks connected to timeElapsed() after time game-time seco...
Definition: StopwatchLogic.h:28