GUI - Relational Coordinates
- Problem: Most of the time we want a control to be a certain distance away from another control, or the same width, or stretching the area between two controls with a 5 pixel border, rather than positioned at a specific coordinate.
- Solution: The GUIObject names of other controls can be referenced when setting a size property. eg size="OtherObject.left+30 10 OuterBox.right-5 40"
- The upgraded size property would need to support:
- Object names (including sprites; see below) as variables (to save the overhead of referring to them as getGUIObjectByName(objectName).size.x1; as in your example, it would use objectName.x1);
- Retrieving any of the properties of a size, including x1, x2, y1, y2, rx1, rx2, ry1, ry2, left, top, right, bottom. I'd suggest also a few other precalculated values to save time (eg width (x2-x1) and height (y2-y1));
- Simple operators (so that coordinates from other controls can be added/subtracted together);
- Numeric values (so that, in the case of that control with a 5-pixel border, we can +/- 5 on the appropriate sides);
- Common JS variables would be good (eg adding the value of a constant), but not essential;
Change History
(4)
Owner: |
set to gustav
|
Summary: |
Relational Coordinates → GUI - Relational Coordinates
|
Milestone: |
Diplomacy Demo
|
Milestone Diplomacy Demo deleted