About Store Forum Documentation Contact



Post Reply 
window
Author Message
1991mirec Offline
Member

Post: #1
window
hey
is there a way how to make the gui window to not go out of the app window if it is movable? for example if i have invenory and it is movable can i make so it stopes at the edge of the screen??
thank you
11-06-2013 03:00 PM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #2
RE: window
My take would be to check the position each frame, and set it back to the max/min x/y if it exceeds/deceeds the set limits.
You could also use the app flag(I forget which it is) that locks the mouse to the application window, so at the very least 1 pixel would still be showing.
11-06-2013 04:13 PM
Find all posts by this user Quote this message in a reply
TBJokers Offline
Member

Post: #3
RE: window
Make your window movement code yourself ->

Code:
if(Ms.test(myWindow.screenRect() + Rect_RU(0,0,-myWindow.screenRect().h/12,0))){ //if ms is at the top of the window.
     if(Ms.b(0)){
          Rect rect = myWindow.screenRect();
          Vec2 position = myWindow.screenPos();
          //check if window position plus height goes beyond D.h(), same with width.
          if((position + Vec2(0,rect.h())) < D.h() && (position + Vec2(rect.w(),0)) < D.w())myWindow.move(Ms.d());
     }
}
i have by no means tested this code, it is a pure idea!
(This post was last modified: 11-06-2013 04:53 PM by TBJokers.)
11-06-2013 04:52 PM
Visit this user's website Find all posts by this user Quote this message in a reply
1991mirec Offline
Member

Post: #4
RE: window
thanks both of you..
11-06-2013 05:50 PM
Find all posts by this user Quote this message in a reply
Post Reply