Get the coordinates of the screen corner

About advanced scenes, and the Thyme scripting language used in Algodoo.

Get the coordinates of the screen corner

Postby dobili » Fri Jun 12, 2015 6:03 pm

Hi guys,

I have a little problem. I want an object to be attached to the upper right corner of the screen and for that I need the coordinates of the corner. Not that difficult, would you say? It's just system.camera.pan + an offset! Well the offset is the problem here. It scales with system.camera.zoom and the root container size, but I can't read out the root container size and the value of system.resolution is not reliable. For example, you can scale down your window to [800,600] , then switch back to fullscreen and the value of system.resolution will stay at [800,600].

Another question. Can I read out clickevents while the simulation is not running? I would need onClickrelease.
dobili
 
Posts: 9
Joined: Tue May 26, 2015 10:52 pm

Re: Get the coordinates of the screen corner

Postby Silent Bender » Tue Aug 25, 2015 6:33 am

drop this into the update codebox of any object:

(e)=>{
e.this.color = keys.isDown("mouse_left") ? [1, 1, 1, 1] : [1, 1, 1, 0]
}

it will change its color if left mouse button is clicked anywhere on the scene even if its NOT running!
Silent Bender
 
Posts: 2
Joined: Fri Apr 25, 2014 3:19 am


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 4 guests

cron