History

move SpatialEvent from EventTypes to its own file

Stephen Birarda committed 12 years ago

Commit 76493591 parent 818c97f5 files · +86 −59Browse files

Showing the changes to libraries/script-engine/src/SpatialEvent.cpp (1 of 5 files). Show all

Unified · Split

libraries/script-engine/src/SpatialEvent.cpp+46−0
@@ -0,0 +1,46 @@
1//
2// SpatialEvent.cpp
3// script-engine/src
4//
5// Created by Stephen Birarda on 2014-10-27.
6// Copyright 2014 High Fidelity, Inc.
7//
8// Distributed under the Apache License, Version 2.0.
9// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10//
11
12#include <RegisteredMetaTypes.h>
13
14#include "SpatialEvent.h"
15
16SpatialEvent::SpatialEvent() :
17 locTranslation(0.0f),
18 locRotation(),
19 absTranslation(0.0f),
20 absRotation()
21{
22
23}
24
25SpatialEvent::SpatialEvent(const SpatialEvent& event) {
26 locTranslation = event.locTranslation;
27 locRotation = event.locRotation;
28 absTranslation = event.absTranslation;
29 absRotation = event.absRotation;
30}
31
32
33QScriptValue SpatialEvent::toScriptValue(QScriptEngine* engine, const SpatialEvent& event) {
34 QScriptValue obj = engine->newObject();
35
36 obj.setProperty("locTranslation", vec3toScriptValue(engine, event.locTranslation) );
37 obj.setProperty("locRotation", quatToScriptValue(engine, event.locRotation) );
38 obj.setProperty("absTranslation", vec3toScriptValue(engine, event.absTranslation) );
39 obj.setProperty("absRotation", quatToScriptValue(engine, event.absRotation) );
40
41 return obj;
42}
43
44void SpatialEvent::fromScriptValue(const QScriptValue& object,SpatialEvent& event) {
45 // nothing for now...
46}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t