diff options
author | Oleg Yadrov <oleg.yadrov@qt.io> | 2016-10-17 16:09:52 -0700 |
---|---|---|
committer | Oleg Yadrov <oleg.yadrov@qt.io> | 2016-10-28 22:34:28 +0000 |
commit | 59fc9863568456e3a5113f5633354d8d0fad00be (patch) | |
tree | be7d1a3600d64d84a25812ce11cfa586efbcd4da /examples/qt3d/planets-qml/planets.js | |
parent | 8be45352146be822e45e9d563d8e74687fa0fd0e (diff) |
Port Planets QML example to Apple TV
Change-Id: I254cbc1643fcb5b67af8338c0b7adc8c25829f9d
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Diffstat (limited to 'examples/qt3d/planets-qml/planets.js')
-rw-r--r-- | examples/qt3d/planets-qml/planets.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/examples/qt3d/planets-qml/planets.js b/examples/qt3d/planets-qml/planets.js index 0534d86ab..f64ec3149 100644 --- a/examples/qt3d/planets-qml/planets.js +++ b/examples/qt3d/planets-qml/planets.js @@ -48,6 +48,8 @@ ** ****************************************************************************/ +.pragma library + var SUN = 0; var MERCURY = 1; var VENUS = 2; @@ -61,6 +63,56 @@ var NUM_SELECTABLE_PLANETS = 9; var MOON = 9; var SOLAR_SYSTEM = 100; +function planetId(planetName) { + switch (planetName) { + case "Sun": + return SUN + case "Mercury": + return MERCURY + case "Venus": + return VENUS + case "Earth": + return EARTH + case "Mars": + return MARS + case "Jupiter": + return JUPITER + case "Saturn": + return SATURN + case "Uranus": + return URANUS + case "Neptune": + return NEPTUNE + case "Solar System": + return SOLAR_SYSTEM + } +} + +function planetIndex(planetName) { + switch (planetName) { + case "Sun": + return 0 + case "Mercury": + return 1 + case "Venus": + return 2 + case "Earth": + return 3 + case "Mars": + return 4 + case "Jupiter": + return 5 + case "Saturn": + return 6 + case "Uranus": + return 7 + case "Neptune": + return 8 + case "Solar System": + return 9 + } +} + var planets = []; // Planet data info var solarDistance = 2600000; |