Przeglądaj źródła

Merge branch 'next' of https://github.com/blackberry-gaming/GamePlay into next-ablake

Adam Blake 13 lat temu
rodzic
commit
c7ad138996

+ 1 - 1
gameplay/android/jni/Android.mk

@@ -16,7 +16,7 @@ LOCAL_PATH := $(call my-dir)/../../src
 
 include $(CLEAR_VARS)
 LOCAL_MODULE    := libgameplay
-LOCAL_SRC_FILES := AbsoluteLayout.cpp Animation.cpp AnimationClip.cpp AnimationController.cpp AnimationTarget.cpp AnimationValue.cpp AudioBuffer.cpp AudioController.cpp AudioListener.cpp AudioSource.cpp BoundingBox.cpp BoundingSphere.cpp Bundle.cpp Button.cpp Camera.cpp CheckBox.cpp Container.cpp Control.cpp Curve.cpp DebugNew.cpp DepthStencilTarget.cpp Effect.cpp FileSystem.cpp FlowLayout.cpp Font.cpp Form.cpp FrameBuffer.cpp Frustum.cpp Game.cpp gameplay-main-android.cpp Image.cpp Joint.cpp Label.cpp Layout.cpp Light.cpp Material.cpp MaterialParameter.cpp Matrix.cpp Mesh.cpp MeshBatch.cpp MeshPart.cpp MeshSkin.cpp Model.cpp Node.cpp ParticleEmitter.cpp Pass.cpp PhysicsCharacter.cpp PhysicsCollisionObject.cpp PhysicsCollisionShape.cpp PhysicsConstraint.cpp PhysicsController.cpp PhysicsFixedConstraint.cpp PhysicsGenericConstraint.cpp PhysicsGhostObject.cpp PhysicsHingeConstraint.cpp PhysicsMotionState.cpp PhysicsRigidBody.cpp PhysicsSocketConstraint.cpp PhysicsSpringConstraint.cpp Plane.cpp PlatformAndroid.cpp Properties.cpp Quaternion.cpp RadioButton.cpp Ray.cpp Rectangle.cpp Ref.cpp RenderState.cpp RenderTarget.cpp Scene.cpp SceneLoader.cpp ScrollLayout.cpp Slider.cpp SpriteBatch.cpp Technique.cpp TextBox.cpp Texture.cpp Theme.cpp ThemeStyle.cpp Transform.cpp Vector2.cpp Vector3.cpp Vector4.cpp VertexAttributeBinding.cpp VertexFormat.cpp VerticalLayout.cpp
+LOCAL_SRC_FILES := AbsoluteLayout.cpp Animation.cpp AnimationClip.cpp AnimationController.cpp AnimationTarget.cpp AnimationValue.cpp AudioBuffer.cpp AudioController.cpp AudioListener.cpp AudioSource.cpp BoundingBox.cpp BoundingSphere.cpp Bundle.cpp Button.cpp Camera.cpp CheckBox.cpp Container.cpp Control.cpp Curve.cpp DebugNew.cpp DepthStencilTarget.cpp Effect.cpp FileSystem.cpp FlowLayout.cpp Font.cpp Form.cpp FrameBuffer.cpp Frustum.cpp Game.cpp gameplay-main-android.cpp Image.cpp Joint.cpp Label.cpp Layout.cpp Light.cpp Material.cpp MaterialParameter.cpp Matrix.cpp Mesh.cpp MeshBatch.cpp MeshPart.cpp MeshSkin.cpp Model.cpp Node.cpp ParticleEmitter.cpp Pass.cpp PhysicsCharacter.cpp PhysicsCollisionObject.cpp PhysicsCollisionShape.cpp PhysicsConstraint.cpp PhysicsController.cpp PhysicsFixedConstraint.cpp PhysicsGenericConstraint.cpp PhysicsGhostObject.cpp PhysicsHingeConstraint.cpp PhysicsMotionState.cpp PhysicsRigidBody.cpp PhysicsSocketConstraint.cpp PhysicsSpringConstraint.cpp Plane.cpp PlatformAndroid.cpp Properties.cpp Quaternion.cpp RadioButton.cpp Ray.cpp Rectangle.cpp Ref.cpp RenderState.cpp RenderTarget.cpp Scene.cpp SceneLoader.cpp Slider.cpp SpriteBatch.cpp Technique.cpp TextBox.cpp Texture.cpp Theme.cpp ThemeStyle.cpp Transform.cpp Vector2.cpp Vector3.cpp Vector4.cpp VertexAttributeBinding.cpp VertexFormat.cpp VerticalLayout.cpp
 LOCAL_CFLAGS := -D__ANDROID__ -I"../../external-deps/bullet/include" -I"../../external-deps/libpng/include" -I"../../external-deps/oggvorbis/include" -I"../../external-deps/openal/include"
 LOCAL_STATIC_LIBRARIES := android_native_app_glue
 

+ 0 - 12
gameplay/gameplay.xcodeproj/project.pbxproj

@@ -28,10 +28,6 @@
 		42554EA2152BC35C000ED910 /* PhysicsCollisionShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42554E9F152BC35C000ED910 /* PhysicsCollisionShape.cpp */; };
 		42554EA3152BC35C000ED910 /* PhysicsCollisionShape.h in Headers */ = {isa = PBXBuildFile; fileRef = 42554EA0152BC35C000ED910 /* PhysicsCollisionShape.h */; };
 		42554EA4152BC35C000ED910 /* PhysicsCollisionShape.h in Headers */ = {isa = PBXBuildFile; fileRef = 42554EA0152BC35C000ED910 /* PhysicsCollisionShape.h */; };
-		4265D9241559A3C300581EB0 /* ScrollLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4265D9221559A3C300581EB0 /* ScrollLayout.cpp */; };
-		4265D9251559A3C300581EB0 /* ScrollLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4265D9221559A3C300581EB0 /* ScrollLayout.cpp */; };
-		4265D9261559A3C300581EB0 /* ScrollLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 4265D9231559A3C300581EB0 /* ScrollLayout.h */; };
-		4265D9271559A3C300581EB0 /* ScrollLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 4265D9231559A3C300581EB0 /* ScrollLayout.h */; };
 		426878AC153F4BB300844500 /* FlowLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 426878AA153F4BB300844500 /* FlowLayout.cpp */; };
 		426878AD153F4BB300844500 /* FlowLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 426878AA153F4BB300844500 /* FlowLayout.cpp */; };
 		426878AE153F4BB300844500 /* FlowLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 426878AB153F4BB300844500 /* FlowLayout.h */; };
@@ -408,8 +404,6 @@
 		4251B130152D049B002F6199 /* ThemeStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThemeStyle.h; path = src/ThemeStyle.h; sourceTree = SOURCE_ROOT; };
 		42554E9F152BC35C000ED910 /* PhysicsCollisionShape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PhysicsCollisionShape.cpp; path = src/PhysicsCollisionShape.cpp; sourceTree = SOURCE_ROOT; };
 		42554EA0152BC35C000ED910 /* PhysicsCollisionShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PhysicsCollisionShape.h; path = src/PhysicsCollisionShape.h; sourceTree = SOURCE_ROOT; };
-		4265D9221559A3C300581EB0 /* ScrollLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ScrollLayout.cpp; path = src/ScrollLayout.cpp; sourceTree = SOURCE_ROOT; };
-		4265D9231559A3C300581EB0 /* ScrollLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ScrollLayout.h; path = src/ScrollLayout.h; sourceTree = SOURCE_ROOT; };
 		426878AA153F4BB300844500 /* FlowLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FlowLayout.cpp; path = src/FlowLayout.cpp; sourceTree = SOURCE_ROOT; };
 		426878AB153F4BB300844500 /* FlowLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FlowLayout.h; path = src/FlowLayout.h; sourceTree = SOURCE_ROOT; };
 		4271C08D15337C8200B89DA7 /* Layout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Layout.cpp; path = src/Layout.cpp; sourceTree = SOURCE_ROOT; };
@@ -862,8 +856,6 @@
 				428390971489D6E800E2B2F5 /* SceneLoader.cpp */,
 				428390981489D6E800E2B2F5 /* SceneLoader.h */,
 				4251B12E152D049B002F6199 /* ScreenDisplayer.h */,
-				4265D9221559A3C300581EB0 /* ScrollLayout.cpp */,
-				4265D9231559A3C300581EB0 /* ScrollLayout.h */,
 				5BD52646150F822A004C9099 /* Slider.cpp */,
 				5BD52647150F822A004C9099 /* Slider.h */,
 				42CD0E2F147D8FF50000361E /* SpriteBatch.cpp */,
@@ -1072,7 +1064,6 @@
 				4251B135152D049B002F6199 /* ThemeStyle.h in Headers */,
 				422260D81537790F0011E3AB /* Bundle.h in Headers */,
 				426878AE153F4BB300844500 /* FlowLayout.h in Headers */,
-				4265D9261559A3C300581EB0 /* ScrollLayout.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1170,7 +1161,6 @@
 				4251B136152D049B002F6199 /* ThemeStyle.h in Headers */,
 				422260D91537790F0011E3AB /* Bundle.h in Headers */,
 				426878AF153F4BB300844500 /* FlowLayout.h in Headers */,
-				4265D9271559A3C300581EB0 /* ScrollLayout.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1327,7 +1317,6 @@
 				4271C08E15337C8200B89DA7 /* Layout.cpp in Sources */,
 				422260D61537790F0011E3AB /* Bundle.cpp in Sources */,
 				426878AC153F4BB300844500 /* FlowLayout.cpp in Sources */,
-				4265D9241559A3C300581EB0 /* ScrollLayout.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1420,7 +1409,6 @@
 				4271C08F15337C8200B89DA7 /* Layout.cpp in Sources */,
 				422260D71537790F0011E3AB /* Bundle.cpp in Sources */,
 				426878AD153F4BB300844500 /* FlowLayout.cpp in Sources */,
-				4265D9251559A3C300581EB0 /* ScrollLayout.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

+ 19 - 19
gameplay/src/Container.cpp

@@ -29,7 +29,7 @@ namespace gameplay
 Container::Container()
     : _layout(NULL), _scrollBarTopCap(NULL), _scrollBarVertical(NULL), _scrollBarBottomCap(NULL),
       _scrollBarLeftCap(NULL), _scrollBarHorizontal(NULL), _scrollBarRightCap(NULL),
-      _scrollState(SCROLL_NONE), _scrollBarBounds(Rectangle::empty()), _scrollPosition(Vector2::zero()),
+      _scroll(SCROLL_NONE), _scrollBarBounds(Rectangle::empty()), _scrollPosition(Vector2::zero()),
       _scrolling(false), _firstX(0), _firstY(0),
       _lastX(0), _lastY(0),
       _startTimeX(0), _startTimeY(0), _lastTime(0),
@@ -82,7 +82,7 @@ Container* Container::create(Theme::Style* style, Properties* properties, Theme*
     const char* layoutString = properties->getString("layout");
     Container* container = Container::create(getLayoutType(layoutString));
     container->initialize(style, properties);
-    container->_scrollState = getScrollState(properties->getString("scroll"));
+    container->_scroll = getScroll(properties->getString("scroll"));
     container->addControls(theme, properties);
 
     return container;
@@ -241,18 +241,18 @@ const std::vector<Control*>& Container::getControls() const
     return _controls;
 }
 
-void Container::setScrollState(ScrollState scrollState)
+void Container::setScroll(Scroll scroll)
 {
-    if (scrollState != _scrollState)
+    if (scroll != _scroll)
     {
-        _scrollState = scrollState;
+        _scroll = scroll;
         _dirty = true;
     }
 }
 
-Container::ScrollState Container::getScrollState() const
+Container::Scroll Container::getScroll() const
 {
-    return _scrollState;
+    return _scroll;
 }
 
 Animation* Container::getAnimation(const char* id) const
@@ -286,7 +286,7 @@ void Container::update(const Rectangle& clip, const Vector2& offset)
     Control::update(clip, offset);
 
     // Get scrollbar images and diminish clipping bounds to make room for scrollbars.
-    if ((_scrollState & SCROLL_HORIZONTAL) == SCROLL_HORIZONTAL)
+    if ((_scroll & SCROLL_HORIZONTAL) == SCROLL_HORIZONTAL)
     {
         _scrollBarLeftCap = getImage("scrollBarLeftCap", _state);
         _scrollBarHorizontal = getImage("horizontalScrollBar", _state);
@@ -295,7 +295,7 @@ void Container::update(const Rectangle& clip, const Vector2& offset)
         _viewportClipBounds.height -= _scrollBarHorizontal->getRegion().height;
     }
 
-    if ((_scrollState & SCROLL_VERTICAL) == SCROLL_VERTICAL)
+    if ((_scroll & SCROLL_VERTICAL) == SCROLL_VERTICAL)
     {
         _scrollBarTopCap = getImage("scrollBarTopCap", _state);
         _scrollBarVertical = getImage("verticalScrollBar", _state);
@@ -309,7 +309,7 @@ void Container::update(const Rectangle& clip, const Vector2& offset)
     GP_ASSERT(_layout);
     _layout->update(this);
 
-    if (_scrollState != SCROLL_NONE)
+    if (_scroll != SCROLL_NONE)
         this->updateScroll(this);
 }
 
@@ -343,7 +343,7 @@ void Container::draw(SpriteBatch* spriteBatch, const Rectangle& clip, bool needs
         }
     }
 
-    if (_scrollState != SCROLL_NONE)
+    if (_scroll != SCROLL_NONE)
     {
         // Draw scroll bars.
         Rectangle clipRegion(_viewportClipBounds);
@@ -455,7 +455,7 @@ bool Container::touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int con
     float yPos = border.top + padding.top;
 
     Vector2* offset = NULL;
-    if (_scrollState != SCROLL_NONE)
+    if (_scroll != SCROLL_NONE)
     {
         offset = &_scrollPosition;
     }
@@ -768,30 +768,30 @@ bool Container::touchEventScroll(Touch::TouchEvent evt, int x, int y, unsigned i
     return false;
 }
 
-Container::ScrollState Container::getScrollState(const char* scrollState)
+Container::Scroll Container::getScroll(const char* scroll)
 {
-    if (!scrollState)
+    if (!scroll)
         return Container::SCROLL_NONE;
 
-    if (strcmp(scrollState, "SCROLL_NONE") == 0)
+    if (strcmp(scroll, "SCROLL_NONE") == 0)
     {
         return Container::SCROLL_NONE;
     }
-    else if (strcmp(scrollState, "SCROLL_HORIZONTAL") == 0)
+    else if (strcmp(scroll, "SCROLL_HORIZONTAL") == 0)
     {
         return Container::SCROLL_HORIZONTAL;
     }
-    else if (strcmp(scrollState, "SCROLL_VERTICAL") == 0)
+    else if (strcmp(scroll, "SCROLL_VERTICAL") == 0)
     {
         return Container::SCROLL_VERTICAL;
     }
-    else if (strcmp(scrollState, "SCROLL_BOTH") == 0)
+    else if (strcmp(scroll, "SCROLL_BOTH") == 0)
     {
         return Container::SCROLL_BOTH;
     }
     else
     {
-        GP_ERROR("Failed to get corresponding scroll state for unsupported value '%s'.", scrollState);
+        GP_ERROR("Failed to get corresponding scroll state for unsupported value '%s'.", scroll);
     }
 
     return Container::SCROLL_NONE;

+ 14 - 17
gameplay/src/Container.h

@@ -25,6 +25,7 @@ namespace gameplay
          size        = <width, height>   // Size of the container, measured in pixels.
          width       = <width>   // Can be used in place of 'size', e.g. with 'autoHeight = true'
          height      = <height>  // Can be used in place of 'size', e.g. with 'autoWidth = true'
+         scroll      = <Container::Scroll constant>
   
          // All the nested controls within this container.
          container 
@@ -45,7 +46,10 @@ class Container : public Control
 {
 public:
 
-    enum ScrollState
+    /**
+     * The definition for container scrolling.
+     */
+    enum Scroll
     {
         SCROLL_NONE        = 0,
         SCROLL_HORIZONTAL  = 0x01,
@@ -122,9 +126,14 @@ public:
      */
     const std::vector<Control*>& getControls() const;
 
-    void setScrollState(ScrollState scrollState);
+    /**
+     * Sets the scrolling for the container.
+     *
+     * @param scroll The scroll for the 
+     */
+    void setScroll(Scroll scroll);
 
-    ScrollState getScrollState() const;
+    Scroll getScroll() const;
 
     /**
      * Gets the first animation in the control with the specified ID.
@@ -229,7 +238,7 @@ protected:
 
     bool touchEventScroll(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex);
 
-    static ScrollState getScrollState(const char* scrollState);
+    static Scroll getScroll(const char* scroll);
 
     /**
      * The container's layout.
@@ -241,27 +250,15 @@ protected:
      */
     std::vector<Control*> _controls;
 
-    /**
-     * Scrollbar top cap image.
-     */
     Theme::ThemeImage* _scrollBarTopCap;
-
-    /**
-     * Vertical scrollbar image.
-     */
     Theme::ThemeImage* _scrollBarVertical;
-
-    /**
-     * Scrollbar bottom cap image.
-     */
     Theme::ThemeImage* _scrollBarBottomCap;
-
     Theme::ThemeImage* _scrollBarLeftCap;
     Theme::ThemeImage* _scrollBarHorizontal;
     Theme::ThemeImage* _scrollBarRightCap;
 
     // Flag representing whether scrolling is enabled, and in which directions.
-    ScrollState _scrollState;
+    Scroll _scroll;
 
     // Data required when scrolling is enabled.
 

+ 4 - 4
gameplay/src/Form.cpp

@@ -108,7 +108,7 @@ Form* Form::create(const char* url)
         form->_bounds.x = Game::getInstance()->getWidth() * 0.5f - form->_bounds.width * 0.5f;
     }
 
-    form->_scrollState = getScrollState(formProperties->getString("scroll"));
+    form->_scroll = getScroll(formProperties->getString("scroll"));
 
     // Add all the controls to the form.
     form->addControls(theme, formProperties);
@@ -396,7 +396,7 @@ void Form::update()
         _opacity = getOpacity(_state);
 
         // Get scrollbar images and diminish clipping bounds to make room for scrollbars.
-        if ((_scrollState & SCROLL_HORIZONTAL) == SCROLL_HORIZONTAL)
+        if ((_scroll & SCROLL_HORIZONTAL) == SCROLL_HORIZONTAL)
         {
             _scrollBarLeftCap = getImage("scrollBarLeftCap", _state);
             _scrollBarHorizontal = getImage("horizontalScrollBar", _state);
@@ -405,7 +405,7 @@ void Form::update()
             _viewportClipBounds.height -= _scrollBarHorizontal->getRegion().height;
         }
 
-        if ((_scrollState & SCROLL_VERTICAL) == SCROLL_VERTICAL)
+        if ((_scroll & SCROLL_VERTICAL) == SCROLL_VERTICAL)
         {
             _scrollBarTopCap = getImage("scrollBarTopCap", _state);
             _scrollBarVertical = getImage("verticalScrollBar", _state);
@@ -417,7 +417,7 @@ void Form::update()
         GP_ASSERT(_layout);
         _layout->update(this);
 
-        if (_scrollState != SCROLL_NONE)
+        if (_scroll != SCROLL_NONE)
             this->updateScroll(this);
     }
 }