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

Merge pull request #911 from ablake/next

More small UI bug fixes.
Adam Blake 12 жил өмнө
parent
commit
556e59bb02

+ 5 - 3
gameplay/src/Control.cpp

@@ -1011,9 +1011,11 @@ void Control::drawBorder(SpriteBatch* spriteBatch, const Rectangle& clip)
             spriteBatch->draw(rightX, _absoluteBounds.y, border.right, border.top, topRight.u1, topRight.v1, topRight.u2, topRight.v2, skinColor, clip);
         if (border.left)
             spriteBatch->draw(_absoluteBounds.x, midY, border.left, midHeight, left.u1, left.v1, left.u2, left.v2, skinColor, clip);
-        if (border.left && border.right && border.top && border.bottom)
-            spriteBatch->draw(_absoluteBounds.x + border.left, _absoluteBounds.y + border.top, _bounds.width - border.left - border.right, _bounds.height - border.top - border.bottom,
-                center.u1, center.v1, center.u2, center.v2, skinColor, clip);
+        
+        // Always draw the background.
+        spriteBatch->draw(_absoluteBounds.x + border.left, _absoluteBounds.y + border.top, _bounds.width - border.left - border.right, _bounds.height - border.top - border.bottom,
+            center.u1, center.v1, center.u2, center.v2, skinColor, clip);
+
         if (border.right)
             spriteBatch->draw(rightX, midY, border.right, midHeight, right.u1, right.v1, right.u2, right.v2, skinColor, clip);
         if (border.bottom && border.left)

+ 6 - 3
gameplay/src/ImageControl.cpp

@@ -85,7 +85,7 @@ void ImageControl::setRegionSrc(float x, float y, float width, float height)
     _uvs.u1 = x * _tw;
     _uvs.u2 = (x + width) * _tw;
     _uvs.v1 = 1.0f - (y * _th);
-    _uvs.v2 = 1.0f - ((y + height) * _tw);
+    _uvs.v2 = 1.0f - ((y + height) * _th);
 }
 
 void ImageControl::setRegionSrc(const Rectangle& region)
@@ -120,17 +120,20 @@ void ImageControl::drawImages(SpriteBatch* spriteBatch, const Rectangle& clip)
     // An ImageControl is not part of the texture atlas but should use the same projection matrix.
     _batch->setProjectionMatrix(spriteBatch->getProjectionMatrix());
 
+    Vector4 color = Vector4::one();
+    color.w *= _opacity;
+
     _batch->start();
     if (_dstRegion.isEmpty())
     {
         _batch->draw(_viewportBounds.x, _viewportBounds.y, _viewportBounds.width, _viewportBounds.height,
-            _uvs.u1, _uvs.v1, _uvs.u2, _uvs.v2, Vector4::one(), _viewportClipBounds);
+            _uvs.u1, _uvs.v1, _uvs.u2, _uvs.v2, color, _viewportClipBounds);
     }
     else
     {
         _batch->draw(_viewportBounds.x + _dstRegion.x, _viewportBounds.y + _dstRegion.y,
             _dstRegion.width, _dstRegion.height,
-            _uvs.u1, _uvs.v1, _uvs.u2, _uvs.v2, Vector4::one(), _viewportClipBounds);
+            _uvs.u1, _uvs.v1, _uvs.u2, _uvs.v2, color, _viewportClipBounds);
     }
     _batch->finish();
 

+ 1 - 0
gameplay/src/Theme.cpp

@@ -91,6 +91,7 @@ Theme* Theme::create(const char* url)
     const char* textureFile = themeProperties->getString("texture");
     theme->_texture = Texture::create(textureFile, false);
     GP_ASSERT(theme->_texture);
+    theme->_texture->setFilterMode(Texture::NEAREST, Texture::NEAREST);
     theme->_spriteBatch = SpriteBatch::create(theme->_texture);
     GP_ASSERT(theme->_spriteBatch);