Explorar o código

Picking works now. Fixed an issue with containers sometimes not showing up.

Adam Blake %!s(int64=14) %!d(string=hai) anos
pai
achega
a5347b3cfa
Modificáronse 4 ficheiros con 9 adicións e 15 borrados
  1. 8 9
      gameplay/src/Form.cpp
  2. 0 4
      gameplay/src/SpriteBatch.cpp
  3. 1 1
      gameplay/src/Theme.cpp
  4. 0 1
      gameplay/src/Theme.h

+ 8 - 9
gameplay/src/Form.cpp

@@ -301,9 +301,6 @@ namespace gameplay
             Node* node = form->_node;
             if (node)
             {
-                // Work in progress: Picking within 3D forms.
-
-                /*
                 Scene* scene = node->getScene();
                 Camera* camera = scene->getActiveCamera();
 
@@ -350,14 +347,16 @@ namespace gameplay
 
                         // If the resulting point lies within the quad,
                         // project it into the form's space.
-
-
-                        // Projection from point (C) on plane with normal n containing point P.
-                        Vector3 cp(point, min);
-
+                        m.invert();
+                        m.transformPoint(&point);
+
+                        if (point.x >= 0 && point.x <= size.x &&
+                            point.y >= 0 && point.y <= size.y)
+                        {
+                            form->touchEvent(evt, point.x, size.y - point.y, contactIndex);
+                        }
                     }
                 }
-                */
             }
             else
             {

+ 0 - 4
gameplay/src/SpriteBatch.cpp

@@ -125,10 +125,6 @@ SpriteBatch* SpriteBatch::create(Texture* texture, Effect* effect, unsigned int
 
     // Wrap the effect in a material
     Material* material = Material::create(effect); // +ref effect
-    if (effect == __spriteEffect)
-    {
-        effect->release();
-    }
 
     // Set initial material state
     material->getStateBlock()->setBlend(true);

+ 1 - 1
gameplay/src/Theme.cpp

@@ -1111,7 +1111,7 @@ namespace gameplay
         const char* containerString = overlaySpace->getString("container");
         if (containerString)
         {
-            for (unsigned int i = 0; i < _cursors.size(); ++i)
+            for (unsigned int i = 0; i < _containers.size(); ++i)
             {
                 if (strcmp(_containers[i]->getId(), containerString) == 0)
                 {

+ 0 - 1
gameplay/src/Theme.h

@@ -331,7 +331,6 @@ public:
         Style(const Style& style);
         
         std::string _id;
-        Border _border;
         Padding _padding;
         Margin _margin;
         Overlay* _overlays[MAX_OVERLAYS];