Window close with mouse
From VbGORE Visual Basic Online RPG Engine
Don't want to have your users press Esc to close their menus all the time? Plus sometimes they don't know which is the active window so instead of closing the window they end up opening the main menu. Well no more!
Step 1) edit the window Grh that you want to have a close button on: I'm going to use the Quest Window for my example.
Before...
And after...
Now note the x, y, width, and height of where you placed the X. I usually like to have it go all the way to the end of the image when it's close to the edge.
Now open up GameClient.vbp in the TileEngine.bas file find Engine_Render_GUI_Window
Now find the case that represents the window you added the X too. At the end of the case (right before the End With) put in this code, but note the changes:
If Engine_Collision_Rect(MousePos.X, MousePos.Y, 1, 1, .Screen.X + '''''start x of close button(in my case 105)''''', .Screen.Y + '''''start x of close button (in my case 0)''''', '''''width (in my case 23)''''', '''''height (in my case 23)''''') Then If MouseLeftDown > 0 Then ShowGameWindow(LastClickedWindow) = 0 LastClickedWindow = 0 Exit Sub End If End If
There ya go, simple as 3.14.



