VoltAir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
AcceleratorLogic.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 ACCELERATORLOGIC_H
18 #define ACCELERATORLOGIC_H
19 
20 #include <Engine/Logic.h>
21 
26 class AcceleratorLogic : public Logic {
27  Q_OBJECT
28 
33  Q_PROPERTY(float acceleration READ getAcceleration WRITE setAcceleration
35 public:
39  float getAcceleration() const { return mAcceleration; }
44  void setAcceleration(float value);
45 
49  virtual void init() override;
50 
54  virtual void update() override;
55 
56 signals:
60  void accelerationChanged();
61 
62 private:
63  float mAcceleration = 3.0f;
64 };
65 Q_DECLARE_METATYPE(AcceleratorLogic*)
66 
67 #endif // ACCELERATORLOGIC_H
void accelerationChanged()
Emitted when acceleration changes.
void setAcceleration(float value)
Sets acceleration.
float acceleration
How much the contacting Bodys are accelerated each frame.
Definition: AcceleratorLogic.h:34
virtual void update() override
Uses Body::applyForceToCenter() to accelerate Bodys in contact with actor.
Accelerates Bodys that are in contact with the AcceleratorLogic's actor in the direction that they ar...
Definition: AcceleratorLogic.h:26
Non-visual entities in the QML item tree that define behavior for their parent Actor.
Definition: Logic.h:31
virtual void init() override
Checks the AcceleratorLogic has an actor with a Body.
float getAcceleration() const
Returns acceleration.
Definition: AcceleratorLogic.h:39