Get the coordinates of the screen corner
2 posts • Page 1 of 1
Get the coordinates of the screen corner
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.
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
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!
(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
2 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 4 guests