VoltAir
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Groups
Pages
Engine
logics
triggers
ContactTrigger.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 CONTACTTRIGGER_H
18
#define CONTACTTRIGGER_H
19
20
#include "Actor.h"
21
#include "logics/Trigger.h"
22
#include "logics/events/ContactEvent.h"
23
30
class
ContactTrigger
:
public
Trigger
{
31
Q_OBJECT
32
public
:
36
Q_PROPERTY(
ContactEvent::Contact
contact
READ
getContact
WRITE
setContact
37
NOTIFY
contactChanged
)
41
Q_PROPERTY(
Actor::ActorType
actorType
READ
getActorType
WRITE
setActorType
42
NOTIFY
actorTypeChanged
)
43
44
47
Actor
::ActorType
getActorType
() {
return
mActorType; }
52
void
setActorType
(
Actor::ActorType
value);
56
ContactEvent::Contact
getContact
() {
return
mContact; }
61
void
setContact
(
ContactEvent::Contact
value);
62
66
virtual
void
init
()
override
;
67
68
signals:
72
void
actorTypeChanged
();
76
void
contactChanged
();
77
78
private
:
79
bool
actorTypeMatches(
Body
* body);
80
81
Actor::ActorType
mActorType;
82
ContactEvent::Contact
mContact;
83
};
84
Q_DECLARE_METATYPE(
ContactTrigger
*)
85
86
#endif // CONTACTTRIGGER_H
ContactTrigger::contactChanged
void contactChanged()
Emitted when contact changes.
ContactTrigger::contact
ContactEvent::Contact contact
Contact type of this trigger.
Definition:
ContactTrigger.h:37
Body
A QObject container for a Box2D b2Body.
Definition:
Body.h:57
ContactTrigger::setActorType
void setActorType(Actor::ActorType value)
Sets actorType.
Actor::ActorType
ActorType
Different categories of Actors, used to differentiate among them.
Definition:
Actor.h:49
ContactTrigger::setContact
void setContact(ContactEvent::Contact value)
Sets contact.
ContactTrigger::actorType
Actor::ActorType actorType
Actor::ActorType that will activate this trigger.
Definition:
ContactTrigger.h:42
ContactTrigger::init
virtual void init() override
Initializes the ContactTrigger.
Actor
Representation of an entity within the Game scene.
Definition:
Actor.h:40
ContactTrigger::actorTypeChanged
void actorTypeChanged()
Emitted when actorType changes.
ContactTrigger::getActorType
Actor::ActorType getActorType()
Returns actorType.
Definition:
ContactTrigger.h:47
ContactEvent::Contact
Contact
Types of ContactEvents that can occur.
Definition:
ContactEvent.h:37
Trigger
Listens for one or more events (TriggerEvent) and calls an event handler (handleEvent()) in response ...
Definition:
Trigger.h:33
ContactTrigger::getContact
ContactEvent::Contact getContact()
Returns contact.
Definition:
ContactTrigger.h:56
ContactTrigger
Listens to ContactEvents between the parent Actor's Body and another body of the specified ActorType...
Definition:
ContactTrigger.h:30