Changes between Version 1 and Version 2 of GUI_-_Data_Types
- Timestamp:
- Mar 22, 2015, 11:02:06 AM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GUI_-_Data_Types
v1 v2 8 8 Just a plain integer such as "-10" or "1024". If you enter in the form of a float value it will work too, but it will be cast to an integer with regular C++ truncation. 9 9 == float == 10 Float value, like "2.32" or ".0001". If you input it in the form of an integer that �s fine too.10 Float value, like "2.32" or ".0001". If you input it in the form of an integer that's fine too. 11 11 == bool == 12 12 A boolean value can be either 1 or 0, on or off. These values can be set to "true" or "false" (case sensitive). … … 41 41 === Examples === 42 42 The client area is a bit confusing at first, but once you understand its concept, it's not so intimidating. 43 The GUISize Properties are a bit confusing at first, but once you understand them they aren �t so intimidating. As you will later see, the client area not only accounts for the size of the object, but also its position.43 The GUISize Properties are a bit confusing at first, but once you understand them they aren't so intimidating. As you will later see, the client area not only accounts for the size of the object, but also its position. 44 44 45 45 The most commonly used client area is the object's [wiki:GUI_-_Properties#size size] property, let's use this as basis for our example. … … 83 83 }}} 84 84 85 �Relative� means relative to the parent object�s properties.85 'Relative' means relative to the parent object's properties. 86 86 87 87 Now that this is clear as mud, lets try some examples. … … 100 100 This spaces the object 80 pixels away from the top left corner of the 800x600 screen, giving us a box that is 640px wide and 440px tall. 101 101 102 A potential issue with this method is that if the screen resolution changed, �Box 1� would always be this size relative to the top left corner of the screen. So if the screen resolution was changed to 1024x768, �Box 1�would remain 640x440 in size, and it would stay 80 pixels from the left and 80 pixels from the top.102 A potential issue with this method is that if the screen resolution changed, 'Box 1' would always be this size relative to the top left corner of the screen. So if the screen resolution was changed to 1024x768, 'Box 1' would remain 640x440 in size, and it would stay 80 pixels from the left and 80 pixels from the top. 103 103 104 104 ''Option 2:'' … … 114 114 What if we wanted the box to always remain the same size, and if we wanted it to remain in the center of the screen? For this, we will need to use a mixture of both the relative percentages and the absolute pixels. Here is the answer: "50%-320 50%+220 50%+320 50%-220" 115 115 116 Let �s break it down. The relative portion (50% 50% 50% 50%) is basically just defining a point on the screen; there is no area involved. All four corners of that rectangle are exactly the middle of the parent object (in our case the screen).116 Let's break it down. The relative portion (50% 50% 50% 50%) is basically just defining a point on the screen; there is no area involved. All four corners of that rectangle are exactly the middle of the parent object (in our case the screen). 117 117 118 118 We need to open the rectangle back up with the absolute pixel offsets. We can do this by looking at the absolute portion (-320 +220 +320 -220) (Remember left and down is negative, and up and right is positive in math class) This is saying that the left size is going to be defined 320 pixels to the left of the relative position. The top is 220 pixels above the relative position. The right is 320 pixels to the right and the bottom is 220 pixels down. … … 120 120 '''Box 2''' 121 121 122 That wasn �t so bad was it? Lets do another, and let�s assume we went with Option 3 for �Box 1� and that �Box 2� is a child of �Box 1�. This means that our box we are working with will always be in the center of the screen and it will always be 640x440. Knowing that �Box 1� is pretty absolute, it probably won�t hurt to make �Box 2�absolute either by doing this: "80 80 400 160"122 That wasn't so bad was it? Lets do another, and let's assume we went with Option 3 for 'Box 1' and that 'Box 2' is a child of 'Box 1'. This means that our box we are working with will always be in the center of the screen and it will always be 640x440. Knowing that 'Box 1' is pretty absolute, it probably won't hurt to make 'Box 2' absolute either by doing this: "80 80 400 160" 123 123 124 Not too bad; notice also that it is not "160 160 480 240". Why? Because the parent of �Box 2� is not the screen, it is �Box 1�.124 Not too bad; notice also that it is not "160 160 480 240". Why? Because the parent of 'Box 2' is not the screen, it is 'Box 1'. 125 125 126 126 '''Box 3''' 127 127 128 We would probably want to make this absolute also, but for fun let �s make it relative in some weird ways.128 We would probably want to make this absolute also, but for fun let's make it relative in some weird ways. 129 129 130 Let �s say I want to make it relative to the top left of �Box 3�. To make it easy, I�ll just count squares when doing my math.130 Let's say I want to make it relative to the top left of 'Box 3'. To make it easy, I'll just count squares when doing my math. 131 131 132 132 The parent (Box 1) is 16x11, the top left corner is 12x2 so 12/16=75% and 2/11=18.181818%. … … 134 134 Left and right are going to use the 75% and top and bottom the 5.5%; that gives me "75% 18.181818% 75% 18.181818%". 135 135 136 Because I �m using the top left of "Box 3", I�m going to need to expand my �point� to the right 80 and down 80 which gives me: "0 0 +80 -80". I�ll put it together, and do a few other variations:136 Because I'm using the top left of "Box 3", I'm going to need to expand my 'point' to the right 80 and down 80 which gives me: "0 0 +80 -80". I'll put it together, and do a few other variations: 137 137 138 Relative to the top left of �Box 3�: "75% 18.181818% 75%+80 18.181818%-80%" (no need for 0�s)138 Relative to the top left of 'Box 3': "75% 18.181818% 75%+80 18.181818%-80%" (no need for 0's) 139 139 140 140 Relative to the middle of "Box 3": "81.25%-40 27.272727%+40 81.25%+40 27.272727%-40" … … 144 144 '''Box 4''' 145 145 146 Let �s hypothetically make this one expand horizontally, but be locked to 80 pixels in height. I�m going to want my left and right edges relative, and my top and bottom absolute. Here is how it looks: "31.25% 240 68.75% 320"146 Let's hypothetically make this one expand horizontally, but be locked to 80 pixels in height. I'm going to want my left and right edges relative, and my top and bottom absolute. Here is how it looks: "31.25% 240 68.75% 320"