Changes between Version 1 and Version 2 of GUI_-_Data_Types


Ignore:
Timestamp:
Mar 22, 2015, 11:02:06 AM (9 years ago)
Author:
sanderd17
Comment:

Fix single quotes

Legend:

Unmodified
Added
Removed
Modified
  • GUI_-_Data_Types

    v1 v2  
    88Just 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.
    99== float ==
    10 Float value, like "2.32" or ".0001". If you input it in the form of an integer thats fine too.
     10Float value, like "2.32" or ".0001". If you input it in the form of an integer that's fine too.
    1111== bool ==
    1212A boolean value can be either 1 or 0, on or off. These values can be set to "true" or "false" (case sensitive).
     
    4141=== Examples ===
    4242The 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 arent so intimidating.  As you will later see, the client area not only accounts for the size of the object, but also its position.
     43The 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.
    4444
    4545The most commonly used client area is the object's [wiki:GUI_-_Properties#size size] property, let's use this as basis for our example.
     
    8383}}}
    8484
    85 �Relative� means relative to the parent object�s properties.
     85'Relative' means relative to the parent object's properties.
    8686
    8787Now that this is clear as mud, lets try some examples.
     
    100100This 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.
    101101
    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.
     102A 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.
    103103
    104104''Option 2:''
     
    114114What 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"
    115115
    116 Lets 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). 
     116Let'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). 
    117117
    118118We 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.
     
    120120'''Box 2'''
    121121
    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"
     122That 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"
    123123
    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�.
     124Not 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'.
    125125
    126126'''Box 3'''
    127127
    128 We would probably want to make this absolute also, but for fun lets make it relative in some weird ways.
     128We would probably want to make this absolute also, but for fun let's make it relative in some weird ways.
    129129
    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. 
     130Let'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. 
    131131
    132132The parent (Box 1) is 16x11, the top left corner is 12x2 so 12/16=75% and 2/11=18.181818%. 
     
    134134Left and right are going to use the 75% and top and bottom the 5.5%; that gives me "75% 18.181818% 75% 18.181818%". 
    135135
    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:
     136Because 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:
    137137
    138 Relative to the top left of �Box 3�: "75% 18.181818% 75%+80 18.181818%-80%" (no need for 0�s)
     138Relative to the top left of 'Box 3': "75% 18.181818% 75%+80 18.181818%-80%" (no need for 0's)
    139139
    140140Relative to the middle of "Box 3": "81.25%-40 27.272727%+40 81.25%+40 27.272727%-40"
     
    144144'''Box 4'''
    145145
    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"
     146Let'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"