mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-17 17:16:49 +02:00
commit
542a5f100a
2 changed files with 26 additions and 1 deletions
25
examples/example/games/airHockey.js
Normal file → Executable file
25
examples/example/games/airHockey.js
Normal file → Executable file
|
@ -83,6 +83,30 @@ var puck_name_index = 2;
|
|||
var light_name_index = 3;
|
||||
var floor_name_index = 4;
|
||||
|
||||
//Create Spawn and Del. Button Vars.
|
||||
|
||||
function updateButtonPosition() {
|
||||
Overlays.editOverlay(spawnButton, {
|
||||
x: screenSize.x / 2 + PADDING,
|
||||
y: screenSize.y - (BUTTON_SIZE * 2 + PADDING),
|
||||
});
|
||||
Overlays.editOverlay(deleteButton, {
|
||||
x: screenSize.x / 2 - BUTTON_SIZE,
|
||||
y: screenSize.y - (BUTTON_SIZE * 2 + PADDING),
|
||||
});
|
||||
}
|
||||
|
||||
function onScriptUpdate() {
|
||||
var oldScreenSize = screenSize;
|
||||
|
||||
screenSize = Controller.getViewportDimensions();
|
||||
|
||||
if (screenSize.x !== oldScreenSize.x || screenSize.y !== oldScreenSize.y) {
|
||||
updateButtonPosition();
|
||||
}
|
||||
}
|
||||
|
||||
screenSize = Controller.getViewportDimensions();
|
||||
|
||||
var deleteButton = Overlays.addOverlay("image", {
|
||||
x: screenSize.x / 2 - BUTTON_SIZE,
|
||||
|
@ -112,6 +136,7 @@ var spawnButton = Overlays.addOverlay("image", {
|
|||
alpha: 1
|
||||
});
|
||||
|
||||
Script.update.connect(onScriptUpdate);
|
||||
|
||||
|
||||
var floor, edge1, edge2, edge3a, edge3b, edge4a, edge4b, light;
|
||||
|
|
|
@ -493,7 +493,7 @@ void ScriptEngine::evaluate() {
|
|||
|
||||
QScriptValue result = evaluate(_scriptContents);
|
||||
|
||||
// TODO: why do we check this twice? It seems like the call to clearExcpetions() in the lower level evaluate call
|
||||
// TODO: why do we check this twice? It seems like the call to clearExceptions() in the lower level evaluate call
|
||||
// will cause this code to never actually run...
|
||||
if (hasUncaughtException()) {
|
||||
int line = uncaughtExceptionLineNumber();
|
||||
|
|
Loading…
Reference in a new issue