Page 1 of 1

GUI optimization

Posted: Tue Jul 01, 2008 2:22 pm
by milipili
During a game, the user can click on a button on the left. But only if the X-coordinate of the mouse is below a threshold, which is the width of the left-anchored panel.
How can we test this condition ? (using the variable mouse_x I suppose and if possible without a hard-coded value)

Posted: Tue Jul 01, 2008 3:35 pm
by zuzuf
you could test if the cursor is on a window of the GUI system but it would only work in 640x480 because the panel height isn't infinite. You could also get the width of the panel from its WND object but you'll need to know which object it is which isn't obvious if you don't hard-code it somewhere ...

If you don't like hard-coding the panel width you can add it as a variable in ta3d.mod for example (so mods can change it) and give it a default value of 128 which is the one used in TA.