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/EventTypes.cpp (1 of 5 files). Show all

Unified · Split

libraries/script-engine/src/EventTypes.cpp+2−35
@@ -9,11 +9,9 @@ · 8 unmodified lines
99 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
1010 //
1111
12−#include <QDebug>
13−#include <RegisteredMetaTypes.h>
14−
1512 #include "KeyEvent.h"
1613 #include "MouseEvent.h"
14+#include "SpatialEvent.h"
1715 #include "TouchEvent.h"
1816 #include "WheelEvent.h"
1917
@@ -24,36 +22,5 @@ void registerEventTypes(QScriptEngine* engine) { · 4 unmodified lines
2422 qScriptRegisterMetaType(engine, MouseEvent::toScriptValue, MouseEvent::fromScriptValue);
2523 qScriptRegisterMetaType(engine, TouchEvent::toScriptValue, TouchEvent::fromScriptValue);
2624 qScriptRegisterMetaType(engine, WheelEvent::toScriptValue, WheelEvent::fromScriptValue);
27− qScriptRegisterMetaType(engine, spatialEventToScriptValue, spatialEventFromScriptValue);
28−}
29−
30−SpatialEvent::SpatialEvent() :
31− locTranslation(0.0f),
32− locRotation(),
33− absTranslation(0.0f),
34− absRotation()
35−{
36−};
37−
38−SpatialEvent::SpatialEvent(const SpatialEvent& event) {
39− locTranslation = event.locTranslation;
40− locRotation = event.locRotation;
41− absTranslation = event.absTranslation;
42− absRotation = event.absRotation;
43−}
44−
45−
46−QScriptValue spatialEventToScriptValue(QScriptEngine* engine, const SpatialEvent& event) {
47− QScriptValue obj = engine->newObject();
48−
49− obj.setProperty("locTranslation", vec3toScriptValue(engine, event.locTranslation) );
50− obj.setProperty("locRotation", quatToScriptValue(engine, event.locRotation) );
51− obj.setProperty("absTranslation", vec3toScriptValue(engine, event.absTranslation) );
52− obj.setProperty("absRotation", quatToScriptValue(engine, event.absRotation) );
53−
54− return obj;
55−}
56−
57−void spatialEventFromScriptValue(const QScriptValue& object,SpatialEvent& event) {
58− // nothing for now...
25+ qScriptRegisterMetaType(engine, SpatialEvent::toScriptValue, SpatialEvent::fromScriptValue);
5926 }

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