Просмотр исходного кода

Fixes displaced joystick sometimes seen on start-up when using virtual gamepad.

Ken Whatmough 13 лет назад
Родитель
Сommit
764eb219b7
2 измененных файлов с 14 добавлено и 0 удалено
  1. 9 0
      gameplay/src/Form.cpp
  2. 5 0
      gameplay/src/Form.h

+ 9 - 0
gameplay/src/Form.cpp

@@ -99,6 +99,8 @@ Form* Form::create(const char* id, Theme::Style* style, Layout::Type layoutType)
     Game* game = Game::getInstance();
     Matrix::createOrthographicOffCenter(0, game->getWidth(), game->getHeight(), 0, 0, 1, &form->_defaultProjectionMatrix);
 
+    form->updateBounds();
+
     __forms.push_back(form);
 
     return form;
@@ -200,6 +202,8 @@ Form* Form::create(const char* url)
     form->addControls(theme, formProperties);
 
     SAFE_DELETE(properties);
+    
+    form->updateBounds();
 
     __forms.push_back(form);
 
@@ -403,6 +407,11 @@ void Form::setNode(Node* node)
 }
 
 void Form::update(float elapsedTime)
+{
+    updateBounds();
+}
+
+void Form::updateBounds()
 {
     if (isDirty())
     {

+ 5 - 0
gameplay/src/Form.h

@@ -183,6 +183,11 @@ private:
      */
     void initializeQuad(Mesh* mesh);
 
+    /**
+     * Update this form's bounds.
+     */
+    void updateBounds();
+
     /**
      * Propagate touch events to enabled forms.
      *