31
Technical forum / Re: SetCursor() too slow in game_loop.script
« on: November 14, 2008, 01:34:33 AM »
yeah that seems to be the "clean" way, like you said but it also sounds like much of script-code.
i have implemented the cursor handle (for now) in the game.script:
allActions is my array with all possible events and the belonging mouse cursors.
in the mouse-leave/entry events of the objects i reset the cursor/set the default cursor.
i have implemented the cursor handle (for now) in the game.script:
Code: [Select]
...
// item-sensitiven cursor setzen
else if(ActObj != null) {
var i=1;
var found=false;
var actualCursor = ActObj.GetCursor();
while(i<allActions.Length) { //suche postion in allActions...
if(actualCursor == allActions[i]) {
found=true;
break;
}
i=i+2;
}
if (found) { //...wenn gefunden...
if(i==allActions.Length-1) i=1;
else i=i+2;
while(i<allActions.Length) { //...setze cursor für nächste, mögliche action
if(ActObj.CanHandleEvent(allActions[i-1])) {
ActObj.SetCursor(allActions[i]);
i=allActions.Length+1;
}
else if(i==allActions.Length-1) i=-1;
i=i+2;
}
}
else ActObj.ApplyEvent("RightClick");
}
allActions is my array with all possible events and the belonging mouse cursors.
Code: [Select]
global allActions = new Array
("LookAt", "sprites\system\lupe.sprite",
"Take", "sprites\system\hand.sprite",
"Talk", "sprites\system\sprechblase.sprite",
"Record", "sprites\system\record.sprite",
"Open", "sprites\system\open.sprite"
);
in the mouse-leave/entry events of the objects i reset the cursor/set the default cursor.