GUI optimization

Everything related to the code /
Tout ce qui touche au code
Post Reply
Posts: 545
Joined: Thu Nov 02, 2006 8:52 am
Location: Paris (France)

GUI optimization

Post by milipili » Tue Jul 01, 2008 2:22 pm

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)
Damien Gerard
Ta3d & Yuni Developer

User avatar
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France

Post by zuzuf » Tue Jul 01, 2008 3:35 pm

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.
=>;-D Penguin Powered

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests