About Store Forum Documentation Contact



Post Reply 
the origin of coordinates.
Author Message
mizukami Offline
Member

Post: #1
the origin of coordinates.
i want to resize app window (or more widely setting, VGA to XGA or higher).
"APP_RESIZABLE" acts only stretching window. So, i tested with following code.

Code:
void ScreenChanged(flt old_width=D.w(), flt old_height=D.h())
{
   flt scale=1;
   D.scale(scale*950/(D.resH()*1.6));
}
void InitPre()
{
   D.screen_changed=ScreenChanged;

it works generally. But GUI parts are being centered (of window).
Perhaps, the origin of coordinates is always center of window in any case.
Can i change it?
04-27-2016 04:28 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: the origin of coordinates.
Hi,

Here you can find some information about GUI coordinates:
http://www.esenthel.com/?id=doc#Screen_Coordinates

Desktop center is always at Vec2(0,0) and cannot be changed.

You can manually reposition GUI elements inside ScreenChanged function.

For example - don't set 'rect' during one-time GUI Object creation, but set 'rect' only inside 'ScreenChanged'

Code:
Button b;
void CreateGui()
{
   Gui+=b.create(); // no need to set 'rect' here
}
void ScreenChanged(flt old_width=D.w(), flt old_height=D.h())
{
   flt scale=1;
   D.scale(scale*950/(D.resH()*1.6));
   b.rect(Rect(..)); // <- you can set this based on D.scale, D.w, D.h, etc.
}
04-27-2016 11:35 AM
Find all posts by this user Quote this message in a reply
mizukami Offline
Member

Post: #3
RE: the origin of coordinates.
(04-27-2016 11:35 AM)Esenthel Wrote:  You can manually reposition GUI elements inside ScreenChanged function.

oh. do so for all GUIs...
thank you.
04-28-2016 03:41 AM
Find all posts by this user Quote this message in a reply
Post Reply