2
0
Эх сурвалжийг харах

Merge pull request #160 from blackberry-gaming/next-ablake

Next ablake: Fixes for Forms.
Steve Grenier 14 жил өмнө
parent
commit
bc5d8188fd

+ 12 - 2
gameplay/src/Button.cpp

@@ -18,10 +18,20 @@ namespace gameplay
     {
         Button* button = new Button();
         button->_style = style;
-        button->_id = properties->getId();
         properties->getVector2("position", &button->_position);
         properties->getVector2("size", &button->_size);
-        button->_text = properties->getString("text");
+
+        const char* id = properties->getId();
+        if (id)
+        {
+            button->_id = id;
+        }
+
+        const char* text = properties->getString("text");
+        if (text)
+        {
+            button->_text = text;
+        }
 
         __buttons.push_back(button);
 

+ 12 - 2
gameplay/src/CheckBox.cpp

@@ -24,11 +24,21 @@ CheckBox* CheckBox::create(Theme::Style* style, Properties* properties)
 {
     CheckBox* checkbox = new CheckBox();
     checkbox->_style = style;
-    checkbox->_id = properties->getId();
     properties->getVector2("position", &checkbox->_position);
     properties->getVector2("size", &checkbox->_size);
     checkbox->_checked = properties->getBool("checked");
-    checkbox->_text = properties->getString("text");
+
+    const char* id = properties->getId();
+    if (id)
+    {
+        checkbox->_id = id;
+    }
+
+    const char* text = properties->getString("text");
+    if (text)
+    {
+        checkbox->_text = text;
+    }
 
     __checkBoxes.push_back(checkbox);
 

+ 5 - 5
gameplay/src/Control.cpp

@@ -153,12 +153,12 @@ namespace gameplay
                 spriteBatch->draw(rightX, pos.y, border.right, border.top, topRight.u1, topRight.v1, topRight.u2, topRight.v2, borderColor);
             if (border.left)
                 spriteBatch->draw(pos.x, midY, border.left, midHeight, left.u1, left.v1, left.u2, left.v2, borderColor);
-            if (border.left && border.right && border.top && border.bottom)
-                spriteBatch->draw(pos.x + border.left, pos.y + border.top, _size.x - border.left - border.right, _size.y - border.top - border.bottom,
-                              center.u1, center.v1, center.u2, center.v2, borderColor);
+            
+            spriteBatch->draw(pos.x + border.left, pos.y + border.top, _size.x - border.left - border.right, _size.y - border.top - border.bottom,
+                center.u1, center.v1, center.u2, center.v2, borderColor);
+
             if (border.right)
-                spriteBatch->draw(rightX, midY, border.right, midHeight,
-                              right.u1, right.v1, right.u2, right.v2, borderColor);
+                spriteBatch->draw(rightX, midY, border.right, midHeight, right.u1, right.v1, right.u2, right.v2, borderColor);
             if (border.bottom && border.left)
                 spriteBatch->draw(pos.x, bottomY, border.left, border.bottom, bottomLeft.u1, bottomLeft.v1, bottomLeft.u2, bottomLeft.v2, borderColor);
             if (border.bottom)

+ 12 - 2
gameplay/src/Label.cpp

@@ -21,10 +21,20 @@ namespace gameplay
     {
         Label* label = new Label();
         label->_style = style;
-        label->_id = properties->getId();
         properties->getVector2("position", &label->_position);
         properties->getVector2("size", &label->_size);
-        label->_text = properties->getString("text");
+
+        const char* id = properties->getId();
+        if (id)
+        {
+            label->_id = id;
+        }
+
+        const char* text = properties->getString("text");
+        if (text)
+        {
+            label->_text = text;
+        }
 
         __labels.push_back(label);
 

+ 1 - 1
gameplay/src/Plane.h

@@ -45,7 +45,7 @@ public:
      * Constructs a new plane from the specified values.
      *
      * @param normal The normal vector of this plane.
-     * @param distance The distance to this plane along its (unit) normal to the origin.
+     * @param distance The distance from this plane along its (unit) normal to the origin.
      */
     Plane(const Vector3& normal, float distance);
 

+ 18 - 3
gameplay/src/RadioButton.cpp

@@ -24,17 +24,32 @@ RadioButton* RadioButton::create(Theme::Style* style, Properties* properties)
 {
     RadioButton* radioButton = new RadioButton();
     radioButton->_style = style;
-    radioButton->_id = properties->getId();
     properties->getVector2("position", &radioButton->_position);
     properties->getVector2("size", &radioButton->_size);
-    radioButton->_text = properties->getString("text");
-    radioButton->_groupId = properties->getString("group");
     if (properties->getBool("selected"))
     {
         RadioButton::clearSelected(radioButton->_groupId);
         radioButton->_selected = true;
     }
 
+    const char* id = properties->getId();
+    if (id)
+    {
+        radioButton->_id = id;
+    }
+
+    const char* text = properties->getString("text");
+    if (text)
+    {
+        radioButton->_text = text;
+    }
+
+    const char* groupId = properties->getString("group");
+    if (groupId)
+    {
+        radioButton->_groupId = groupId;
+    }
+
     __radioButtons.push_back(radioButton);
 
     return radioButton;

+ 12 - 2
gameplay/src/Slider.cpp

@@ -18,14 +18,24 @@ Slider* Slider::create(Theme::Style* style, Properties* properties)
     Slider* slider = new Slider();
 
     slider->_style = style;
-    slider->_id = properties->getId();
     properties->getVector2("position", &slider->_position);
     properties->getVector2("size", &slider->_size);
     slider->_min = properties->getFloat("min");
     slider->_max = properties->getFloat("max");
     slider->_value = properties->getFloat("value");
     slider->_step = properties->getFloat("step");
-    slider->_text = properties->getString("text");
+
+    const char* id = properties->getId();
+    if (id)
+    {
+        slider->_id = id;
+    }
+
+    const char* text = properties->getString("text");
+    if (text)
+    {
+        slider->_text = text;
+    }
 
     __sliders.push_back(slider);
 

+ 12 - 2
gameplay/src/TextBox.cpp

@@ -22,10 +22,20 @@ TextBox* TextBox::create(Theme::Style* style, Properties* properties)
 {
     TextBox* textBox = new TextBox();
     textBox->_style = style;
-    textBox->_id = properties->getId();
     properties->getVector2("position", &textBox->_position);
     properties->getVector2("size", &textBox->_size);
-    textBox->_text = properties->getString("text");
+
+    const char* id = properties->getId();
+    if (id)
+    {
+        textBox->_id = id;
+    }
+
+    const char* text = properties->getString("text");
+    if (text)
+    {
+        textBox->_text = text;
+    }
 
     __textBoxes.push_back(textBox);
     return textBox;