1991mirec
Member
|
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 |
|
Rubeus
Member
|
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 |
|
TBJokers
Member
|
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 |
|
1991mirec
Member
|
RE: window
thanks both of you..
|
|
11-06-2013 05:50 PM |
|