Browse Source

Changing the default setting of consumeInputEvents to 'true' for all controls.
Tweaking the forms in the sample browser and particles sample, as well as virtual gamepad behaviour, accordingly.

ablake 12 years ago
parent
commit
138e47d8b7

+ 1 - 5
gameplay/src/Container.cpp

@@ -1643,11 +1643,7 @@ bool Container::pointerEvent(bool mouse, char evt, int x, int y, int data)
     }
 
     release();
-    if (x > _clipBounds.x && x <= _clipBounds.x + _clipBounds.width &&
-        y > _clipBounds.y && y <= _clipBounds.y + _clipBounds.height)
-        return (_consumeInputEvents | eventConsumed);
-    else
-        return eventConsumed;
+    return (_consumeInputEvents | eventConsumed);
 }
 
 Container::Scroll Container::getScroll(const char* scroll)

+ 2 - 2
gameplay/src/Control.cpp

@@ -7,7 +7,7 @@ namespace gameplay
 
 Control::Control()
     : _id(""), _state(Control::NORMAL), _bounds(Rectangle::empty()), _clipBounds(Rectangle::empty()), _viewportClipBounds(Rectangle::empty()),
-    _clearBounds(Rectangle::empty()), _dirty(true), _consumeInputEvents(true), _alignment(ALIGN_TOP_LEFT), _isAlignmentSet(false), _autoWidth(false), _autoHeight(false), _listeners(NULL), _visible(true),
+    _clearBounds(Rectangle::empty()), _dirty(true), _consumeInputEvents(false), _alignment(ALIGN_TOP_LEFT), _isAlignmentSet(false), _autoWidth(false), _autoHeight(false), _listeners(NULL), _visible(true),
     _zIndex(-1), _contactIndex(INVALID_CONTACT_INDEX), _focusIndex(-1), _parent(NULL), _styleOverridden(false), _skin(NULL)
 {
     addScriptEvent("controlEvent", "<Control>[Control::Listener::EventType]");
@@ -41,7 +41,7 @@ void Control::initialize(Theme::Style* style, Properties* properties)
     _autoWidth = properties->getBool("autoWidth");
     _autoHeight = properties->getBool("autoHeight");
 
-    _consumeInputEvents = properties->getBool("consumeInputEvents", true);
+    _consumeInputEvents = properties->getBool("consumeInputEvents", false);
 
     _visible = properties->getBool("visible", true);
 

+ 1 - 1
gameplay/src/Form.cpp

@@ -151,7 +151,7 @@ Form* Form::create(const char* url)
     }
     form->initialize(style, formProperties);
 
-    form->_consumeInputEvents = formProperties->getBool("consumeInputEvents", true);
+    form->_consumeInputEvents = formProperties->getBool("consumeInputEvents", false);
 
     // Alignment
     if ((form->_alignment & Control::ALIGN_BOTTOM) == Control::ALIGN_BOTTOM)

+ 2 - 0
gameplay/src/Gamepad.cpp

@@ -140,12 +140,14 @@ void Gamepad::bindGamepadControls(Container* container)
         else if (std::strcmp("joystick", control->getType()) == 0)
         {
             Joystick* joystick = (Joystick*)control;
+            joystick->setConsumeInputEvents(true);
             _uiJoysticks[joystick->getIndex()] = joystick;
             _joystickCount++;
         }
         else if (std::strcmp("button", control->getType()) == 0)
         {
             Button* button = (Button*)control;
+            button->setConsumeInputEvents(true);
             _uiButtons[button->getDataBinding()] = button;
             _buttonCount++;
         }

+ 1 - 0
samples/browser/res/common/forms/formBasicControls.form

@@ -4,6 +4,7 @@ form basicControls
     layout = LAYOUT_ABSOLUTE
     style = basic
     size = 600, 600
+	consumeInputEvents = true
     	
 	label title
 	{

+ 1 - 0
samples/browser/res/common/forms/formFlowLayout.form

@@ -5,6 +5,7 @@ form flowLayout
     style = basic
     size = 600, 600
     scroll = SCROLL_BOTH
+	consumeInputEvents = true
 
     label label1
     {

+ 1 - 0
samples/browser/res/common/forms/formScrolling.form

@@ -6,6 +6,7 @@ form scrolling
     size = 600, 600
     scroll = SCROLL_BOTH
     scrollBarsAutoHide = true
+	consumeInputEvents = true
 
     label label1
     {

+ 1 - 0
samples/browser/res/common/forms/formSelect.form

@@ -6,6 +6,7 @@ form formSelect
     alignment = ALIGN_TOP_LEFT
     width = 200
     autoHeight = true
+	consumeInputEvents = true
 
 	radioButton form0
 	{

+ 1 - 0
samples/browser/res/common/forms/formVerticalLayout.form

@@ -5,6 +5,7 @@ form verticalLayout
     style = basic
     size = 600, 600
     scroll = SCROLL_BOTH
+	consumeInputEvents = true
 
     label label2
     {

+ 2 - 1
samples/browser/res/common/forms/formZOrder.form

@@ -4,7 +4,8 @@ form zOrder
     style = basic
     size = 600, 600
     scroll = SCROLL_BOTH
-
+	consumeInputEvents = true
+	
     label label1
     {
         style = basic

+ 4 - 1
samples/particles/res/editor.form

@@ -10,6 +10,7 @@ form particleEditor
         layout = LAYOUT_VERTICAL
         position = 0, 0
         size = 160, 220
+        consumeInputEvents = true
 
         label title
         {
@@ -56,6 +57,7 @@ form particleEditor
         position = 0, 220
         layout = LAYOUT_VERTICAL
         size = 160, 210
+        consumeInputEvents = true
 
         // Burst emission
         button emit
@@ -108,6 +110,7 @@ form particleEditor
         style = noBorder
         size = 160, 50
         position = 0, 430
+        consumeInputEvents = true
 
         button zoomIn
         {
@@ -132,6 +135,7 @@ form particleEditor
         layout = LAYOUT_VERTICAL
         scroll = SCROLL_VERTICAL
         scrollBarsAutoHide = false
+        consumeInputEvents = true
 
         // Particle Size
         label titleSize
@@ -155,7 +159,6 @@ form particleEditor
             valueTextVisible = true
             valueTextAlignment = ALIGN_BOTTOM_HCENTER
             valueTextPrecision = 2
-            consumeInputEvents = false
         }
 
         slider startMax : startMin