Przeglądaj źródła

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

Adam Blake 14 lat temu
rodzic
commit
a5347b3cfa

+ 8 - 9
gameplay/src/Form.cpp

@@ -301,9 +301,6 @@ namespace gameplay
             Node* node = form->_node;
             Node* node = form->_node;
             if (node)
             if (node)
             {
             {
-                // Work in progress: Picking within 3D forms.
-
-                /*
                 Scene* scene = node->getScene();
                 Scene* scene = node->getScene();
                 Camera* camera = scene->getActiveCamera();
                 Camera* camera = scene->getActiveCamera();
 
 
@@ -350,14 +347,16 @@ namespace gameplay
 
 
                         // If the resulting point lies within the quad,
                         // If the resulting point lies within the quad,
                         // project it into the form's space.
                         // 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
             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
     // Wrap the effect in a material
     Material* material = Material::create(effect); // +ref effect
     Material* material = Material::create(effect); // +ref effect
-    if (effect == __spriteEffect)
-    {
-        effect->release();
-    }
 
 
     // Set initial material state
     // Set initial material state
     material->getStateBlock()->setBlend(true);
     material->getStateBlock()->setBlend(true);

+ 1 - 1
gameplay/src/Theme.cpp

@@ -1111,7 +1111,7 @@ namespace gameplay
         const char* containerString = overlaySpace->getString("container");
         const char* containerString = overlaySpace->getString("container");
         if (containerString)
         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)
                 if (strcmp(_containers[i]->getId(), containerString) == 0)
                 {
                 {

+ 0 - 1
gameplay/src/Theme.h

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