Parcourir la source

First step towards merging Scenes and Screens

Ivan Safrin il y a 12 ans
Parent
commit
893a282ef1
100 fichiers modifiés avec 938 ajouts et 5019 suppressions
  1. 2 26
      Core/Contents/CMakeLists.txt
  2. 3 3
      Core/Contents/Include/PolyBone.h
  3. 3 3
      Core/Contents/Include/PolyCamera.h
  4. 0 8
      Core/Contents/Include/PolyCoreServices.h
  5. 83 5
      Core/Contents/Include/PolyEntity.h
  6. 2 41
      Core/Contents/Include/PolyParticleEmitter.h
  7. 15 25
      Core/Contents/Include/PolyScene.h
  8. 0 56
      Core/Contents/Include/PolySceneEntity.h
  9. 20 19
      Core/Contents/Include/PolySceneImage.h
  10. 9 0
      Core/Contents/Include/PolySceneLabel.h
  11. 3 3
      Core/Contents/Include/PolySceneLight.h
  12. 6 6
      Core/Contents/Include/PolySceneLine.h
  13. 6 3
      Core/Contents/Include/PolySceneMesh.h
  14. 13 2
      Core/Contents/Include/PolyScenePrimitive.h
  15. 3 3
      Core/Contents/Include/PolySceneSound.h
  16. 0 154
      Core/Contents/Include/PolyScreen.h
  17. 0 357
      Core/Contents/Include/PolyScreenEntity.h
  18. 0 91
      Core/Contents/Include/PolyScreenEntityInstance.h
  19. 0 44
      Core/Contents/Include/PolyScreenEvent.h
  20. 0 73
      Core/Contents/Include/PolyScreenLabel.h
  21. 0 83
      Core/Contents/Include/PolyScreenLine.h
  22. 0 63
      Core/Contents/Include/PolyScreenManager.h
  23. 0 148
      Core/Contents/Include/PolyScreenMesh.h
  24. 0 132
      Core/Contents/Include/PolyScreenShape.h
  25. 0 65
      Core/Contents/Include/PolyScreenSound.h
  26. 0 169
      Core/Contents/Include/PolyScreenSprite.h
  27. 3 3
      Core/Contents/Include/PolySkeleton.h
  28. 1 12
      Core/Contents/Include/Polycode.h
  29. 1 1
      Core/Contents/Source/PolyBone.cpp
  30. 2 2
      Core/Contents/Source/PolyCamera.cpp
  31. 3 29
      Core/Contents/Source/PolyCoreServices.cpp
  32. 40 2
      Core/Contents/Source/PolyEntity.cpp
  33. 0 30
      Core/Contents/Source/PolyParticle.cpp
  34. 3 101
      Core/Contents/Source/PolyParticleEmitter.cpp
  35. 19 61
      Core/Contents/Source/PolyScene.cpp
  36. 47 47
      Core/Contents/Source/PolySceneImage.cpp
  37. 21 1
      Core/Contents/Source/PolySceneLabel.cpp
  38. 1 1
      Core/Contents/Source/PolySceneLight.cpp
  39. 2 2
      Core/Contents/Source/PolySceneLine.cpp
  40. 9 3
      Core/Contents/Source/PolySceneMesh.cpp
  41. 23 0
      Core/Contents/Source/PolyScenePrimitive.cpp
  42. 2 2
      Core/Contents/Source/PolySceneSound.cpp
  43. 0 213
      Core/Contents/Source/PolyScreen.cpp
  44. 0 695
      Core/Contents/Source/PolyScreenEntity.cpp
  45. 0 398
      Core/Contents/Source/PolyScreenEntityInstance.cpp
  46. 0 33
      Core/Contents/Source/PolyScreenEvent.cpp
  47. 0 100
      Core/Contents/Source/PolyScreenLabel.cpp
  48. 0 117
      Core/Contents/Source/PolyScreenLine.cpp
  49. 0 87
      Core/Contents/Source/PolyScreenManager.cpp
  50. 0 175
      Core/Contents/Source/PolyScreenMesh.cpp
  51. 0 246
      Core/Contents/Source/PolyScreenShape.cpp
  52. 0 88
      Core/Contents/Source/PolyScreenSound.cpp
  53. 0 388
      Core/Contents/Source/PolyScreenSprite.cpp
  54. 4 4
      Core/Contents/Source/PolySkeleton.cpp
  55. 53 53
      Modules/Contents/2DPhysics/Include/PolyPhysicsScreen.h
  56. 7 7
      Modules/Contents/2DPhysics/Include/PolyPhysicsScreenEntity.h
  57. 101 102
      Modules/Contents/2DPhysics/Source/PolyPhysicsScreen.cpp
  58. 49 46
      Modules/Contents/2DPhysics/Source/PolyPhysicsScreenEntity.cpp
  59. 15 15
      Modules/Contents/3DPhysics/Include/PolyCollisionScene.h
  60. 8 8
      Modules/Contents/3DPhysics/Include/PolyCollisionSceneEntity.h
  61. 21 21
      Modules/Contents/3DPhysics/Include/PolyPhysicsScene.h
  62. 12 11
      Modules/Contents/3DPhysics/Include/PolyPhysicsSceneEntity.h
  63. 26 26
      Modules/Contents/3DPhysics/Source/PolyCollisionScene.cpp
  64. 11 11
      Modules/Contents/3DPhysics/Source/PolyCollisionSceneEntity.cpp
  65. 32 32
      Modules/Contents/3DPhysics/Source/PolyPhysicsScene.cpp
  66. 19 23
      Modules/Contents/3DPhysics/Source/PolyPhysicsSceneEntity.cpp
  67. 10 10
      Modules/Contents/UI/Include/PolyUIBox.h
  68. 4 4
      Modules/Contents/UI/Include/PolyUIButton.h
  69. 7 7
      Modules/Contents/UI/Include/PolyUICheckBox.h
  70. 13 13
      Modules/Contents/UI/Include/PolyUIColorBox.h
  71. 6 6
      Modules/Contents/UI/Include/PolyUIComboBox.h
  72. 2 2
      Modules/Contents/UI/Include/PolyUIElement.h
  73. 3 3
      Modules/Contents/UI/Include/PolyUIFileDialog.h
  74. 4 4
      Modules/Contents/UI/Include/PolyUIHSizer.h
  75. 5 5
      Modules/Contents/UI/Include/PolyUIHSlider.h
  76. 5 5
      Modules/Contents/UI/Include/PolyUIImageButton.h
  77. 5 5
      Modules/Contents/UI/Include/PolyUIMenu.h
  78. 6 6
      Modules/Contents/UI/Include/PolyUIMenuBar.h
  79. 3 3
      Modules/Contents/UI/Include/PolyUIScrollContainer.h
  80. 13 13
      Modules/Contents/UI/Include/PolyUITextInput.h
  81. 8 8
      Modules/Contents/UI/Include/PolyUITree.h
  82. 2 1
      Modules/Contents/UI/Include/PolyUITreeContainer.h
  83. 4 4
      Modules/Contents/UI/Include/PolyUIVSizer.h
  84. 7 7
      Modules/Contents/UI/Include/PolyUIWindow.h
  85. 24 26
      Modules/Contents/UI/Source/PolyUIBox.cpp
  86. 2 3
      Modules/Contents/UI/Source/PolyUIButton.cpp
  87. 3 3
      Modules/Contents/UI/Source/PolyUICheckBox.cpp
  88. 17 17
      Modules/Contents/UI/Source/PolyUIColorBox.cpp
  89. 2 3
      Modules/Contents/UI/Source/PolyUIComboBox.cpp
  90. 6 5
      Modules/Contents/UI/Source/PolyUIElement.cpp
  91. 6 6
      Modules/Contents/UI/Source/PolyUIFileDialog.cpp
  92. 13 13
      Modules/Contents/UI/Source/PolyUIHSizer.cpp
  93. 5 6
      Modules/Contents/UI/Source/PolyUIHSlider.cpp
  94. 4 4
      Modules/Contents/UI/Source/PolyUIImageButton.cpp
  95. 8 7
      Modules/Contents/UI/Source/PolyUIMenu.cpp
  96. 6 6
      Modules/Contents/UI/Source/PolyUIMenuBar.cpp
  97. 2 4
      Modules/Contents/UI/Source/PolyUIScrollContainer.cpp
  98. 19 20
      Modules/Contents/UI/Source/PolyUITextInput.cpp
  99. 9 10
      Modules/Contents/UI/Source/PolyUITree.cpp
  100. 2 2
      Modules/Contents/UI/Source/PolyUITreeContainer.cpp

+ 2 - 26
Core/Contents/CMakeLists.txt

@@ -48,27 +48,15 @@ SET(polycore_SRCS
     Source/PolyResource.cpp
     Source/PolyResource.cpp
     Source/PolyResourceManager.cpp
     Source/PolyResourceManager.cpp
     Source/PolyScene.cpp
     Source/PolyScene.cpp
-    Source/PolySceneEntity.cpp
     Source/PolySceneLabel.cpp
     Source/PolySceneLabel.cpp
     Source/PolySceneLight.cpp
     Source/PolySceneLight.cpp
     Source/PolySceneLine.cpp
     Source/PolySceneLine.cpp
     Source/PolySceneManager.cpp
     Source/PolySceneManager.cpp
     Source/PolySceneMesh.cpp
     Source/PolySceneMesh.cpp
     Source/PolyScenePrimitive.cpp
     Source/PolyScenePrimitive.cpp
+    Source/PolySceneImage.cpp
     Source/PolySceneRenderTexture.cpp
     Source/PolySceneRenderTexture.cpp
     Source/PolySceneSound.cpp
     Source/PolySceneSound.cpp
-    Source/PolyScreen.cpp
-    Source/PolyScreenEntity.cpp
-    Source/PolyScreenEvent.cpp
-    Source/PolyScreenImage.cpp
-    Source/PolyScreenLabel.cpp
-    Source/PolyScreenLine.cpp
-    Source/PolyScreenManager.cpp
-    Source/PolyScreenMesh.cpp
-    Source/PolyScreenShape.cpp
-    Source/PolyScreenSound.cpp
-    Source/PolyScreenSprite.cpp
-    Source/PolyScreenEntityInstance.cpp
     Source/PolyShader.cpp
     Source/PolyShader.cpp
     Source/PolySkeleton.cpp
     Source/PolySkeleton.cpp
     Source/PolySound.cpp
     Source/PolySound.cpp
@@ -143,7 +131,6 @@ SET(polycore_HDRS
     Include/PolyRenderer.h
     Include/PolyRenderer.h
     Include/PolyResource.h
     Include/PolyResource.h
     Include/PolyResourceManager.h
     Include/PolyResourceManager.h
-    Include/PolySceneEntity.h
     Include/PolyScene.h
     Include/PolyScene.h
     Include/PolySceneLabel.h
     Include/PolySceneLabel.h
     Include/PolySceneLight.h
     Include/PolySceneLight.h
@@ -151,20 +138,9 @@ SET(polycore_HDRS
     Include/PolySceneManager.h
     Include/PolySceneManager.h
     Include/PolySceneMesh.h
     Include/PolySceneMesh.h
     Include/PolyScenePrimitive.h
     Include/PolyScenePrimitive.h
+    Include/PolySceneImage.h
     Include/PolySceneRenderTexture.h
     Include/PolySceneRenderTexture.h
     Include/PolySceneSound.h
     Include/PolySceneSound.h
-    Include/PolyScreenEntity.h
-    Include/PolyScreenEvent.h
-    Include/PolyScreen.h
-    Include/PolyScreenImage.h
-    Include/PolyScreenLabel.h
-    Include/PolyScreenLine.h
-    Include/PolyScreenManager.h
-    Include/PolyScreenMesh.h
-    Include/PolyScreenShape.h
-    Include/PolyScreenSound.h
-    Include/PolyScreenSprite.h
-    Include/PolyScreenEntityInstance.h
     Include/PolyShader.h
     Include/PolyShader.h
     Include/PolySkeleton.h
     Include/PolySkeleton.h
     Include/PolySound.h
     Include/PolySound.h

+ 3 - 3
Core/Contents/Include/PolyBone.h

@@ -24,17 +24,17 @@
 #include "PolyGlobals.h"
 #include "PolyGlobals.h"
 #include "PolyString.h"
 #include "PolyString.h"
 #include "PolyMatrix4.h"
 #include "PolyMatrix4.h"
-#include "PolySceneEntity.h"
+#include "PolyEntity.h"
 
 
 namespace Polycode {
 namespace Polycode {
 
 
 	class Mesh;
 	class Mesh;
 
 
 	/** 
 	/** 
-	* Skeleton bone. Bones are bound to vertices of a mesh and when transformed, move the bound vertices of the mesh along with them. Bones are subclassed from SceneEntity, but have their own hierarchy system.
+	* Skeleton bone. Bones are bound to vertices of a mesh and when transformed, move the bound vertices of the mesh along with them. Bones are subclassed from Entity, but have their own hierarchy system.
 	* @see Skeleton
 	* @see Skeleton
 	*/			
 	*/			
-	class _PolyExport Bone : public SceneEntity {
+	class _PolyExport Bone : public Entity {
 		public:
 		public:
 			/** 
 			/** 
 			* Constructor.
 			* Constructor.

+ 3 - 3
Core/Contents/Include/PolyCamera.h

@@ -23,7 +23,7 @@
 
 
 #pragma once
 #pragma once
 #include "PolyGlobals.h"
 #include "PolyGlobals.h"
-#include "PolySceneEntity.h"
+#include "PolyEntity.h"
 
 
 namespace Polycode {
 namespace Polycode {
 
 
@@ -35,7 +35,7 @@ namespace Polycode {
 	/**
 	/**
 	* Camera in a 3D scene. Cameras can be added to a scene and changed between dynamically. You can also set a shader to a camera that will run as a screen shader for post-processing effects.
 	* Camera in a 3D scene. Cameras can be added to a scene and changed between dynamically. You can also set a shader to a camera that will run as a screen shader for post-processing effects.
 	*/	
 	*/	
-	class _PolyExport Camera : public SceneEntity {
+	class _PolyExport Camera : public Entity {
 		public:
 		public:
 			
 			
 			/**
 			/**
@@ -62,7 +62,7 @@ namespace Polycode {
 			* @return Returns true if the entity's bounding radius is within the camera's frustum, or false if it isn't.
 			* @return Returns true if the entity's bounding radius is within the camera's frustum, or false if it isn't.
 			* @see isSphereInFrustum()
 			* @see isSphereInFrustum()
 			*/					
 			*/					
-			bool canSee(SceneEntity *entity);
+			bool canSee(Entity *entity);
 			
 			
 			/**
 			/**
 			* Toggles orthographic projection mode for camera.
 			* Toggles orthographic projection mode for camera.

+ 0 - 8
Core/Contents/Include/PolyCoreServices.h

@@ -34,7 +34,6 @@ namespace Polycode {
 	class Config;
 	class Config;
 	class FontManager;
 	class FontManager;
 	class SceneManager;
 	class SceneManager;
-	class ScreenManager;
 	class TimerManager;
 	class TimerManager;
 	class TweenManager;
 	class TweenManager;
 	class ResourceManager;
 	class ResourceManager;
@@ -98,12 +97,6 @@ namespace Polycode {
 			*/
 			*/
 			MaterialManager *getMaterialManager();
 			MaterialManager *getMaterialManager();
 			
 			
-			/**
-			* Returns the screen manager. The screen manager is responsible for maintaining and rendering 2D screens.
-			* @return Screen Manager
-			* @see ScreenManager
-			*/			
-			ScreenManager *getScreenManager();
 			
 			
 			/**
 			/**
 			* Returns the scene manager. The screen manager is responsible for maintaining and rendering 3D scenes.
 			* Returns the scene manager. The screen manager is responsible for maintaining and rendering 3D scenes.
@@ -182,7 +175,6 @@ namespace Polycode {
 			Core *core;
 			Core *core;
 			Config *config;
 			Config *config;
 			MaterialManager *materialManager;
 			MaterialManager *materialManager;
-			ScreenManager *screenManager;		
 			SceneManager *sceneManager;
 			SceneManager *sceneManager;
 			Logger *logger;
 			Logger *logger;
 			TimerManager *timerManager;
 			TimerManager *timerManager;

+ 83 - 5
Core/Contents/Include/PolyEntity.h

@@ -24,6 +24,7 @@
 #include "PolyGlobals.h"
 #include "PolyGlobals.h"
 #include "PolyString.h"
 #include "PolyString.h"
 #include "PolyMatrix4.h"
 #include "PolyMatrix4.h"
+#include "PolyVector2.h"
 #include "PolyQuaternion.h"
 #include "PolyQuaternion.h"
 #include "PolyColor.h"
 #include "PolyColor.h"
 #include "PolyRectangle.h"
 #include "PolyRectangle.h"
@@ -223,6 +224,8 @@ namespace Polycode {
 			*/			
 			*/			
 			Vector3 getPosition() const;
 			Vector3 getPosition() const;
 			
 			
+			Vector2 getPosition2D() const;
+			
 			/**
 			/**
 			* Returns the entity's position added to the combined position of its parent. This method is here only for convenience of calculating certain properties and should not be used to get an entity's actual position in the world. To get the actual world position of the entity, use the entity's concatendated matrix.
 			* Returns the entity's position added to the combined position of its parent. This method is here only for convenience of calculating certain properties and should not be used to get an entity's actual position in the world. To get the actual world position of the entity, use the entity's concatendated matrix.
 			@see getConcatenatedMatrix()
 			@see getConcatenatedMatrix()
@@ -236,7 +239,7 @@ namespace Polycode {
 			@param y Y-axis value.
 			@param y Y-axis value.
 			@param z Z-axis value.						
 			@param z Z-axis value.						
 			*/						
 			*/						
-			void setPosition(Number x, Number y, Number z);
+			void setPosition(Number x, Number y, Number z=0.0);
 			
 			
 			/**
 			/**
 			* Sets the entity's position with a vector.
 			* Sets the entity's position with a vector.
@@ -262,7 +265,7 @@ namespace Polycode {
 			@param y Y-axis value.
 			@param y Y-axis value.
 			@param z Z-axis value.						
 			@param z Z-axis value.						
 			*/						
 			*/						
-			void Translate(Number x, Number y, Number z);
+			void Translate(Number x, Number y, Number z=0.0);
 			
 			
 			/**
 			/**
 			* Translates the entity relative to its current position with a vector.
 			* Translates the entity relative to its current position with a vector.
@@ -301,7 +304,7 @@ namespace Polycode {
 			@param y Y-axis value.
 			@param y Y-axis value.
 			@param z Z-axis value.						
 			@param z Z-axis value.						
 			*/									
 			*/									
-			void Scale(Number x, Number y, Number z);
+			void Scale(Number x, Number y, Number z=0.0);
 			
 			
 			/**
 			/**
 			* Sets the entity's scale.
 			* Sets the entity's scale.
@@ -309,7 +312,7 @@ namespace Polycode {
 			@param y Y-axis value.
 			@param y Y-axis value.
 			@param z Z-axis value.						
 			@param z Z-axis value.						
 			*/									
 			*/									
-			void setScale(Number x, Number y, Number z);
+			void setScale(Number x, Number y, Number z=1.0);
 			
 			
 			/**
 			/**
 			* Sets the entity's scale.
 			* Sets the entity's scale.
@@ -405,7 +408,17 @@ namespace Polycode {
 			* @return Current roll value.
 			* @return Current roll value.
 			*/																										
 			*/																										
 			Number getRoll() const;
 			Number getRoll() const;
-		
+			
+			Number getWidth() const;
+
+			Number getHeight() const;
+
+			Number getDepth() const;
+			
+			void setWidth(Number width);
+			void setHeight(Number height);
+			void setDepth(Number depth);
+			
 			/**
 			/**
 			* Sets the rotation with quaternion value.
 			* Sets the rotation with quaternion value.
 			* @param Current yaw value.
 			* @param Current yaw value.
@@ -655,8 +668,73 @@ namespace Polycode {
 			void clearTags();
 			void clearTags();
 			void addTag(String tag); 
 			void addTag(String tag); 
 
 
+			/**
+			* If set to true, will cast shadows (Defaults to true).
+			*/
+			bool castShadows;
+			
+			int collisionShapeType;	
+
+			int positionMode;
+
+			/** 
+			* Changes the positioning mode of the screen entity.		
+			
+			If the positioning mode is Entity::POSITION_TOPLEFT, the entity is translated by half its width and half its height when it's rendered, making all other transformations relative to its top-left corner instead of the center.		
+			If the mode is Entity::POSITION_CENTER, the entity is rendered as is.
+			Set to POSITION_CENTER by default.
+			@param newPositionMode The new positioning mode.
+			*/
+			void setPositionMode(int newPositionMode);
+
+			/**
+			 * Get the position mode.
+			 * @see setPositionMode()
+			 */
+			int getPositionMode() const;
+		
+			/**
+			* Positioning mode in which you specify an entity's topleft corner
+			* as coordinate for placement.
+			*/
+		
+			static const int POSITION_TOPLEFT = 0;
+
+			/**
+			* Positioning mode in which you specify an entity's center as
+			* coordinate for placement.
+			*/
+			static const int POSITION_CENTER = 1;
+
+			bool processInputEvents;
+			
+			bool blockMouseInput;
+			
+			bool hasFocus;
+			bool focusable;
+			
+			Number width;
+			Number height;
+			
+			void setDragLimits(Rectangle rect) {}
+			void clearDragLimits() {}
+			bool isDragged() { return dragged; }
+			bool dragged;
+			void startDrag(Number xOffset, Number yOffset) {}
+			void stopDrag() {}
+			
+			void setHitbox(Number width, Number height) {}
+			
+			void focusChild(Entity *child) {}
+			void focusNextChild();
+			bool isFocusable();
+			
+			Vector2 getScreenPosition() const { return Vector2(); }
 
 
+			bool hitTest(Number x, Number y) const { return false; }
+			bool hitTest(Vector2 v) const { return false; }
 
 
+			bool snapToPixels;
 			//@}		
 			//@}		
 		protected:
 		protected:
 		
 		

+ 2 - 41
Core/Contents/Include/PolyParticleEmitter.h

@@ -26,8 +26,7 @@ THE SOFTWARE.
 #include "PolyVector3.h"
 #include "PolyVector3.h"
 #include "PolyMatrix4.h"
 #include "PolyMatrix4.h"
 #include "PolyBezierCurve.h"
 #include "PolyBezierCurve.h"
-#include "PolySceneEntity.h"
-#include "PolyScreenEntity.h"
+#include "PolyEntity.h"
 
 
 namespace Polycode {
 namespace Polycode {
 
 
@@ -276,7 +275,7 @@ namespace Polycode {
 	/**
 	/**
 	* 3D particle emitter.
 	* 3D particle emitter.
 	*/
 	*/
-	class _PolyExport SceneParticleEmitter : public SceneEntity, public ParticleEmitter {
+	class _PolyExport SceneParticleEmitter : public Entity, public ParticleEmitter {
 	public:
 	public:
 		/**
 		/**
 		* Constructor.
 		* Constructor.
@@ -324,42 +323,4 @@ namespace Polycode {
 		SceneMesh *emitterMesh;		
 		SceneMesh *emitterMesh;		
 	};	
 	};	
 		
 		
-	/**
-	* 3D particle emitter.
-	*/
-	class _PolyExport ScreenParticleEmitter : public ScreenEntity, public ParticleEmitter {
-	public:
-		ScreenParticleEmitter(const String& imageFile, int particleType, int emitterType, Number lifespan, unsigned int numParticles, Vector3 direction, Vector3 gravity, Vector3 deviation, Vector3 emitterRadius, Mesh *particleMesh = NULL, ScreenMesh *emitter = NULL);
-		virtual ~ScreenParticleEmitter();		
-		
-		virtual Entity *Clone(bool deepClone, bool ignoreEditorOnly) const;
-		virtual void applyClone(Entity *clone, bool deepClone, bool ignoreEditorOnly) const;
-		
-		/**
-		* Returns the emitter (helper method for LUA).
-		*/ 		
-		ParticleEmitter *getEmitter() { return this; }		
-		
-		void dispatchTriggerCompleteEvent();
-		
-		void addParticleBody(Entity *particleBody);
-		Matrix4 getBaseMatrix();
-		void Update();
-		
-		Vector3 getParticleCompoundScale();
-		
-			/**
-			* Continuous emitter setting.
-			*/ 																													
-			static const int CONTINUOUS_EMITTER = 0;
-
-			/**
-			* Triggered emitter setting.
-			*/ 																																
-			static const int TRIGGERED_EMITTER = 1;
-		
-		
-	protected:
-		ScreenMesh *emitterMesh;
-	};		
 }
 }

+ 15 - 25
Core/Contents/Include/PolyScene.h

@@ -25,6 +25,7 @@ THE SOFTWARE.
 #include "PolyString.h"
 #include "PolyString.h"
 #include "PolyColor.h"
 #include "PolyColor.h"
 #include "PolyVector3.h"
 #include "PolyVector3.h"
+#include "PolyEntity.h"
 #include "PolyEventDispatcher.h"
 #include "PolyEventDispatcher.h"
 
 
 #include <vector>
 #include <vector>
@@ -34,12 +35,12 @@ class OSFILE;
 namespace Polycode {
 namespace Polycode {
 		
 		
 	class Camera;
 	class Camera;
-	class SceneEntity;
+	class Entity;
 	class SceneLight;
 	class SceneLight;
-	class SceneMesh;
+	class Mesh;
 	
 	
 	/**
 	/**
-	* 3D rendering container. The Scene class is the main container for all 3D rendering in Polycode. Scenes are automatically rendered and need only be instantiated to immediately add themselves to the rendering pipeline. A Scene is created with a camera automatically.
+	* Rendering container. The Scene class is the main container for all rendering in Polycode. Scenes are automatically rendered and need only be instantiated to immediately add themselves to the rendering pipeline. A Scene is created with a camera automatically.
 	*/ 
 	*/ 
 	class _PolyExport Scene : public EventDispatcher {
 	class _PolyExport Scene : public EventDispatcher {
 	public:
 	public:
@@ -56,22 +57,22 @@ namespace Polycode {
 		virtual ~Scene();
 		virtual ~Scene();
 		
 		
 		/**
 		/**
-		* Adds a new SceneEntity to the scene
+		* Adds a new Entity to the scene
 		* @param entity New entity to add.
 		* @param entity New entity to add.
 		*/
 		*/
-		void addEntity(SceneEntity *entity);
+		void addEntity(Entity *entity);
 
 
 		/**
 		/**
-		* Adds a new SceneEntity to the scene
+		* Adds a new Entity to the scene
 		* @param entity New entity to add.
 		* @param entity New entity to add.
 		*/
 		*/
-		void addChild(SceneEntity *entity);
+		void addChild(Entity *entity);
 		
 		
 		/**
 		/**
-		* Removes a SceneEntity from the scene
+		* Removes a Entity from the scene
 		* @param entity New entity to remove.
 		* @param entity New entity to remove.
 		*/		
 		*/		
-		virtual void removeEntity(SceneEntity *entity);
+		virtual void removeEntity(Entity *entity);
 		
 		
 		/**
 		/**
 		* Returns the scene's default camera.
 		* Returns the scene's default camera.
@@ -120,17 +121,6 @@ namespace Polycode {
 		bool isEnabled();		
 		bool isEnabled();		
 		void setEnabled(bool enabled);
 		void setEnabled(bool enabled);
 		
 		
-		int getNumEntities() { return (int)entities.size(); }
-		SceneEntity *getEntity(int index) { return entities[index]; }
-		
-		/**
-		* Returns the entity at the specified screen position. This is currently very slow and not super reliable.
-		* @param x X position.
-		* @param y Y position.
-		* @return Entity at specified screen position.		
-		*/
-		SceneEntity *getEntityAtScreenPosition(Number x, Number y);
-		
 		void Render(Camera *targetCamera = NULL);
 		void Render(Camera *targetCamera = NULL);
 		void RenderDepthOnly(Camera *targetCamera);
 		void RenderDepthOnly(Camera *targetCamera);
 		
 		
@@ -144,8 +134,7 @@ namespace Polycode {
 		* Removes a light from the scene.
 		* Removes a light from the scene.
 		* @param light Light to remove from the scene.
 		* @param light Light to remove from the scene.
 		*/		
 		*/		
-		void removeLight(SceneLight *light);
-		
+		void removeLight(SceneLight *light);		
 		SceneLight *getNearestLight(Vector3 pos);
 		SceneLight *getNearestLight(Vector3 pos);
 				
 				
 		int getNumLights();
 		int getNumLights();
@@ -187,17 +176,18 @@ namespace Polycode {
 		*/
 		*/
 		bool ownsChildren;
 		bool ownsChildren;
 		
 		
+		Entity rootEntity;
+		
 	protected:
 	protected:
 		
 		
 		bool hasLightmaps;
 		bool hasLightmaps;
 		
 		
-		std::vector <SceneLight*> lights;
-		
+		Renderer *renderer;
+		std::vector <SceneLight*> lights;		
 		bool isSceneVirtual;
 		bool isSceneVirtual;
 		
 		
 		Camera *defaultCamera;
 		Camera *defaultCamera;
 		Camera *activeCamera;
 		Camera *activeCamera;
-		std::vector <SceneEntity*> entities;
 		
 		
 		bool lightingEnabled;
 		bool lightingEnabled;
 		bool fogEnabled;
 		bool fogEnabled;

+ 0 - 56
Core/Contents/Include/PolySceneEntity.h

@@ -1,56 +0,0 @@
-/*
-Copyright (C) 2011 by Ivan Safrin
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#pragma once
-#include "PolyEntity.h"
-#include "PolyEventDispatcher.h"
-
-namespace Polycode {
-
-	/**
-	* 3D base entity. SceneEntities are the base class for all 3D entities in Polycode. A thin wrapper around Entity, it inherits most of its functionality.
-	@see Entity
-	*/
-	class _PolyExport SceneEntity : public Entity {
-		public:
-			SceneEntity();
-			virtual ~SceneEntity();
-		
-			/**
-			* Test mouse collision on the scene entity at a specified screen point. Each SceneEntity subclass must implement this if it wants to support this feature.
-			* @param x X position on screen.
-			* @param y Y position on screen.			
-			* @return True if the entity is at the specified screen coordinate.
-			*/
-			virtual bool testMouseCollision(Number x, Number y) { return false;}
-			
-			/**
-			* If set to true, will cast shadows (Defaults to true).
-			*/
-			bool castShadows;
-			
-			int collisionShapeType;	
-			
-		protected:
-
-	};
-}

+ 20 - 19
Core/Contents/Include/PolyScreenImage.h → Core/Contents/Include/PolySceneImage.h

@@ -22,47 +22,48 @@ THE SOFTWARE.
 
 
 #pragma once
 #pragma once
 #include "PolyGlobals.h"
 #include "PolyGlobals.h"
-#include "PolyScreenShape.h"
+#include "PolyImage.h"
+#include "PolyScenePrimitive.h"
 
 
 namespace Polycode {
 namespace Polycode {
 
 
 	/**
 	/**
 	* 2D screen image display. This ScreenEntity can load and display and image.
 	* 2D screen image display. This ScreenEntity can load and display and image.
 	*/
 	*/
-	class _PolyExport ScreenImage : public ScreenShape {
+	class _PolyExport SceneImage : public ScenePrimitive {
 		public:
 		public:
 		/**
 		/**
 		* Create screen image from file.
 		* Create screen image from file.
 		* @param fileName 
 		* @param fileName 
 		*/
 		*/
-		ScreenImage(const String& fileName);
-		
+		SceneImage(const String& fileName);
+
 		/**
 		/**
 		* Create screen image from Image.
 		* Create screen image from Image.
 		* @param image Image to create from.
 		* @param image Image to create from.
 		*/		
 		*/		
-		ScreenImage(Image *image);		
-		
+		SceneImage(Image *image);		
+
 		/**
 		/**
 		 * Create screen image from Texture.
 		 * Create screen image from Texture.
 		 * @param texture Texture to create from.
 		 * @param texture Texture to create from.
 		 */		
 		 */		
-		ScreenImage(Texture *texture);		
-		
+		SceneImage(Texture *texture);		
+
 		/**
 		/**
 		* Create screen image from Image.
 		* Create screen image from Image.
 		* @param image Image to create from.
 		* @param image Image to create from.
 		*/				
 		*/				
-		static ScreenImage* ScreenImageWithImage(Image *image);
-		
+		static SceneImage* SceneImageWithImage(Image *image);
+
 		/**
 		/**
 		 * Create screen image from Texture.
 		 * Create screen image from Texture.
 		 * @param texture Texture to create from.
 		 * @param texture Texture to create from.
 		 */				
 		 */				
-		static ScreenImage* ScreenImageWithTexture(Texture *texture);
-		
-		virtual ~ScreenImage();
-		
+		static SceneImage* SceneImageWithTexture(Texture *texture);
+
+		virtual ~SceneImage();
+
 		virtual Entity *Clone(bool deepClone, bool ignoreEditorOnly) const;
 		virtual Entity *Clone(bool deepClone, bool ignoreEditorOnly) const;
 		virtual void applyClone(Entity *clone, bool deepClone, bool ignoreEditorOnly) const;
 		virtual void applyClone(Entity *clone, bool deepClone, bool ignoreEditorOnly) const;
 
 
@@ -74,22 +75,22 @@ namespace Polycode {
 		* @param height Height of the display rectangle.
 		* @param height Height of the display rectangle.
 		*/				
 		*/				
 		void setImageCoordinates(Number x, Number y, Number width, Number height);
 		void setImageCoordinates(Number x, Number y, Number width, Number height);
-		
+
 		/**
 		/**
 		* Returns the image width.
 		* Returns the image width.
 		*/ 
 		*/ 
 		Number getImageWidth() const;
 		Number getImageWidth() const;
-		
+
 		/**
 		/**
 		* Returns the image height.
 		* Returns the image height.
 		*/ 		
 		*/ 		
 		Number getImageHeight() const;
 		Number getImageHeight() const;
-		
+
 		protected:
 		protected:
 
 
 		Number imageWidth;
 		Number imageWidth;
 		Number imageHeight;
 		Number imageHeight;
-		
+
 	};
 	};
 
 
-}
+}

+ 9 - 0
Core/Contents/Include/PolySceneLabel.h

@@ -47,6 +47,13 @@ namespace Polycode {
 			* @param Anti-aliasing mode. Can be Label::ANTIALIAS_FULL or Label::ANTIALIAS_NONE.
 			* @param Anti-aliasing mode. Can be Label::ANTIALIAS_FULL or Label::ANTIALIAS_NONE.
 			*/			
 			*/			
 			SceneLabel(const String& fontName, const String& text, int size, Number scale, int amode, bool premultiplyAlpha = false);
 			SceneLabel(const String& fontName, const String& text, int size, Number scale, int amode, bool premultiplyAlpha = false);
+			
+			SceneLabel(const String& text, int size, const String& fontName = "sans", int amode = 0, bool premultiplyAlpha = false);
+
+			String getText();
+			
+			void Render();
+
 			virtual ~SceneLabel();			
 			virtual ~SceneLabel();			
 		
 		
 			/**
 			/**
@@ -57,6 +64,8 @@ namespace Polycode {
 			
 			
 			Label *getLabel();
 			Label *getLabel();
 			
 			
+			bool positionAtBaseline;
+			
 		protected:
 		protected:
 			
 			
 			void updateFromLabel();
 			void updateFromLabel();

+ 3 - 3
Core/Contents/Include/PolySceneLight.h

@@ -23,7 +23,7 @@ THE SOFTWARE.
 
 
 #pragma once
 #pragma once
 #include "PolyGlobals.h"
 #include "PolyGlobals.h"
-#include "PolySceneEntity.h"
+#include "PolyEntity.h"
 
 
 namespace Polycode {
 namespace Polycode {
 
 
@@ -36,7 +36,7 @@ namespace Polycode {
 	/**
 	/**
 	* 3D light source. Lights can be area or spot lights and can be set to different colors. 
 	* 3D light source. Lights can be area or spot lights and can be set to different colors. 
 	*/
 	*/
-	class _PolyExport SceneLight : public SceneEntity {
+	class _PolyExport SceneLight : public Entity {
 		public:
 		public:
 		
 		
 			/**
 			/**
@@ -183,7 +183,7 @@ namespace Polycode {
 			void setLightImportance(int newImportance);
 			void setLightImportance(int newImportance);
 			int getLightImportance() const;
 			int getLightImportance() const;
 		
 		
-			SceneEntity *lightShape;
+			Entity *lightShape;
 			
 			
 		protected:
 		protected:
 		
 		

+ 6 - 6
Core/Contents/Include/PolySceneLine.h

@@ -23,23 +23,23 @@ THE SOFTWARE.
 #pragma once
 #pragma once
 #include "PolyString.h"
 #include "PolyString.h"
 #include "PolyGlobals.h"
 #include "PolyGlobals.h"
-#include "PolySceneEntity.h"
+#include "PolyEntity.h"
 #include "PolyCoreServices.h"
 #include "PolyCoreServices.h"
 #include "PolyMesh.h"
 #include "PolyMesh.h"
 
 
 namespace Polycode {
 namespace Polycode {
 
 
 	/**
 	/**
-	* 3D line class. Can connect two SceneEntity classes with a line.
+	* 3D line class. Can connect two Entity classes with a line.
 	*/ 
 	*/ 
-	class _PolyExport SceneLine : public SceneEntity {
+	class _PolyExport SceneLine : public Entity {
 		public:
 		public:
 			/**
 			/**
 			* Constructs the line with two taraget entities.
 			* Constructs the line with two taraget entities.
 			* @param ent1 Starting entity.
 			* @param ent1 Starting entity.
 			* @param ent2 Ending entity.
 			* @param ent2 Ending entity.
 			*/
 			*/
-			SceneLine(SceneEntity *ent1, SceneEntity *ent2);
+			SceneLine(Entity *ent1, Entity *ent2);
 			
 			
 			/**
 			/**
 			* Constructs the line with two taraget positions.
 			* Constructs the line with two taraget positions.
@@ -71,8 +71,8 @@ namespace Polycode {
 			
 			
 			Vector3 start;
 			Vector3 start;
 			Vector3 end;			
 			Vector3 end;			
-			SceneEntity *ent1;
-			SceneEntity *ent2;
+			Entity *ent1;
+			Entity *ent2;
 	};
 	};
 
 
 }
 }

+ 6 - 3
Core/Contents/Include/PolySceneMesh.h

@@ -22,7 +22,7 @@ THE SOFTWARE.
  
  
 #pragma once
 #pragma once
 #include "PolyGlobals.h"
 #include "PolyGlobals.h"
-#include "PolySceneEntity.h"
+#include "PolyEntity.h"
 #include "PolyShader.h"
 #include "PolyShader.h"
 
 
 namespace Polycode {
 namespace Polycode {
@@ -31,11 +31,12 @@ namespace Polycode {
 	class Mesh;
 	class Mesh;
 	class Texture;
 	class Texture;
 	class Skeleton;
 	class Skeleton;
+	class Image;
 	
 	
 	/**
 	/**
 	* 3D polygonal mesh instance. The SceneMesh is the base for all polygonal 3d geometry. It can have simple textures or complex materials applied to it.
 	* 3D polygonal mesh instance. The SceneMesh is the base for all polygonal 3d geometry. It can have simple textures or complex materials applied to it.
 	*/
 	*/
-	class _PolyExport SceneMesh : public SceneEntity {
+	class _PolyExport SceneMesh : public Entity {
 		public:
 		public:
 		
 		
 			/**
 			/**
@@ -80,7 +81,7 @@ namespace Polycode {
 			/**
 			/**
 			* Returns the texture applied.
 			* Returns the texture applied.
 			*/				
 			*/				
-			Texture *getTexture();
+			Texture *getTexture() const;
 			
 			
 			/**
 			/**
 			* Returns the material applied.
 			* Returns the material applied.
@@ -93,6 +94,8 @@ namespace Polycode {
 			* @param clamp If true, clamps the texture to edges. See Texture for details on that.
 			* @param clamp If true, clamps the texture to edges. See Texture for details on that.
 			*/
 			*/
 			void loadTexture(const String& fileName);
 			void loadTexture(const String& fileName);
+
+			void loadTextureFromImage(Image *image);
 			
 			
 			/**
 			/**
 			* Loads a skeleton from a file and applies it to the scene mesh.
 			* Loads a skeleton from a file and applies it to the scene mesh.

+ 13 - 2
Core/Contents/Include/PolyScenePrimitive.h

@@ -23,6 +23,7 @@ THE SOFTWARE.
 #pragma once
 #pragma once
 #include "PolyGlobals.h"
 #include "PolyGlobals.h"
 #include "PolySceneMesh.h"
 #include "PolySceneMesh.h"
+#include "PolyMesh.h"
 
 
 namespace Polycode {
 namespace Polycode {
 
 
@@ -45,6 +46,10 @@ namespace Polycode {
 			ScenePrimitive(int type, Number v1=1.0f, Number v2=1.0f, Number v3=1.0f,Number v4=0.0f,Number v5=0.0f);
 			ScenePrimitive(int type, Number v1=1.0f, Number v2=1.0f, Number v3=1.0f,Number v4=0.0f,Number v5=0.0f);
 			virtual ~ScenePrimitive();
 			virtual ~ScenePrimitive();
 
 
+			void setPrimitiveOptions(int type, Number v1=1.0f, Number v2=1.0f, Number v3=1.0f,Number v4=0.0f,Number v5=0.0f);
+
+			void recreatePrimitive();
+		
 			/**
 			/**
 			* A cube.
 			* A cube.
 			* v1 - X size
 			* v1 - X size
@@ -109,10 +114,16 @@ namespace Polycode {
 			*/			
 			*/			
 			static const int TYPE_UNCAPPED_CYLINDER = 7;
 			static const int TYPE_UNCAPPED_CYLINDER = 7;
 							
 							
-
 		
 		
 		protected:
 		protected:
-		
+
+			int type;
+			Number v1;
+			Number v2;
+			Number v3;
+			Number v4;
+			Number v5;			
+												
 	};
 	};
 	
 	
 }
 }

+ 3 - 3
Core/Contents/Include/PolySceneSound.h

@@ -22,7 +22,7 @@ THE SOFTWARE.
 
 
 #pragma once
 #pragma once
 #include "PolyGlobals.h"
 #include "PolyGlobals.h"
-#include "PolySceneEntity.h"
+#include "PolyEntity.h"
 
 
 namespace Polycode {
 namespace Polycode {
 
 
@@ -31,7 +31,7 @@ namespace Polycode {
 	/**
 	/**
 	* Creates a positional 3D sound listener. There can be only one listener active at any one time.
 	* Creates a positional 3D sound listener. There can be only one listener active at any one time.
  	*/	
  	*/	
-	class _PolyExport SceneSoundListener : public SceneEntity {
+	class _PolyExport SceneSoundListener : public Entity {
 		public:
 		public:
 			SceneSoundListener();
 			SceneSoundListener();
 			virtual ~SceneSoundListener();			
 			virtual ~SceneSoundListener();			
@@ -42,7 +42,7 @@ namespace Polycode {
 	/**
 	/**
 	* Creates a positional 3D sound.
 	* Creates a positional 3D sound.
 	*/	
 	*/	
-	class _PolyExport SceneSound : public SceneEntity {
+	class _PolyExport SceneSound : public Entity {
 		public:
 		public:
 			SceneSound(const String& fileName, Number referenceDistance, Number maxDistance, bool directionalSound = false);
 			SceneSound(const String& fileName, Number referenceDistance, Number maxDistance, bool directionalSound = false);
 			virtual ~SceneSound();			
 			virtual ~SceneSound();			

+ 0 - 154
Core/Contents/Include/PolyScreen.h

@@ -1,154 +0,0 @@
-/*
-Copyright (C) 2011 by Ivan Safrin
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-
-#pragma once
-#include "PolyGlobals.h"
-#include "PolyVector2.h"
-#include "PolyEventDispatcher.h"
-#include "PolyScreenEntity.h"
-#include <vector>
-
-namespace Polycode {
-
-	class InputEvent;
-	class Renderer;
-	class Material;
-	class Texture;
-	class ShaderBinding;
-
-	/**
-	* 2D rendering base. The Screen is the container for all 2D rendering in Polycode. Screens are automatically rendered and need only be instantiated to immediately add themselves to the rendering pipeline. Each screen has a root entity.
-	*/	
-	class _PolyExport Screen : public EventDispatcher {
-	public:
-		
-		/**
-		* Default constructor.
-		*/
-		Screen();
-		virtual ~Screen();
-		
-		/**
-		* Adds a ScreenEntity to the 2d rendering pipeline.
-		* @param newEntity Entity to add.
-		*/		
-		void addChild(ScreenEntity *newEntity);
-
-		/**
-		* Adds a ScreenEntity to the 2d rendering pipeline.
-		* @param newEntity Entity to add.
-		*/		
-		void addEntity(ScreenEntity *newEntity);
-		
-		/**
-		* Removes a ScreenEntity from the screen's root entity
-		* @param entityToRemove Entity to remove.
-		*/				
-		virtual void removeChild(ScreenEntity *entityToRemove);
-				
-		/**
-		* Sets the screen's offset. You can also translate the root entity to do the same thing.
-		* @param x New x offset.
-		* @param y New y offset.		
-		*/						
-		void setScreenOffset(Number x, Number y);
-				
-		virtual void Shutdown();
-		virtual void Update();
-				
-		void Render();
-		void setRenderer(Renderer *renderer);
-
-		/**
-		* Changes the screen's coordinate system. By default, screens' dimensions are in pixels. To accommodate changing resolutions without changing the dimensions of a screen's content, you can call this method to make it use normalized coordinates.
-		* @param newVal If true, the screen will use normalized coordinates, if false, it will use pixel coordinates.
-		* @param yCoordinateSize The normalized size of the screen vertically. The horizontal size will be calculated based on the resolution.
-		*/		
-		void setNormalizedCoordinates(bool newVal, Number yCoordinateSize = 1.0f);
-		
-		/**
-		* Sets the shader material to use for post processing on this screen.
-		* @param shaderName Name of the shader material to use.
-		*/				
-		void setScreenShader(const String& shaderName);
-		
-		/**
-		* Removes the current screen shader for this screen.
-		*/
-		void clearScreenShader();		
-
-		void handleInputEvent(InputEvent *inputEvent);
-		
-		/**
-		* Returns true if the screen has a shader applied to it.
-		*/				
-		bool hasFilterShader() const;
-		void drawFilter();
-		
-		bool usesNormalizedCoordinates() const { return useNormalizedCoordinates; }
-		Number getYCoordinateSize() const { return yCoordinateSize; }
-				
-		/**
-		* If set to false, the screen will not be rendered or updated.
-		*/
-		bool enabled;
-		
-		/**
-		* Returns the local shader options for the camera post processing material.
-		*/				
-		const std::vector<ShaderBinding*>& getLocalShaderOptions() const { return localShaderOptions; }
-		
-		/**
-		* Returns the shader material applied to the camera.
-		*/					
-		Material *getScreenShaderMaterial() const { return filterShaderMaterial; }
-		
-		/**
-		* If set to true, will process touch events as mouse clicks. Defaults to false.
-		*/		
-		bool processTouchEventsAsMouse;
-		
-		/**
-		* If ownsChildren is set to true, the scene will delete its children upon destruction (defaults to false).
-		*/
-		bool ownsChildren;		
-		
-
-		ScreenEntity rootEntity;
-				
-	protected:
-	
-		Vector2 offset;
-		
-		bool useNormalizedCoordinates;
-		Number yCoordinateSize;		
-		
-		Renderer *renderer;
-		ScreenEntity *focusChild;
-		
-		Material *filterShaderMaterial;			
-		Texture *originalSceneTexture;				
-		std::vector<ShaderBinding*> localShaderOptions;
-		bool _hasFilterShader;
-	};
-}

+ 0 - 357
Core/Contents/Include/PolyScreenEntity.h

@@ -1,357 +0,0 @@
-/*
-Copyright (C) 2011 by Ivan Safrin
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-
-#pragma once
-#include "PolyGlobals.h"
-#include "PolyVector2.h"
-#include "PolyMatrix4.h"
-#include "PolyRectangle.h"
-#include "PolyInputKeys.h"
-#include "PolyEntity.h"
-#include "PolyObject.h"
-#include "PolyEventDispatcher.h"
-
-namespace Polycode {
-
-	class _PolyExport MouseEventResult {
-		public:
-			bool hit;
-			bool blocked;
-	};
-
-/**
-* 2D Entity base.
-*
-* The ScreenEntity is the base class for all 2D elements in Polycode. They can be added to a screen or to other ScreenEntities and are rendered automatically. If you want to create custom screen objects, subclass this. ScreenEntity subclasses Entity, which use 3d positioning and tranformation, but provides some 2d-only versions of the transformation functions for convenience.
-*/
-class _PolyExport ScreenEntity : public Entity {
-		
-	public:
-		using Entity::setPosition;		
-		using Entity::setScale;		
-
-		ScreenEntity();
-		virtual ~ScreenEntity();
-		
-		virtual Entity *Clone(bool deepClone, bool ignoreEditorOnly) const;
-		virtual void applyClone(Entity *clone, bool deepClone, bool ignoreEditorOnly) const;
-
-		void addEntity(Entity *newChild);
-		
-		/**
-		* Set 2d position.
-		* @param x Horizontal position.
-		* @param y Vertical position.
-		*/
-		void setPosition(Number x, Number y);
-
-		/**
-		* Set 2d position.
-		* @param v New 2D position vector.
-		*/
-		void setPosition(const Vector2 &v);
-
-		
-		/**
-		* Set 2d scale.
-		* @param x Horizontal scale.
-		* @param y Vertical scale.
-		*/		
-		void setScale(Number x, Number y);
-		
-		/**
-		* Set 2d scale.
-		* @param v New 2D scale vector.
-		*/
-		void setScale(const Vector2 &v);
-		
-		
-		/**
-		* Set 2d rotation.
-		* @param rotation New rotation value in degrees.
-		*/				
-		void setRotation(Number rotation);
-		
-		/**
-		* Returns current rotation.
-		* @return Current rotation value.
-		*/						
-		Number getRotation() const;
-			
-		MouseEventResult _onMouseDown(Number x, Number y, int mouseButton, int timestamp);
-		MouseEventResult _onMouseUp(Number x, Number y, int mouseButton, int timestamp);
-		MouseEventResult _onMouseMove(Number x, Number y, int timestamp);
-		MouseEventResult _onMouseWheelUp(Number x, Number y, int timestamp);
-		MouseEventResult _onMouseWheelDown(Number x, Number y, int timestamp);
-	
-		virtual void onMouseDown(Number x, Number y){}
-		virtual void onMouseUp(Number x, Number y){}
-		virtual	void onMouseMove(Number x, Number y){}
-		virtual void onMouseWheelUp(Number x, Number y) {}
-		virtual void onMouseWheelDown(Number x, Number y) {}
-	
-		void _onKeyDown(PolyKEY key, wchar_t charCode);	
-		void _onKeyUp(PolyKEY key, wchar_t charCode);	
-		
-		Matrix4 getScreenConcatenatedMatrix() const;
-		
-		virtual void onKeyDown(PolyKEY key, wchar_t charCode){}
-		virtual void onKeyUp(PolyKEY key, wchar_t charCode){}
-		
-		bool hitTest(Number x, Number y) const;
-		bool hitTest(Vector2 v) const;
-	
-		Matrix4 buildPositionMatrix();
-		void adjustMatrixForChildren();
-		
-		/**
-		* Returns the width of the screen entity.
-		* @return Height of the screen entity.
-		*/									
-		Number getWidth() const;
-		
-		/**
-		* Returns the height of the screen entity.
-		*/											
-		Number getHeight() const;
-	
-		/**
-		* Sets the width of the screen entity.
-		* @param w New height value.
-		*/									
-		void setWidth(Number w) { width = w; hit.w = w; hit.x = -w/2; }
-		
-		/**
-		* Sets the height of the screen entity.
-		* @param h New height value.
-		*/									
-		void setHeight(Number h) { height = h; hit.h = h; hit.y = -h/2; }
-	
-		virtual void onGainFocus(){}
-		virtual void onLoseFocus(){}		
-		
-		void startDrag(Number xOffset, Number yOffset);
-		void stopDrag();		
-				
-		void setBlendingMode(int newBlendingMode);
-		
-		/** 
-		* Changes the positioning mode of the screen entity.		
-		
-		If the positioning mode is ScreenEntity::POSITION_TOPLEFT, the entity is translated by half its width and half its height when it's rendered, making all other transformations relative to its top-left corner instead of the center.		
-		If the mode is ScreenEntity::POSITION_CENTER, the entity is rendered as is.
-		Set to POSITION_CENTER by default.
-		@param newPositionMode The new positioning mode.
-		*/
-		void setPositionMode(int newPositionMode);
-
-		/**
-		 * Get the position mode.
-		 * @see setPositionMode()
-		 */
-		int getPositionMode() const;
-
-		/**
-		 * Set a rectangle to which dragging will be restricted.
-		 *
-		 * Dragging the item past the given rectangle will snap it
-		 * back to the edge of the rectangle.
-		 *
-		 * @param rect The rectangle to restrict dragging to. Uses the
-		 *              same positioning mode as `this->position`.
-		 */
-		void setDragLimits(Rectangle rect);
-
-		/**
-		 * Disable restricting where `this` can be dragged.
-		 * @see setDragLimits()
-		 */
-		void clearDragLimits();
-
-		/**
-		 * Set options for `this` and all children recursively.
-		 *
-		 * @param snapToPixels Whether to snap entity positions to pixels before rendering.
-		 */
-		void setDefaultScreenOptions(bool snapToPixels);
-
-		/*
-		 * Make `child` take focus, which will cause certain events
-		 * to be sent to it.
-		 *
-		 * Note that this is a global setting. Only one Entity per
-		 * running instance can take focus.
-		 */
-		void focusChild(ScreenEntity *child);
-		
-		/*
-		 * Make the next child in `this->children`, after the currently
-		 * focused child entity take focus.
-		 *
-		 * Does nothing if no child of `this` has focus.
-		 */
-		void focusNextChild();
-
-		/**
-		 * @name Child position operations.
-		 * 
-		 * Move a child in the list of children. Affects display
-		 * order of entities(entities further down in the list will
-		 * appear on top).
-		 */
-		//@{	
-		void moveChildUp(ScreenEntity *child);
-		void moveChildDown(ScreenEntity *child);
-		void moveChildTop(ScreenEntity *child);
-		void moveChildBottom(ScreenEntity *child);
-		//}@
-
-		/**
-		 * Same semantics as getPosition(), but returns only the x and y coordinates.
-		 * 
-		 * @see getPosition()
-		 * @see getScreenPosition()
-		 */
-		Vector2 getPosition2D() const;
-		
-		/**
-		 * Get the position of ScreenEntity in relation to the top-left
-		 * corner of the Polycode screen it's on.
-		 *
-		 * This is unlike getPosition(), which will return the position
-		 * of an Entity in relation to its parent Entity.
-		 *
-		 * @see getPosition()
-		 */
-		Vector2 getScreenPosition() const;
-
-		/**
-		 * Same semantics as getScale(), but returns only the x and y scale.
-		 *
-		 * @see getScale()
-		 */
-		Vector2 getScale2D() const;
-
-		/**
-		 * Positioning mode in which you specify an entity's topleft corner
-		 * as coordinate for placement.
-		 */
-		static const int POSITION_TOPLEFT = 0;
-
-		/**
-		 * Positioning mode in which you specify an entity's center as
-		 * coordinate for placement.
-		 */
-		static const int POSITION_CENTER = 1;
-
-		bool isFocusable() const;
-		
-		bool hasFocus;
-		
-		/**
-		 * Does the same as getEntityByID, but casts to ScreenEntity.
-		 *
-		 * Note: Make sure only entities of type ScreenEntity have the tag you're
-		 *       querying, or otherwise you will be treating an Entity as ScreenEntity.
-		 */
-		ScreenEntity *getScreenEntityById(String id, bool recursive) const;
-
-		/**
-		 * Does the same as getEntitiesByID, but casts each result to ScreenEntity.
-		 *
-		 * Note: Make sure only entities of type ScreenEntity have the tag you're
-		 *       querying, or otherwise you will be treating an Entity as ScreenEntity.
-		 */
-		std::vector<ScreenEntity*> getScreenEntitiesByTag(String tag, bool recursive) const;
-		
-		/**
-		* If set to true, will block mouse events for underlaying entities.
-		* (NOTE: processInputEvents must be set to true)
-		*/
-		bool blockMouseInput;	
-	
-		/**
-		* If this option is true, the screen entity's positions will be roudnded to whole pixels. This only works if the screen is using pixel coordinates.
-		*/
-		bool snapToPixels;
-		bool processInputEvents;
-
-		/**
-		 * Get the hitbox of this ScreenEntity.
-		 * @see setHitBox()
-		 */
-		Rectangle getHitbox() const;
-
-
-		void setHitbox(Number width, Number height);
-
-		/**
-		 * Set the hitbox of this ScreenEntity.
-		 *
-		 * The hitbox determines the "physical" dimensions of the entity.
-		 * 
-		 * For instance, when it is checked whether you clicked an entity,
-		 * it is checked whether the mouse was pointing inside the hitbox.
-		 *
-		 * The hitbox is measured from the entity's center, so a hitbox covering
-		 * a square would be `(-square.w/2, -square.h/2, square.w, square.h)`
-		 *
-		 * @param left The left of the hitbox, as measured from the entity's center.
-		 * @param top The top of the hitbox, as measured from the entity's center.
-		 * @param width The width of the hitbox.
-		 * @param height The height of the hitbox.
-		 */
-		void setHitbox(Number width, Number height, Number left, Number top);
-
-		Number width;
-		Number height;
-		
-		/**
-		 * Get the drag status (true if currently being dragged) of the entity.
-		 */
-		bool isDragged();
-
-	protected:
-	
-		bool focusable;
-		bool focusChildren;
-		
-		bool dragged;
-		Number dragOffsetX;
-		Number dragOffsetY;
-		
-		bool mouseOver;
-
-		Rectangle hit;
-		
-		Number xmouse;
-		Number ymouse;
-		
-		int positionMode;		
-		Rectangle *dragLimits;
-		
-		int lastClickTicks;
-
-};
-
-}

+ 0 - 91
Core/Contents/Include/PolyScreenEntityInstance.h

@@ -1,91 +0,0 @@
-/*
-Copyright (C) 2011 by Ivan Safrin
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-
-#pragma once
-#include "PolyGlobals.h"
-#include "PolyScreenEntity.h"
-#include "PolyObject.h"
-#include "PolyScreenShape.h"
-#include "PolyScreenImage.h"
-#include "PolyScreenLabel.h"
-#include "PolyScreenSound.h"
-#include "PolyScreenSprite.h"
-#include "PolyParticleEmitter.h"
-#include "PolyParticle.h"
-#include "PolyResource.h"
-#include "PolySound.h"
-
-namespace Polycode {
-
-class ScreenEntityInstanceResourceEntry;
-
-class ScreenEntityInstance : public ScreenEntity {
-	public:
-		ScreenEntityInstance(const String& fileName);
-		ScreenEntityInstance();
-		
-		static ScreenEntityInstance *BlankScreenEntityInstance();
-
-		virtual ~ScreenEntityInstance();
-	
-		virtual Entity *Clone(bool deepClone, bool ignoreEditorOnly) const;
-		virtual void applyClone(Entity *clone, bool deepClone, bool ignoreEditorOnly) const;
-		
-		void reloadEntityInstance();
-
-		void clearInstance();
-
-		void parseObjectIntoCurve(ObjectEntry *entry, BezierCurve *curve);
-		void applyScreenShape(ObjectEntry *entry, ScreenShape *shape);
-		ScreenEntity *loadObjectEntryIntoEntity(ObjectEntry *entry, ScreenEntity *targetEntity = NULL);
-		bool loadFromFile(const String& fileName);
-		
-		
-		ScreenEntityInstanceResourceEntry *getResourceEntry();
-		
-		String getFileName() const;
-		
-		bool cloneUsingReload;
-
-		String fileName;
-		
-	protected:
-		
-		ScreenEntityInstanceResourceEntry *resourceEntry;
-		
-};
-
-class ScreenEntityInstanceResourceEntry : public Resource {
-	public:
-		ScreenEntityInstanceResourceEntry(ScreenEntityInstance *instance);
-		virtual ~ScreenEntityInstanceResourceEntry();
-		
-		ScreenEntityInstance *getInstance();
-		void reloadResource();
-		
-	protected:
-		ScreenEntityInstance* instance;
-};
-
-
-}

+ 0 - 44
Core/Contents/Include/PolyScreenEvent.h

@@ -1,44 +0,0 @@
-/*
-Copyright (C) 2011 by Ivan Safrin
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-
-#pragma once
-#include "PolyString.h"
-#include "PolyGlobals.h"
-#include "PolyEvent.h"
-
-namespace Polycode {
-
-	class _PolyExport ScreenEvent : public Event {
-		public:
-			ScreenEvent();
-			virtual ~ScreenEvent();
-		
-			static const int ENTITY_MOVE_TOP = 0;
-			static const int ENTITY_MOVE_BOTTOM = 1;
-			static const int ENTITY_MOVE_UP = 2;
-			static const int ENTITY_MOVE_DOWN = 3;
-			
-		protected:		
-			
-	};
-}

+ 0 - 73
Core/Contents/Include/PolyScreenLabel.h

@@ -1,73 +0,0 @@
-/*
-Copyright (C) 2011 by Ivan Safrin
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#pragma once
-#include "PolyGlobals.h"
-#include "PolyScreenShape.h"
-
-namespace Polycode {
-
-	class Label;
-	class ScreenImage;
-
-	/**
-	* 2D screen label display. Displays 2d text in a specified font.
-	*/ 
-	class _PolyExport ScreenLabel : public ScreenShape {
-		public:
-			
-			/**
-			* Constructor.
-			* @param fontName Name of a registered font to use. @see FontManager for info on how to register fonts.
-			* @param text Text to display.
-			* @param size Size in pixels.
-			* @param Anti-aliasing mode.
-			*/
-			ScreenLabel(const String& text, int size, const String& fontName = "sans", int amode = 0, bool premultiplyAlpha = false);
-			virtual ~ScreenLabel();		
-		
-			virtual Entity *Clone(bool deepClone, bool ignoreEditorOnly) const;
-			virtual void applyClone(Entity *clone, bool deepClone, bool ignoreEditorOnly) const;
-					
-			/**
-			* Sets a new text to the screen label.
-			* @param newText Text to set.
-			*/
-			void setText(const String& newText);			
-			
-			/**
-			* Returns the label's text as a string.
-			* @return The label's text.
-			*/
-			const String& getText() const;
-		
-			Label *getLabel() const;
-			
-			void Render();
-			bool positionAtBaseline;
-			
-		protected:
-			
-			void updateTexture();			
-			Label *label;
-	};
-}

+ 0 - 83
Core/Contents/Include/PolyScreenLine.h

@@ -1,83 +0,0 @@
-/*
-Copyright (C) 2011 by Ivan Safrin
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#pragma once
-#include "PolyGlobals.h"
-#include "PolyScreenMesh.h"
-
-namespace Polycode {
-
-	class Vertex;
-
-	/**
-	* A 2D line between two points or two ScreenEntity instances.
-	*/ 
-	class _PolyExport ScreenLine : public ScreenMesh {
-		public:
-			/**
-			* Create a line between two points.
-			* @start Starting point.
-			* @end Enfing point.	
-			*/
-			ScreenLine(Vector2 start, Vector2 end);
-			
-			/**
-			* Create a line between two entities. It's automatically updated every frame to follow the entities.
-			* @target1 Starting target.
-			* @target2 Ending target.
-			*/			
-			ScreenLine(ScreenEntity* target1, ScreenEntity* target2);
-			virtual ~ScreenLine();
-			
-			void setStart(Vector2 point);
-			void setEnd(Vector2 point);
-						
-			/**
-			* Create a line between two entities. It's automatically updated every frame to follow the entities.
-			* @target1 Starting target.
-			* @target2 Ending target.
-			*/							
-			static ScreenLine *ScreenLineBetweenEntities(ScreenEntity* target1, ScreenEntity* target2);			
-
-			void Update();
-			void Render();
-			
-			/**
-			* Sets the line width.
-			* @param width New line width.
-			*/
-			void setLineWidth(Number width);
-			
-		protected:
-		
-			void initMesh();
-		
-			Number lineWidth;
-			
-			Vertex *startVertex;
-			Vertex *endVertex;
-		
-			ScreenEntity *target1;
-			ScreenEntity *target2;
-			
-	};
-}

+ 0 - 63
Core/Contents/Include/PolyScreenManager.h

@@ -1,63 +0,0 @@
-/*
-Copyright (C) 2011 by Ivan Safrin
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#pragma once
-#include "PolyGlobals.h"
-#include "PolyEventDispatcher.h"
-#include <vector>
-
-namespace Polycode {
-
-	class Screen;
-
-	/**
-	* 2D Screen manager. Must be accessed via CoreServices. Screens are automatically added to the manager when they are created, so there is no need to manually add them.
-	*/ 
-	class _PolyExport ScreenManager : public EventDispatcher {
-		public:		
-		ScreenManager();
-		~ScreenManager();
-		
-		/**
-		* Removes a screen from the manager, taking it out of the render loop.
-		* @param screen Screen to remove. 
-		*/
-		void removeScreen(Screen *screen);
-		void addScreen(Screen* screen);
-		void Update();
-		void Render();
-		
-		void handleEvent(Event *event);
-		
-			
-		/**
-		* If set to true, will draw Screens before Scenes (defaults to false).
-		*/	
-		bool drawScreensFirst;
-					
-		private:
-		
-		std::vector <Screen*> screens;
-			
-	};
-
-}

+ 0 - 148
Core/Contents/Include/PolyScreenMesh.h

@@ -1,148 +0,0 @@
-/*
-Copyright (C) 2011 by Ivan Safrin
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#pragma once
-#include "PolyGlobals.h"
-#include "PolyScreenEntity.h"
-#include "PolyMesh.h"
-#include "PolyMaterial.h"
-
-namespace Polycode {
-
-	class Image;
-	class Texture;
-
-	/**
-	* 2D Mesh. ScreenMesh is the base for most geometry-based screen entities. It's based aroudn a Mesh instance, like its 3D counterpart (SceneMesh), but currently has fewer options.
-	* @see Mesh
-	*/
-	class _PolyExport ScreenMesh : public ScreenEntity {
-		public:
-		
-			/**
-			* Creates the screen mesh and loads a mesh from a file name.
-			*/
-			ScreenMesh(const String& fileName);
-		
-			/**
-			* Creates the screen mesh from existing Mesh.
-			*/
-			ScreenMesh(Mesh *mesh);
-						
-			/**
-			* Create an empty screen mesh of specified type. See Mesh for available mesh types.
-			*/
-			ScreenMesh(int meshType);
-			
-			/**
-			* Create an empty screen mesh of specified type. See Mesh for available mesh types.
-			*/
-			static ScreenMesh *ScreenMeshWithType(int meshType);
-			
-			/**
-			* Creates the screen mesh from existing Mesh.
-			*/			
-			static ScreenMesh *ScreenMeshWithMesh(Mesh *mesh);
-						
-			virtual ~ScreenMesh();
-			
-			void Render();
-			
-			/**
-			* Returns the mesh for this screen mesh.
-			* @return The mesh.
-			*/
-			Mesh *getMesh() const;
-			
-			/**
-			* Returns the texture associated with the mesh.
-			*/
-			Texture *getTexture() const;
-			
-			/**
-			* Loads a texture from an image file.
-			* @param fileName Path to the image file.
-			*/
-			void loadTexture(const String& fileName);
-			
-			/**
-			* Loads a texture from an image instance.
-			* @param image Image instance.
-			*/			
-			void loadTexture(Image *image);	
-			
-			/**
-			* Applies a texture
-			* @param texture to apply.
-			*/						
-			void setTexture(Texture *texture);
-			
-			/**
-			* Set material from existing Material instance.
-			* @param material Material to apply.
-			*/												
-			void setMaterial(Material *material);
-
-			/**
-			* Set material by name. You can create materials in material files and name them there, then use this to set a material by name to a scene mesh.
-			* @param materialName Name of material to apply.
-			*/									
-			void setMaterialByName(const String& materialName);
-			
-			/**
-			* Clears the currently applied material
-			*/
-			void clearMaterial();
-			
-			/**
-			* Returns the material applied.
-			*/							
-			Material *getMaterial();			
-			
-			
-			ShaderBinding *getLocalShaderOptions();
-						
-			/**
-			* If this is set to true, the lines in wireframe meshes will be anti-aliased if the support is available in the renderer.
-			*/			
-			bool lineSmooth;
-			
-			Number lineWidth;
-			
-			/**
-			* If true, will delete its Mesh upon destruction. (defaults to true)
-			*/ 			
-			bool ownsMesh;
-		
-			/**
-			 * Updates hit.width, hit.height to coordinates of mesh.
-			 */
-			void updateHitBox();
-		
-		protected:
-		
-			Material *material;
-			ShaderBinding *localShaderOptions;			
-			Mesh *mesh;
-			Texture *texture;
-	};
-}

+ 0 - 132
Core/Contents/Include/PolyScreenShape.h

@@ -1,132 +0,0 @@
-/*
-Copyright (C) 2011 by Ivan Safrin
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#pragma once
-#include "PolyGlobals.h"
-#include "PolyScreenMesh.h"
-
-namespace Polycode {
-
-	class Polygon;
-
-	/**
-	* 2D primitive. Screen shape can create 2d shapes (Currently only rectangles and circles). 
-	*/ 
-	class _PolyExport ScreenShape : public ScreenMesh {
-		public:
-			
-			/**
-			* Create a new shape of specified type and size/options.
-			* @param shapeType Type of shape to create. Currently the only options are ScreenShape::SHAPE_RECT and ScreenShape::SHAPE_CIRCLE.
-			* @param option1 Width option.
-			* @param option2 Height option.
-			* @param option3 Number of vertices for the the circle (defaults to 360). Unused for rectangle.
-			* @param option4 Reserved.
-			*/
-			ScreenShape(int shapeType, Number option1=0, Number option2=0, Number option3=0, Number option4=0);
-		
-			virtual Entity *Clone(bool deepClone, bool ignoreEditorOnly) const;
-			virtual void applyClone(Entity *clone, bool deepClone, bool ignoreEditorOnly) const;
-				
-			virtual ~ScreenShape();
-			void Render();
-
-			/**
-			* Sets the color of the shape stroke if it's enabled.
-			* @param r Red value 0-1.
-			* @param g Green value 0-1
-			* @param b Blue value 0-1
-			* @param a Alpha value 0-1									
-			* @see strokeEnabled
-			*/
-			void setStrokeColor(Number r, Number g, Number b, Number a);
-			
-			/**
-			* Sets the width of the shape stroke if it's enabled.
-			* @param width New stroke width.
-			* @see strokeEnabled
-			*/
-			void setStrokeWidth(Number width);
-
-			/**
-			* Colors the shape with a gradient. Radial for circles, linear for rectangles.
-			* @param width New stroke width.
-			* @param r1 Red value of the first gradient color 0-1.
-			* @param g1 Green value of the first gradient color 0-1
-			* @param b1 Blue value of the first gradient color 0-1
-			* @param a1 Alpha value of the first gradient color 0-1									
-			* @param r2 Red value of the second gradient color 0-1.
-			* @param g2 Green value of the second gradient color 0-1
-			* @param b2 Blue value of the second gradient color 0-1
-			* @param a2 Alpha value of the second gradient color 0-1												
-			* @see strokeEnabled
-			*/			
-			void setGradient(Number r1, Number g1, Number b1, Number a1, Number r2, Number g2, Number b2, Number a2);
-			
-			/**
-			* Removes the gradient from the shape.
-			*/
-			void clearGradient();
-			
-			int getShapeType() const;
-			
-			void setShapeType(unsigned int type);
-
-			void setShapeSize(Number newWidth, Number newHeight);		
-		
-			void buildShapeMesh();
-			
-			/**
-			* Assignment operator
-			*/
-			void operator=(const ScreenShape& copy);
-			
-			static const int SHAPE_RECT = 1;
-			static const int SHAPE_CIRCLE = 2;
-			static const int SHAPE_CUSTOM = 4;
-			
-			/**
-			* If set to true, the shape will be drawn over with a stroke.
-			*/			
-			bool strokeEnabled;
-			
-			/**
-			* Color of the shape stroke.
-			*/
-			Color strokeColor;
-
-			/**
-			* Width of the shape stroke.
-			*/			
-			Number strokeWidth;
-						
-		protected:
-		
-			Number option1;
-			Number option2;
-			Number option3;
-			Number option4;
-									
-			int shapeType;
-			
-	};
-}

+ 0 - 65
Core/Contents/Include/PolyScreenSound.h

@@ -1,65 +0,0 @@
-/*
-Copyright (C) 2011 by Ivan Safrin
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#pragma once
-#include "PolyGlobals.h"
-#include "PolyScreenEntity.h"
-
-namespace Polycode {
-
-	class Sound;
-
-	/**
-	* Creates a positional 2D sound listener. There can be only one listener active at any one time.
- 	*/	
-	class _PolyExport ScreenSoundListener : public ScreenEntity {
-		public:
-			ScreenSoundListener();
-			virtual ~ScreenSoundListener();			
-			void Update();
-	};
-
-
-	/**
-	* Creates a positional 2D sound.
-	*/	
-	class _PolyExport ScreenSound : public ScreenEntity {
-		public:
-			ScreenSound(const String& fileName, Number referenceDistance, Number maxDistance);
-			virtual ~ScreenSound();			
-
-			virtual Entity *Clone(bool deepClone, bool ignoreEditorOnly) const;
-			virtual void applyClone(Entity *clone, bool deepClone, bool ignoreEditorOnly) const;
-
-			void Update();			
-			
-			/**
-			* Returns the sound object associated with this positional sound.
-			*/			
-			Sound *getSound() const;
-			
-		protected:
-					
-			Sound *sound;
-	};
-	
-}

+ 0 - 169
Core/Contents/Include/PolyScreenSprite.h

@@ -1,169 +0,0 @@
-/*
-Copyright (C) 2011 by Ivan Safrin
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#pragma once
-#include "PolyGlobals.h"
-#include "PolyScreenShape.h"
-#include <vector>
-
-namespace Polycode {
-
-class ScreenSpriteResourceEntry;
-
-class _PolyExport SpriteAnimation {
-	public:
-		Number speed;
-		String name;
-		String frames;
-		int numFrames;
-		
-		int numFramesX;
-		int numFramesY;
-		Number spriteUVWidth;
-		Number spriteUVHeight;
-						
-		void setOffsetsFromFrameString(const String& frames);
-	
-		std::vector<Vector2> framesOffsets;
-};
-
-/**
-* Animated 2D image sprite. This screen entity can load spritesheet images and play back animations.
-*/
-class _PolyExport ScreenSprite : public ScreenShape 
-{
-	public:
-	
-		/**
-		* Create a sprite from a sprite file format
-		* @param fileName Sprite file to load
-		*/
-		ScreenSprite(const String& fileName);
-	
-		/**
-		* Create a sprite from a spritesheet image of specified size.
-		* @param fileName Image file to load spritesheet from.
-		* @param spriteWidth Pixel width of each sprite cell.
-		* @param spriteWidth Pixel height of each sprite cell.		
-		*/
-		ScreenSprite(const String& fileName, Number spriteWidth, Number spriteHeight);
-		
-		/**
-		* Create a sprite from a spritesheet image of specified size.
-		* @param fileName Image file to load spritesheet from.
-		* @param spriteWidth Pixel width of each sprite cell.
-		* @param spriteWidth Pixel height of each sprite cell.		
-		*/		
-		static ScreenSprite* ScreenSpriteFromImageFile(const String& fileName, Number spriteWidth, Number spriteHeight);
-		
-		virtual ~ScreenSprite();
-		
-		virtual Entity *Clone(bool deepClone, bool ignoreEditorOnly) const;
-		virtual void applyClone(Entity *clone, bool deepClone, bool ignoreEditorOnly) const;
-
-		/**
-		* Adds a new animation to the sprite. Animations are added by specifying a list of frame indexes and then can be played back by the specified name.
-		* @param name Name of the new animation.
-		* @param frames A comma separated list of frames indexes to include in the animation.
-		* @speed Speed at which to play back the animation.
-		* @return Returns newly added animation
-		*/
-		SpriteAnimation *addAnimation(const String& name, const String& frames, Number speed);
-		
-		/**
-		* Shows a specific frame of the current animation.
-		* @param frameIndex Frame index of the frame to show.
-		*/
-		void showFrame(unsigned int frameIndex);
-		
-		/**
-		* Play back a previously created animation by name.
-		* @param name Name of the animation to play.
-		* @param startFrame Starting frame for playback.
-		* @param once If true, only plays once, otherwise loops.
-		*/
-		void playAnimation(const String& name, int startFrame, bool once);
-		void Update();
-		
-		void setSpriteSize(const Number spriteWidth, const Number spriteHeight);
-	
-		Vector2 getSpriteSize();
-	
-		String getFileName() const;
-	
-		void recalculateSpriteDimensions();
-	
-		bool loadFromFile(const String& fileName);
-		
-		void reloadSprite();
-	
-		/**
-		* Pauses or unpauses the current sprite animation.
-		* @param val If true, pauses the current animation, if false, resumes playing it.
-		*/ 
-		void Pause(bool val);
-		
-		unsigned int getNumAnimations();		
-		SpriteAnimation *getAnimationAtIndex(unsigned int index);
-		
-		SpriteAnimation *getCurrentAnimation();
-		unsigned int getCurrentAnimationFrame();
-		bool isCurrentAnimationFinished();
-		
-		void updateSprite();
-		
-		ScreenSpriteResourceEntry *getResourceEntry();
-		
-	protected:
-	
-		String fileName;
-		
-		bool paused;
-	
-		Number spriteWidth;
-		Number spriteHeight;
-			
-		bool playingOnce;
-		Number lastTick;
-		
-		ScreenSpriteResourceEntry *resourceEntry;
-		
-		Number spriteUVWidth;
-		Number spriteUVHeight;
-		int currentFrame;
-		SpriteAnimation *currentAnimation;
-		
-		std::vector<SpriteAnimation*> animations;
-};
-
-class ScreenSpriteResourceEntry : public Resource {
-	public:
-		ScreenSpriteResourceEntry(ScreenSprite *sprite);
-		virtual ~ScreenSpriteResourceEntry();		
-		ScreenSprite *getSprite();
-		void reloadResource();
-		
-	protected:
-		ScreenSprite* sprite;
-};
-	
-}

+ 3 - 3
Core/Contents/Include/PolySkeleton.h

@@ -27,7 +27,7 @@ THE SOFTWARE.
 #include "PolyColor.h"
 #include "PolyColor.h"
 #include "PolyVector3.h"
 #include "PolyVector3.h"
 #include "PolyQuaternion.h"
 #include "PolyQuaternion.h"
-#include "PolySceneEntity.h"
+#include "PolyEntity.h"
 #include <vector>
 #include <vector>
 
 
 namespace Polycode {
 namespace Polycode {
@@ -133,7 +133,7 @@ namespace Polycode {
 	/**
 	/**
 	* 3D skeleton. Skeletons are applied to scene meshes and can be animated with loaded animations.
 	* 3D skeleton. Skeletons are applied to scene meshes and can be animated with loaded animations.
 	*/
 	*/
-	class _PolyExport Skeleton : public SceneEntity {
+	class _PolyExport Skeleton : public Entity {
 		public:
 		public:
 		
 		
 			/**
 			/**
@@ -222,7 +222,7 @@ namespace Polycode {
 		
 		
 		protected:
 		protected:
 		
 		
-			SceneEntity *bonesEntity;
+			Entity *bonesEntity;
 		
 		
 			SkeletonAnimation *currentAnimation;
 			SkeletonAnimation *currentAnimation;
 			std::vector<Bone*> bones;
 			std::vector<Bone*> bones;

+ 1 - 12
Core/Contents/Include/Polycode.h

@@ -48,19 +48,10 @@
 #include "PolyRectangle.h"
 #include "PolyRectangle.h"
 #include "PolyRenderer.h"
 #include "PolyRenderer.h"
 #include "PolyCoreServices.h"
 #include "PolyCoreServices.h"
-#include "PolyScreen.h"
-#include "PolyScreenEntity.h"
-#include "PolyScreenLine.h"
-#include "PolyScreenMesh.h"
-#include "PolyScreenShape.h"
 #include "PolyImage.h"
 #include "PolyImage.h"
 #include "PolyLabel.h"
 #include "PolyLabel.h"
 #include "PolyFont.h"
 #include "PolyFont.h"
 #include "PolyFontManager.h"
 #include "PolyFontManager.h"
-#include "PolyScreenImage.h"
-#include "PolyScreenSprite.h"
-#include "PolyScreenLabel.h"
-#include "PolyScreenEntityInstance.h"
 #include "PolyTexture.h"
 #include "PolyTexture.h"
 #include "PolyMaterial.h"
 #include "PolyMaterial.h"
 #include "PolyMesh.h"
 #include "PolyMesh.h"
@@ -70,7 +61,7 @@
 #include "PolyCoreServices.h"
 #include "PolyCoreServices.h"
 #include "PolyCamera.h"
 #include "PolyCamera.h"
 #include "PolyScene.h"
 #include "PolyScene.h"
-#include "PolySceneEntity.h"
+#include "PolyEntity.h"
 #include "PolySceneMesh.h"
 #include "PolySceneMesh.h"
 #include "PolySceneLine.h"
 #include "PolySceneLine.h"
 #include "PolySceneLight.h"
 #include "PolySceneLight.h"
@@ -81,13 +72,11 @@
 #include "PolyParticleEmitter.h"
 #include "PolyParticleEmitter.h"
 #include "PolyParticle.h"
 #include "PolyParticle.h"
 #include "PolySceneRenderTexture.h"
 #include "PolySceneRenderTexture.h"
-#include "PolyScreenEvent.h"
 #include "PolyResource.h"
 #include "PolyResource.h"
 #include "PolyThreaded.h"
 #include "PolyThreaded.h"
 #include "PolySound.h"
 #include "PolySound.h"
 #include "PolySoundManager.h"
 #include "PolySoundManager.h"
 #include "PolySceneSound.h"
 #include "PolySceneSound.h"
-#include "PolyScreenSound.h"
 #include "PolyClient.h"
 #include "PolyClient.h"
 #include "PolyPeer.h"
 #include "PolyPeer.h"
 #include "PolyServer.h"
 #include "PolyServer.h"

+ 1 - 1
Core/Contents/Source/PolyBone.cpp

@@ -29,7 +29,7 @@
 
 
 using namespace Polycode;
 using namespace Polycode;
 
 
-Bone::Bone(const String& boneName) : SceneEntity() {
+Bone::Bone(const String& boneName) : Entity() {
 	this->boneName = boneName;
 	this->boneName = boneName;
 //	boneMesh = new ScenePrimitive(ScenePrimitive::TYPE_BOX, 0.1, 0.1, 0.1);
 //	boneMesh = new ScenePrimitive(ScenePrimitive::TYPE_BOX, 0.1, 0.1, 0.1);
 	this->depthTest = false;
 	this->depthTest = false;

+ 2 - 2
Core/Contents/Source/PolyCamera.cpp

@@ -33,7 +33,7 @@
 
 
 using namespace Polycode;
 using namespace Polycode;
 			
 			
-Camera::Camera(Scene *parentScene) : SceneEntity() {
+Camera::Camera(Scene *parentScene) : Entity() {
 	setParentScene(parentScene);
 	setParentScene(parentScene);
 	orthoMode = false;
 	orthoMode = false;
 	fov = 45.0f;
 	fov = 45.0f;
@@ -254,7 +254,7 @@ void Camera::buildFrustumPlanes() {
 
 
 }
 }
 
 
-bool Camera::canSee(SceneEntity *entity) {
+bool Camera::canSee(Entity *entity) {
 	return isSphereInFrustum(entity->getPosition(), entity->getBBoxRadius());
 	return isSphereInFrustum(entity->getPosition(), entity->getBBoxRadius());
 }
 }
 
 

+ 3 - 29
Core/Contents/Source/PolyCoreServices.cpp

@@ -31,7 +31,6 @@
 #include "PolyRenderer.h"
 #include "PolyRenderer.h"
 #include "PolyConfig.h"
 #include "PolyConfig.h"
 #include "PolyFontManager.h"
 #include "PolyFontManager.h"
-#include "PolyScreenManager.h"
 #include "PolySceneManager.h"
 #include "PolySceneManager.h"
 #include "PolyTimerManager.h"
 #include "PolyTimerManager.h"
 #include "PolyTweenManager.h"
 #include "PolyTweenManager.h"
@@ -124,18 +123,7 @@ CoreServices::CoreServices() : EventDispatcher() {
 	logger = new Logger();
 	logger = new Logger();
 	resourceManager = new ResourceManager();	
 	resourceManager = new ResourceManager();	
 	config = new Config();
 	config = new Config();
-	materialManager = new MaterialManager();
-	screenManager = new ScreenManager();
-	addEventListener(screenManager, InputEvent::EVENT_MOUSEDOWN);
-	addEventListener(screenManager, InputEvent::EVENT_MOUSEMOVE);
-	addEventListener(screenManager, InputEvent::EVENT_MOUSEUP);
-	addEventListener(screenManager, InputEvent::EVENT_MOUSEWHEEL_UP);
-	addEventListener(screenManager, InputEvent::EVENT_MOUSEWHEEL_DOWN);
-	addEventListener(screenManager, InputEvent::EVENT_KEYDOWN);
-	addEventListener(screenManager, InputEvent::EVENT_KEYUP);
-	addEventListener(screenManager, InputEvent::EVENT_TOUCHES_BEGAN);
-	addEventListener(screenManager, InputEvent::EVENT_TOUCHES_ENDED);
-	addEventListener(screenManager, InputEvent::EVENT_TOUCHES_MOVED);
+	materialManager = new MaterialManager();	
 	sceneManager = new SceneManager();
 	sceneManager = new SceneManager();
 	timerManager = new TimerManager();
 	timerManager = new TimerManager();
 	tweenManager = new TweenManager();
 	tweenManager = new TweenManager();
@@ -147,7 +135,6 @@ CoreServices::CoreServices() : EventDispatcher() {
 
 
 CoreServices::~CoreServices() {
 CoreServices::~CoreServices() {
 	delete materialManager;
 	delete materialManager;
-	delete screenManager;
 	delete sceneManager;
 	delete sceneManager;
 	delete timerManager;
 	delete timerManager;
 	delete tweenManager;
 	delete tweenManager;
@@ -222,16 +209,8 @@ void CoreServices::Render() {
 	if(renderer->doClearBuffer)
 	if(renderer->doClearBuffer)
 		renderer->clearScreen();					
 		renderer->clearScreen();					
 
 
-	if(screenManager->drawScreensFirst) {
-		renderer->clearLights();	
-		screenManager->Render();
-		renderer->setPerspectiveMode();
-		sceneManager->Render();	
-	} else {
-		sceneManager->Render();
-		renderer->clearLights();		
-		screenManager->Render();	
-	}
+	sceneManager->Render();
+	renderer->clearLights();
 }
 }
 
 
 void CoreServices::Update(int elapsed) {
 void CoreServices::Update(int elapsed) {
@@ -244,17 +223,12 @@ void CoreServices::Update(int elapsed) {
 	tweenManager->Update();	
 	tweenManager->Update();	
 	materialManager->Update(elapsed);		
 	materialManager->Update(elapsed);		
 	sceneManager->Update();
 	sceneManager->Update();
-	screenManager->Update();	
 }
 }
 
 
 SoundManager *CoreServices::getSoundManager() {
 SoundManager *CoreServices::getSoundManager() {
 	return soundManager;
 	return soundManager;
 }
 }
 
 
-ScreenManager *CoreServices::getScreenManager() {
-	return screenManager;
-}
-
 SceneManager *CoreServices::getSceneManager() {
 SceneManager *CoreServices::getSceneManager() {
 	return sceneManager;
 	return sceneManager;
 }
 }

+ 40 - 2
Core/Contents/Source/PolyEntity.cpp

@@ -57,9 +57,11 @@ Entity::Entity() : EventDispatcher() {
 	visibilityAffectsChildren = true;
 	visibilityAffectsChildren = true;
 	ownsChildren = false;
 	ownsChildren = false;
 	enableScissor = false;
 	enableScissor = false;
-	
+	processInputEvents = false;
+	blockMouseInput = false;
 	editorOnly = false; 
 	editorOnly = false; 
-
+	hasFocus = false;
+	snapToPixels = false;
 	tags = NULL;
 	tags = NULL;
 }
 }
 
 
@@ -625,6 +627,31 @@ void Entity::setParentEntity(Entity *entity) {
 	parentEntity = entity;
 	parentEntity = entity;
 }
 }
 
 
+void Entity::setWidth(Number width) {
+	bBox.x = width;
+}
+
+void Entity::setHeight(Number height) {
+	bBox.y = height;
+}
+
+void Entity::setDepth(Number depth) {
+	bBox.z = depth;
+}
+
+Number Entity::getWidth() const {
+	return bBox.z;
+}
+
+Number Entity::getHeight() const {
+	return bBox.y;
+}
+
+Number Entity::getDepth() const {
+	return bBox.z;
+}
+
+
 Number Entity::getPitch() const {
 Number Entity::getPitch() const {
 	return rotation.pitch;
 	return rotation.pitch;
 }
 }
@@ -720,6 +747,10 @@ Vector3 Entity::getPosition() const {
 	return position;
 	return position;
 }
 }
 
 
+Vector2 Entity::getPosition2D() const {
+	return Vector2(position.x, position.y);
+}
+
 Number Entity::getCombinedPitch() const {
 Number Entity::getCombinedPitch() const {
 	if(parentEntity != NULL)
 	if(parentEntity != NULL)
 		return parentEntity->getCombinedPitch()+rotation.pitch;
 		return parentEntity->getCombinedPitch()+rotation.pitch;
@@ -774,3 +805,10 @@ void Entity::addTag(String tag) {
 	}
 	}
 }
 }
 
 
+void Entity::setPositionMode(int newPositionMode) {
+	positionMode = newPositionMode;
+}
+
+int Entity::getPositionMode() const {
+	return positionMode;
+}

+ 0 - 30
Core/Contents/Source/PolyParticle.cpp

@@ -24,7 +24,6 @@
 #include "PolyMesh.h"
 #include "PolyMesh.h"
 #include "PolyPolygon.h"
 #include "PolyPolygon.h"
 #include "PolySceneMesh.h"
 #include "PolySceneMesh.h"
-#include "PolyScreenShape.h"
 
 
 using namespace Polycode;
 using namespace Polycode;
 
 
@@ -101,35 +100,6 @@ void Particle::createSceneParticle(int particleType, Material *material, Mesh *p
 	}
 	}
 }
 }
 
 
-void Particle::createScreenParticle(int particleType, Texture *texture, Mesh *particleMesh) {
-	
-	ScreenShape *primitive = new ScreenShape(ScreenShape::SHAPE_RECT, 1.0, 1.0f);
-	primitive->setTexture(texture);	
-//	primitive->billboardMode = true;
-//	primitive->billboardRoll = true;
-	
-	particleBody = primitive;			
-	return;
-	
-	switch(particleType) {
-		case BILLBOARD_PARTICLE:
-		{
-			ScreenShape *primitive = new ScreenShape(ScreenShape::SHAPE_RECT, 1.0f, 1.0f);
-//			primitive->setTexture(texture->get)
-			particleBody = primitive;			
-		}
-			break;
-		case MESH_PARTICLE: 
-		{
-//			ScreenMesh *primitive = new ScreenMesh(particleMesh);
-//			primitive->cacheToVertexBuffer(true);
-//			primitive->setMaterial(texture);
-//			particleBody = primitive;						
-		}			
-			break;
-	}	
-}
-
 
 
 void Particle::Reset(bool continuious) {
 void Particle::Reset(bool continuious) {
 	if(continuious) {
 	if(continuious) {

+ 3 - 101
Core/Contents/Source/PolyParticleEmitter.cpp

@@ -26,17 +26,15 @@
 #include "PolyPerlin.h"
 #include "PolyPerlin.h"
 #include "PolyResource.h"
 #include "PolyResource.h"
 #include "PolyScene.h"
 #include "PolyScene.h"
-#include "PolyScreen.h"
 #include "PolyTimer.h"
 #include "PolyTimer.h"
 #include "PolyMaterialManager.h"
 #include "PolyMaterialManager.h"
 #include "PolyResourceManager.h"
 #include "PolyResourceManager.h"
-#include "PolyScreenMesh.h"
 #include "PolyRenderer.h"
 #include "PolyRenderer.h"
 
 
 using namespace Polycode;
 using namespace Polycode;
 
 
 SceneParticleEmitter::SceneParticleEmitter(const String& materialName, int particleType, int emitterType, Number lifespan, unsigned int numParticles, Vector3 direction, Vector3 gravity, Vector3 deviation, Vector3 emitterRadius, Mesh *particleMesh, SceneMesh *emitter)
 SceneParticleEmitter::SceneParticleEmitter(const String& materialName, int particleType, int emitterType, Number lifespan, unsigned int numParticles, Vector3 direction, Vector3 gravity, Vector3 deviation, Vector3 emitterRadius, Mesh *particleMesh, SceneMesh *emitter)
-: SceneEntity(),
+: Entity(),
 ParticleEmitter(materialName, particleMesh, particleType, emitterType, lifespan, numParticles,  direction, gravity, deviation, emitterRadius)
 ParticleEmitter(materialName, particleMesh, particleType, emitterType, lifespan, numParticles,  direction, gravity, deviation, emitterRadius)
 {
 {
 	isScreenEmitter = false;
 	isScreenEmitter = false;
@@ -52,7 +50,7 @@ SceneParticleEmitter::~SceneParticleEmitter() {
 void SceneParticleEmitter::respawnSceneParticles() {
 void SceneParticleEmitter::respawnSceneParticles() {
 	for(int i=0; i < particles.size(); i++) {
 	for(int i=0; i < particles.size(); i++) {
 		Particle *particle = particles[i];
 		Particle *particle = particles[i];
-		removeChild((SceneEntity*)particle->particleBody);
+		removeChild((Entity*)particle->particleBody);
 		addParticleBody(particle->particleBody);
 		addParticleBody(particle->particleBody);
 		resetParticle(particle);				
 		resetParticle(particle);				
 		particle->life = lifespan * ((Number)rand()/RAND_MAX);		
 		particle->life = lifespan * ((Number)rand()/RAND_MAX);		
@@ -61,7 +59,7 @@ void SceneParticleEmitter::respawnSceneParticles() {
 }
 }
 
 
 void SceneParticleEmitter::addParticleBody(Entity *particleBody) {
 void SceneParticleEmitter::addParticleBody(Entity *particleBody) {
-	addEntity((SceneEntity*)particleBody);	
+	addEntity((Entity*)particleBody);	
 	particleBody->editorOnly = true;
 	particleBody->editorOnly = true;
 }
 }
 
 
@@ -78,87 +76,6 @@ void SceneParticleEmitter::Update() {
 	updateEmitter();
 	updateEmitter();
 }
 }
 
 
-
-ScreenParticleEmitter::ScreenParticleEmitter(const String& imageFile, int particleType, int emitterType, Number lifespan, unsigned int numParticles, Vector3 direction, Vector3 gravity, Vector3 deviation, Vector3 emitterRadius, Mesh *particleMesh, ScreenMesh *emitter)
-		: ScreenEntity(),
-ParticleEmitter(imageFile, particleMesh, particleType, emitterType, lifespan, numParticles,  direction, gravity, deviation, emitterRadius)
-{
-	particleSize = 10.0; 
-	isScreenEmitter = true;
-	emitterMesh = emitter;	
-	createParticles();
-}
-
-ScreenParticleEmitter::~ScreenParticleEmitter(){ 
-	for(int i=0;i < particles.size(); i++) {
-		removeChild((ScreenEntity*)particles[i]->particleBody);
-		delete particles[i];
-	}
-}
-
-Entity *ScreenParticleEmitter::Clone(bool deepClone, bool ignoreEditorOnly) const {
-	ScreenParticleEmitter *newEmitter = new ScreenParticleEmitter("default.png", Particle::BILLBOARD_PARTICLE, ParticleEmitter::CONTINUOUS_EMITTER, 2.0, 0, Vector3(0.0, -40.0, 0.0), Vector3(0.0, 0.0, 0.0), Vector3(0.0, 0.0, 0.0), Vector3(10.0, 10.0, 0.0));
-	applyClone(newEmitter, deepClone, ignoreEditorOnly);
-	return newEmitter;
-}
-
-void ScreenParticleEmitter::applyClone(Entity *clone, bool deepClone, bool ignoreEditorOnly) const {
-	ScreenParticleEmitter *_clone = (ScreenParticleEmitter*) clone;
-
-	_clone->emitterRadius = this->emitterRadius;
-	_clone->dirVector = this->dirVector;
-	_clone->gravVector = this->gravVector;
-	_clone->deviation = this->deviation;
-
-	_clone->setIgnoreParentMatrix(getIgnoreParentMatrix());
-				
-	_clone->brightnessDeviation = this->brightnessDeviation;
-	_clone->particleSize = this->particleSize;
-	_clone->perlinModSize = this->perlinModSize;
-	_clone->perlinEnabled = this->perlinEnabled;
-	_clone->particleSpeedMod = this->particleSpeedMod;
-				
-	_clone->rotationSpeed = this->rotationSpeed;
-	_clone->lifespan = this->lifespan;
-	_clone->particleSpeedMod = this->particleSpeedMod;
-	_clone->setParticleCount(this->getNumParticles());						
-
-	_clone->rotationFollowsPath = this->rotationFollowsPath;
-	_clone->useScaleCurves = this->useScaleCurves;
-	_clone->scaleCurve = this->scaleCurve;
-
-	_clone->useColorCurves = this->useColorCurves;
-				
-	_clone->colorCurveR = this->colorCurveR;
-	_clone->colorCurveG = this->colorCurveG;
-	_clone->colorCurveB = this->colorCurveB;
-	_clone->colorCurveA = this->colorCurveA;																
-	_clone->setParticleBlendingMode(this->getParticleBlendingMode());
-	_clone->setParticleTexture(this->getParticleTexture());
-	_clone->setWidth(_clone->emitterRadius.x);
-	_clone->setHeight(_clone->emitterRadius.y);			
-	
-	ScreenEntity::applyClone(clone, false, ignoreEditorOnly);
-}
-
-void ScreenParticleEmitter::Update() {
-	updateEmitter();
-}
-
-void ScreenParticleEmitter::addParticleBody(Entity *particleBody) {
-	addChild((ScreenEntity*)particleBody);
-	particleBody->editorOnly = true;	
-}
-
-void ScreenParticleEmitter::dispatchTriggerCompleteEvent() {
-	((EventDispatcher*)this)->dispatchEvent(new Event(Event::COMPLETE_EVENT), Event::COMPLETE_EVENT);
-}
-
-Matrix4 ScreenParticleEmitter::getBaseMatrix() {
-	rebuildTransformMatrix();
-	return getConcatenatedMatrix();
-}
-
 ParticleEmitter::ParticleEmitter(const String& imageFile, Mesh *particleMesh, int particleType, int emitterType, Number lifespan, unsigned int numParticles,  Vector3 direction, Vector3 gravity, Vector3 deviation, Vector3 emitterRadius)  {
 ParticleEmitter::ParticleEmitter(const String& imageFile, Mesh *particleMesh, int particleType, int emitterType, Number lifespan, unsigned int numParticles,  Vector3 direction, Vector3 gravity, Vector3 deviation, Vector3 emitterRadius)  {
 	
 	
 	this->emitterRadius = emitterRadius;	
 	this->emitterRadius = emitterRadius;	
@@ -230,12 +147,6 @@ Texture *ParticleEmitter::getParticleTexture() const {
 	return particleTexture;
 	return particleTexture;
 }
 }
 
 
-void ParticleEmitter::setParticleTexture(Texture *texture) {
-	particleTexture = texture;
-	for(int i=0; i < particles.size(); i++) {
-		((ScreenMesh*)particles[i]->particleBody)->setTexture(particleTexture);
-	}
-}
 			
 			
 void ParticleEmitter::createParticles() {
 void ParticleEmitter::createParticles() {
 	
 	
@@ -445,15 +356,6 @@ void ParticleEmitter::resetParticle(Particle *particle) {
 			
 			
 }
 }
 
 
-Vector3 ScreenParticleEmitter::getParticleCompoundScale() {
-	return getCompoundScale();
-}
-
-Vector3 SceneParticleEmitter::getParticleCompoundScale() {
-	return getCompoundScale();
-}
-
-
 Vector3 ParticleEmitter::getParticleCompoundScale() {
 Vector3 ParticleEmitter::getParticleCompoundScale() {
 	return Vector3();
 	return Vector3();
 }
 }

+ 19 - 61
Core/Contents/Source/PolyScene.cpp

@@ -49,6 +49,8 @@ Scene::Scene() : EventDispatcher() {
 	ambientColor.setColor(0.0,0.0,0.0,1.0);
 	ambientColor.setColor(0.0,0.0,0.0,1.0);
 	useClearColor = false;
 	useClearColor = false;
 	ownsChildren = false;
 	ownsChildren = false;
+	renderer = CoreServices::getInstance()->getRenderer();
+	rootEntity.setRenderer(renderer);
 	CoreServices::getInstance()->getSceneManager()->addScene(this);	
 	CoreServices::getInstance()->getSceneManager()->addScene(this);	
 }
 }
 
 
@@ -64,6 +66,8 @@ Scene::Scene(bool virtualScene) : EventDispatcher() {
 	ambientColor.setColor(0.0,0.0,0.0,1.0);	
 	ambientColor.setColor(0.0,0.0,0.0,1.0);	
 	useClearColor = false;
 	useClearColor = false;
 	ownsChildren = false;
 	ownsChildren = false;
+	renderer = CoreServices::getInstance()->getRenderer();
+	rootEntity.setRenderer(renderer);
 	if (!isSceneVirtual) {
 	if (!isSceneVirtual) {
 		CoreServices::getInstance()->getSceneManager()->addScene(this);
 		CoreServices::getInstance()->getSceneManager()->addScene(this);
 	}
 	}
@@ -94,18 +98,10 @@ bool Scene::isEnabled() {
 }
 }
 
 
 void Scene::Update() {
 void Scene::Update() {
-	for(int i=0; i<entities.size();i++) {
-		entities[i]->doUpdates();		
-		entities[i]->updateEntityMatrix();
-	}
+	rootEntity.doUpdates();
 }
 }
 
 
 Scene::~Scene() {
 Scene::~Scene() {
-	if(ownsChildren) {
-		for(int i=0; i < entities.size(); i++) {	
-			delete entities[i];
-		}
-	}
 	CoreServices::getInstance()->getSceneManager()->removeScene(this);	
 	CoreServices::getInstance()->getSceneManager()->removeScene(this);	
 	delete defaultCamera;
 	delete defaultCamera;
 }
 }
@@ -115,8 +111,6 @@ void Scene::enableLighting(bool enable) {
 	CoreServices::getInstance()->getRenderer()->enableLighting(enable);
 	CoreServices::getInstance()->getRenderer()->enableLighting(enable);
 }
 }
 
 
-
-
 void Scene::enableFog(bool enable) {
 void Scene::enableFog(bool enable) {
 	fogEnabled = enable;
 	fogEnabled = enable;
 	
 	
@@ -131,31 +125,16 @@ void Scene::setFogProperties(int fogMode, Color color, Number density, Number st
 	
 	
 }
 }
 
 
-SceneEntity *Scene::getEntityAtScreenPosition(Number x, Number y) {
-	for(int i =0; i< entities.size(); i++) {
-		if(entities[i]->testMouseCollision(x,y)) {
-			return entities[i];
-		}
-	}
-	return NULL;
+void Scene::addEntity(Entity *entity) {
+	rootEntity.addChild(entity);
 }
 }
 
 
-void Scene::addEntity(SceneEntity *entity) {
-	entity->setRenderer(CoreServices::getInstance()->getRenderer());
-	entities.push_back(entity);
-}
-
-void Scene::addChild(SceneEntity *entity) {
+void Scene::addChild(Entity *entity) {
 	addEntity(entity);
 	addEntity(entity);
 }
 }
 
 
-void Scene::removeEntity(SceneEntity *entity) {
-	for(int i=0; i < entities.size(); i++) {
-		if(entities[i] == entity) {
-			entities.erase(entities.begin()+i);
-			return;
-		}		
-	}
+void Scene::removeEntity(Entity *entity) {
+	rootEntity.removeChild(entity);
 }
 }
 
 
 Camera *Scene::getDefaultCamera() {
 Camera *Scene::getDefaultCamera() {
@@ -169,12 +148,7 @@ void Scene::Render(Camera *targetCamera) {
 	
 	
 	if(!targetCamera)
 	if(!targetCamera)
 		targetCamera = activeCamera;
 		targetCamera = activeCamera;
-	
-	// prepare lights...
-	for(int i=0; i<entities.size();i++) {
-		entities[i]->updateEntityMatrix();
-	}	
-	
+		
 	//make these the closest
 	//make these the closest
 	
 	
 	Matrix4 textureMatrix;
 	Matrix4 textureMatrix;
@@ -247,14 +221,8 @@ void Scene::Render(Camera *targetCamera) {
 	}
 	}
 	
 	
 	
 	
-	for(int i=0; i<entities.size();i++) {
-		if(entities[i]->getBBoxRadius() > 0) {
-			if(targetCamera->isSphereInFrustum((entities[i]->getPosition()), entities[i]->getBBoxRadius()))
-				entities[i]->transformAndRender();
-		} else {
-			entities[i]->transformAndRender();		
-		}
-	}
+	rootEntity.updateEntityMatrix();
+	rootEntity.transformAndRender();	
 	
 	
 	if(targetCamera->getOrthoMode()) {
 	if(targetCamera->getOrthoMode()) {
 		CoreServices::getInstance()->getRenderer()->setPerspectiveMode();
 		CoreServices::getInstance()->getRenderer()->setPerspectiveMode();
@@ -266,28 +234,18 @@ void Scene::Render(Camera *targetCamera) {
 void Scene::RenderDepthOnly(Camera *targetCamera) {
 void Scene::RenderDepthOnly(Camera *targetCamera) {
 	
 	
 	CoreServices::getInstance()->getRenderer()->cullFrontFaces(true);
 	CoreServices::getInstance()->getRenderer()->cullFrontFaces(true);
-/*	
-	for(int i=0; i<entities.size();i++) {
-		entities[i]->doUpdates();		
-		entities[i]->updateEntityMatrix();
-	}
-*/	
+
 	targetCamera->rebuildTransformMatrix();	
 	targetCamera->rebuildTransformMatrix();	
 	targetCamera->doCameraTransform();	
 	targetCamera->doCameraTransform();	
 	targetCamera->buildFrustumPlanes();
 	targetCamera->buildFrustumPlanes();
 	
 	
 	CoreServices::getInstance()->getRenderer()->setTexture(NULL);
 	CoreServices::getInstance()->getRenderer()->setTexture(NULL);
 	CoreServices::getInstance()->getRenderer()->enableShaders(false);
 	CoreServices::getInstance()->getRenderer()->enableShaders(false);
-	for(int i=0; i<entities.size();i++) {
-		if(entities[i]->castShadows) {
-		if(entities[i]->getBBoxRadius() > 0) {
-			if(targetCamera->isSphereInFrustum((entities[i]->getPosition()), entities[i]->getBBoxRadius()))
-				entities[i]->transformAndRender();
-		} else {
-			entities[i]->transformAndRender();		
-		}
-		}
-	}	
+	
+	
+	rootEntity.updateEntityMatrix();
+	rootEntity.transformAndRender();	
+	
 	CoreServices::getInstance()->getRenderer()->enableShaders(true);
 	CoreServices::getInstance()->getRenderer()->enableShaders(true);
 	CoreServices::getInstance()->getRenderer()->cullFrontFaces(false);	
 	CoreServices::getInstance()->getRenderer()->cullFrontFaces(false);	
 }
 }

+ 47 - 47
Core/Contents/Source/PolyScreenImage.cpp → Core/Contents/Source/PolySceneImage.cpp

@@ -20,7 +20,7 @@
  THE SOFTWARE.
  THE SOFTWARE.
 */
 */
 
 
-#include "PolyScreenImage.h"
+#include "PolySceneImage.h"
 #include "PolyMesh.h"
 #include "PolyMesh.h"
 #include "PolyPolygon.h"
 #include "PolyPolygon.h"
 #include "PolyTexture.h"
 #include "PolyTexture.h"
@@ -28,111 +28,111 @@
 
 
 using namespace Polycode;
 using namespace Polycode;
 
 
-ScreenImage* ScreenImage::ScreenImageWithImage(Image *image) {
-	return new ScreenImage(image);
+SceneImage* SceneImage::SceneImageWithImage(Image *image) {
+	return new SceneImage(image);
 }
 }
 
 
-ScreenImage* ScreenImage::ScreenImageWithTexture(Texture *texture) {
-	return new ScreenImage(texture);	
+SceneImage* SceneImage::SceneImageWithTexture(Texture *texture) {
+	return new SceneImage(texture);	
 }
 }
 
 
-ScreenImage::ScreenImage(const String& fileName) : ScreenShape(ScreenShape::SHAPE_RECT,1,1) {
+SceneImage::SceneImage(const String& fileName) : ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 1, 1) {
 	loadTexture(fileName);
 	loadTexture(fileName);
-	
+
 	imageWidth = texture->getWidth();
 	imageWidth = texture->getWidth();
 	imageHeight = texture->getHeight();
 	imageHeight = texture->getHeight();
-	
-	width = texture->getWidth();
-	height = texture->getHeight();	
-	setShapeSize(width, height);	
-	
+
+	setWidth(texture->getWidth());
+	setHeight(texture->getHeight());	
+	setPrimitiveOptions(ScenePrimitive::TYPE_VPLANE, getWidth(), getHeight());
+
 	setPositionMode(POSITION_TOPLEFT);
 	setPositionMode(POSITION_TOPLEFT);
 }
 }
 
 
-ScreenImage::ScreenImage(Image *image) : ScreenShape(ScreenShape::SHAPE_RECT,1,1) {
-	loadTexture(image);
-	
+SceneImage::SceneImage(Image *image) : ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 1, 1) {
+	loadTextureFromImage(image);
+
 	imageWidth = texture->getWidth();
 	imageWidth = texture->getWidth();
 	imageHeight = texture->getHeight();
 	imageHeight = texture->getHeight();
-	
-	width = texture->getWidth();
-	height = texture->getHeight();	
-	setShapeSize(width, height);	
-	
+
+	setWidth(texture->getWidth());
+	setHeight(texture->getHeight());	
+	setPrimitiveOptions(ScenePrimitive::TYPE_VPLANE, getWidth(), getHeight());
+
 	setPositionMode(POSITION_TOPLEFT);	
 	setPositionMode(POSITION_TOPLEFT);	
 }
 }
 
 
-ScreenImage::ScreenImage(Texture *texture) : ScreenShape(ScreenShape::SHAPE_RECT,1,1) {
+SceneImage::SceneImage(Texture *texture) : ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 1, 1)  {
 	setTexture(texture);
 	setTexture(texture);
-	
+
 	imageWidth = texture->getWidth();
 	imageWidth = texture->getWidth();
 	imageHeight = texture->getHeight();
 	imageHeight = texture->getHeight();
-	
-	width = texture->getWidth();
-	height = texture->getHeight();	
-	setShapeSize(width, height);	
-	
+
+	setWidth(texture->getWidth());
+	setHeight(texture->getHeight());	
+	setPrimitiveOptions(ScenePrimitive::TYPE_VPLANE, getWidth(), getHeight());
+
 	setPositionMode(POSITION_TOPLEFT);
 	setPositionMode(POSITION_TOPLEFT);
 }
 }
 
 
-ScreenImage::~ScreenImage() {
+SceneImage::~SceneImage() {
 
 
 }
 }
 
 
-Entity *ScreenImage::Clone(bool deepClone, bool ignoreEditorOnly) const {
-	ScreenImage *newImage = new ScreenImage(getTexture()->getResourcePath());
+Entity *SceneImage::Clone(bool deepClone, bool ignoreEditorOnly) const {
+	SceneImage *newImage = new SceneImage(getTexture()->getResourcePath());
 	applyClone(newImage, deepClone, ignoreEditorOnly);
 	applyClone(newImage, deepClone, ignoreEditorOnly);
 	return newImage;
 	return newImage;
 }
 }
 
 
-void ScreenImage::applyClone(Entity *clone, bool deepClone, bool ignoreEditorOnly) const {
-	ScreenShape::applyClone(clone, deepClone, ignoreEditorOnly);
+void SceneImage::applyClone(Entity *clone, bool deepClone, bool ignoreEditorOnly) const {
+	//ScreenShape::applyClone(clone, deepClone, ignoreEditorOnly);
 }
 }
 
 
-void ScreenImage::setImageCoordinates(Number x, Number y, Number width, Number height) {
+void SceneImage::setImageCoordinates(Number x, Number y, Number width, Number height) {
 	Vertex *vertex;
 	Vertex *vertex;
 	Number pixelSizeX = 1/imageWidth;
 	Number pixelSizeX = 1/imageWidth;
 	Number pixelSizeY = 1/imageHeight;
 	Number pixelSizeY = 1/imageHeight;
-	
-	this->width = width;
-	this->height = height;
-	setHitbox(width, height);
+
+	setWidth(width);
+	setHeight(height);
+		
 	Number whalf = floor(width/2.0f);
 	Number whalf = floor(width/2.0f);
 	Number hhalf = floor(height/2.0f);	
 	Number hhalf = floor(height/2.0f);	
-		
+
 	Number xFloat = x * pixelSizeX;
 	Number xFloat = x * pixelSizeX;
 	Number yFloat = 1 - (y * pixelSizeY);
 	Number yFloat = 1 - (y * pixelSizeY);
 	Number wFloat = width * pixelSizeX;
 	Number wFloat = width * pixelSizeX;
 	Number hFloat = height * pixelSizeY;
 	Number hFloat = height * pixelSizeY;
-	
+
 	Polygon *imagePolygon = mesh->getPolygon(0);	
 	Polygon *imagePolygon = mesh->getPolygon(0);	
 	vertex = imagePolygon->getVertex(0);
 	vertex = imagePolygon->getVertex(0);
 	vertex->set(-whalf,-hhalf,0);
 	vertex->set(-whalf,-hhalf,0);
 	vertex->setTexCoord(xFloat, yFloat);
 	vertex->setTexCoord(xFloat, yFloat);
-	
+
 	vertex = imagePolygon->getVertex(1);
 	vertex = imagePolygon->getVertex(1);
 	vertex->set(-whalf+width,-hhalf,0);
 	vertex->set(-whalf+width,-hhalf,0);
 	vertex->setTexCoord(xFloat + wFloat, yFloat);
 	vertex->setTexCoord(xFloat + wFloat, yFloat);
-	
+
 	vertex = imagePolygon->getVertex(2);
 	vertex = imagePolygon->getVertex(2);
 	vertex->set(-whalf+width,-hhalf+height,0);
 	vertex->set(-whalf+width,-hhalf+height,0);
 	vertex->setTexCoord(xFloat + wFloat, yFloat - hFloat);
 	vertex->setTexCoord(xFloat + wFloat, yFloat - hFloat);
-	
+
 	vertex = imagePolygon->getVertex(3);	
 	vertex = imagePolygon->getVertex(3);	
 	vertex->set(-whalf,-hhalf+height,0);	
 	vertex->set(-whalf,-hhalf+height,0);	
 	vertex->setTexCoord(xFloat, yFloat - hFloat);
 	vertex->setTexCoord(xFloat, yFloat - hFloat);
-	
+
 	mesh->arrayDirtyMap[RenderDataArray::VERTEX_DATA_ARRAY] = true;
 	mesh->arrayDirtyMap[RenderDataArray::VERTEX_DATA_ARRAY] = true;
 	mesh->arrayDirtyMap[RenderDataArray::TEXCOORD_DATA_ARRAY] = true;	
 	mesh->arrayDirtyMap[RenderDataArray::TEXCOORD_DATA_ARRAY] = true;	
 	rebuildTransformMatrix();
 	rebuildTransformMatrix();
 	matrixDirty = true;
 	matrixDirty = true;
-	
+
 }
 }
 
 
-Number ScreenImage::getImageWidth() const {
+Number SceneImage::getImageWidth() const {
 	return imageWidth;
 	return imageWidth;
 }
 }
 
 
-Number ScreenImage::getImageHeight() const {
+Number SceneImage::getImageHeight() const {
 	return imageHeight;	
 	return imageHeight;	
-}
+}

+ 21 - 1
Core/Contents/Source/PolySceneLabel.cpp

@@ -31,12 +31,22 @@
 
 
 using namespace Polycode;
 using namespace Polycode;
 
 
-SceneLabel::SceneLabel(const String& fontName, const String& text, int size, Number scale, int amode, bool premultiplyAlpha) : ScenePrimitive(ScenePrimitive::TYPE_PLANE, 1, 1) {
+SceneLabel::SceneLabel(const String& fontName, const String& text, int size, Number scale, int amode, bool premultiplyAlpha) : ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 1, 1) {
 	label = new Label(CoreServices::getInstance()->getFontManager()->getFontByName(fontName), text, size, amode, premultiplyAlpha);
 	label = new Label(CoreServices::getInstance()->getFontManager()->getFontByName(fontName), text, size, amode, premultiplyAlpha);
 	this->scale = scale;
 	this->scale = scale;
+	positionAtBaseline = true;
 	updateFromLabel();
 	updateFromLabel();
 }
 }
 
 
+SceneLabel::SceneLabel(const String& text, int size, const String& fontName, int amode, bool premultiplyAlpha) : ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 1, 1){
+
+	label = new Label(CoreServices::getInstance()->getFontManager()->getFontByName(fontName), text, size, amode, premultiplyAlpha);
+	this->scale = 1.0;
+	positionAtBaseline = true;
+	updateFromLabel();
+}
+			
+
 SceneLabel::~SceneLabel() {
 SceneLabel::~SceneLabel() {
 }
 }
 
 
@@ -44,6 +54,10 @@ Label *SceneLabel::getLabel() {
 	return label;
 	return label;
 }
 }
 
 
+String SceneLabel::getText() {
+	return label->getText();
+}
+
 void SceneLabel::updateFromLabel() {
 void SceneLabel::updateFromLabel() {
 
 
 	MaterialManager *materialManager = CoreServices::getInstance()->getMaterialManager();	
 	MaterialManager *materialManager = CoreServices::getInstance()->getMaterialManager();	
@@ -72,7 +86,13 @@ void SceneLabel::updateFromLabel() {
 	// TODO: resize it here
 	// TODO: resize it here
 	
 	
 	bBoxRadius = label->getWidth()*scale;
 	bBoxRadius = label->getWidth()*scale;
+}
 
 
+void SceneLabel::Render() {
+	if(positionAtBaseline) {
+		CoreServices::getInstance()->getRenderer()->translate2D(0.0, -label->getBaselineAdjust() + label->getSize());
+	}
+	ScenePrimitive::Render();
 }
 }
 
 
 void SceneLabel::setText(const String& newText) {
 void SceneLabel::setText(const String& newText) {

+ 1 - 1
Core/Contents/Source/PolySceneLight.cpp

@@ -30,7 +30,7 @@
 
 
 using namespace Polycode;
 using namespace Polycode;
 
 
-SceneLight::SceneLight(int type, Scene *parentScene, Number intensity, Number constantAttenuation, Number linearAttenuation, Number quadraticAttenuation) : SceneEntity() {
+SceneLight::SceneLight(int type, Scene *parentScene, Number intensity, Number constantAttenuation, Number linearAttenuation, Number quadraticAttenuation) : Entity() {
 	this->type = type;
 	this->type = type;
 	this->intensity = intensity;
 	this->intensity = intensity;
 	this->constantAttenuation = constantAttenuation;
 	this->constantAttenuation = constantAttenuation;

+ 2 - 2
Core/Contents/Source/PolySceneLine.cpp

@@ -26,7 +26,7 @@
 
 
 using namespace Polycode;
 using namespace Polycode;
 
 
-SceneLine::SceneLine(Vector3 start, Vector3 end) : SceneEntity() {
+SceneLine::SceneLine(Vector3 start, Vector3 end) : Entity() {
 	this->ent1 = NULL;
 	this->ent1 = NULL;
 	this->ent2 = NULL;	
 	this->ent2 = NULL;	
 	
 	
@@ -47,7 +47,7 @@ SceneLine::SceneLine(Vector3 start, Vector3 end) : SceneEntity() {
 	
 	
 }
 }
 
 
-SceneLine::SceneLine(SceneEntity *ent1, SceneEntity *ent2) : SceneEntity() {
+SceneLine::SceneLine(Entity *ent1, Entity *ent2) : Entity() {
 	this->ent1 = ent1;
 	this->ent1 = ent1;
 	this->ent2 = ent2;	
 	this->ent2 = ent2;	
 
 

+ 9 - 3
Core/Contents/Source/PolySceneMesh.cpp

@@ -28,6 +28,7 @@
 #include "PolyRenderer.h"
 #include "PolyRenderer.h"
 #include "PolyMaterial.h"
 #include "PolyMaterial.h"
 #include "PolyMesh.h"
 #include "PolyMesh.h"
+#include "PolyImage.h"
 #include "PolyShader.h"
 #include "PolyShader.h"
 #include "PolySkeleton.h"
 #include "PolySkeleton.h"
 #include "PolyResourceManager.h"
 #include "PolyResourceManager.h"
@@ -43,7 +44,7 @@ SceneMesh *SceneMesh::SceneMeshWithType(int meshType) {
 	return new SceneMesh(meshType);
 	return new SceneMesh(meshType);
 }
 }
 
 
-SceneMesh::SceneMesh(const String& fileName) : SceneEntity(), texture(NULL), material(NULL), skeleton(NULL), localShaderOptions(NULL) {
+SceneMesh::SceneMesh(const String& fileName) : Entity(), texture(NULL), material(NULL), skeleton(NULL), localShaderOptions(NULL) {
 	mesh = new Mesh(fileName);
 	mesh = new Mesh(fileName);
 	bBoxRadius = mesh->getRadius();
 	bBoxRadius = mesh->getRadius();
 	bBox = mesh->calculateBBox();
 	bBox = mesh->calculateBBox();
@@ -56,7 +57,7 @@ SceneMesh::SceneMesh(const String& fileName) : SceneEntity(), texture(NULL), mat
 	lineWidth = 1.0;
 	lineWidth = 1.0;
 }
 }
 
 
-SceneMesh::SceneMesh(Mesh *mesh) : SceneEntity(), texture(NULL), material(NULL), skeleton(NULL), localShaderOptions(NULL) {
+SceneMesh::SceneMesh(Mesh *mesh) : Entity(), texture(NULL), material(NULL), skeleton(NULL), localShaderOptions(NULL) {
 	this->mesh = mesh;
 	this->mesh = mesh;
 	bBoxRadius = mesh->getRadius();
 	bBoxRadius = mesh->getRadius();
 	bBox = mesh->calculateBBox();
 	bBox = mesh->calculateBBox();
@@ -142,7 +143,7 @@ void SceneMesh::setMaterialByName(const String& materialName) {
 	setMaterial(material);
 	setMaterial(material);
 }
 }
 
 
-Texture *SceneMesh::getTexture() {
+Texture *SceneMesh::getTexture() const {
 	return texture;
 	return texture;
 }
 }
 
 
@@ -152,6 +153,11 @@ void SceneMesh::loadTexture(const String& fileName) {
 	texture = materialManager->createTextureFromFile(fileName, materialManager->clampDefault, materialManager->mipmapsDefault);
 	texture = materialManager->createTextureFromFile(fileName, materialManager->clampDefault, materialManager->mipmapsDefault);
 }
 }
 
 
+void SceneMesh::loadTextureFromImage(Image *image) {
+	MaterialManager *materialManager = CoreServices::getInstance()->getMaterialManager();
+	texture = materialManager->createTextureFromImage(image, materialManager->clampDefault, materialManager->mipmapsDefault);	
+}
+
 ShaderBinding *SceneMesh::getLocalShaderOptions() {
 ShaderBinding *SceneMesh::getLocalShaderOptions() {
 	return localShaderOptions;
 	return localShaderOptions;
 }
 }

+ 23 - 0
Core/Contents/Source/PolyScenePrimitive.cpp

@@ -27,6 +27,17 @@ using namespace Polycode;
 
 
 ScenePrimitive::ScenePrimitive(int type, Number v1, Number v2, Number v3,Number v4,Number v5) : SceneMesh(Mesh::QUAD_MESH) {
 ScenePrimitive::ScenePrimitive(int type, Number v1, Number v2, Number v3,Number v4,Number v5) : SceneMesh(Mesh::QUAD_MESH) {
 
 
+	this->type = type;
+	this->v1 = v1;
+	this->v2 = v2;
+	this->v3 = v3;
+	this->v4 = v4;
+	this->v5 = v5;
+	
+	recreatePrimitive();
+}
+
+void ScenePrimitive::recreatePrimitive() {	
 	switch(type) {
 	switch(type) {
 		case TYPE_PLANE:
 		case TYPE_PLANE:
 			mesh->createPlane(v1,v2);
 			mesh->createPlane(v1,v2);
@@ -79,6 +90,18 @@ ScenePrimitive::ScenePrimitive(int type, Number v1, Number v2, Number v3,Number
 	}
 	}
 }
 }
 
 
+void ScenePrimitive::setPrimitiveOptions(int type, Number v1, Number v2, Number v3,Number v4,Number v5) {
+
+	this->type = type;
+	this->v1 = v1;
+	this->v2 = v2;
+	this->v3 = v3;
+	this->v4 = v4;
+	this->v5 = v5;
+
+	recreatePrimitive();
+}
+
 ScenePrimitive::~ScenePrimitive() {
 ScenePrimitive::~ScenePrimitive() {
 
 
 }
 }

+ 2 - 2
Core/Contents/Source/PolySceneSound.cpp

@@ -27,7 +27,7 @@ THE SOFTWARE.
 
 
 using namespace Polycode;
 using namespace Polycode;
 
 
-SceneSoundListener::SceneSoundListener() : SceneEntity() {
+SceneSoundListener::SceneSoundListener() : Entity() {
 
 
 }
 }
 SceneSoundListener::~SceneSoundListener() {
 SceneSoundListener::~SceneSoundListener() {
@@ -44,7 +44,7 @@ void SceneSoundListener::Update() {
 }
 }
 
 
 
 
-SceneSound::SceneSound(const String& fileName, Number referenceDistance, Number maxDistance, bool directionalSound) : SceneEntity() {
+SceneSound::SceneSound(const String& fileName, Number referenceDistance, Number maxDistance, bool directionalSound) : Entity() {
 
 
 	this->directionalSound = directionalSound;
 	this->directionalSound = directionalSound;
 	
 	

+ 0 - 213
Core/Contents/Source/PolyScreen.cpp

@@ -1,213 +0,0 @@
-/*
- Copyright (C) 2011 by Ivan Safrin
- 
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
- 
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
- 
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
-*/
-
-#include "PolyScreen.h"
-#include "PolyCoreServices.h"
-#include "PolyInputEvent.h"
-#include "PolyScreenManager.h"
-#include "PolyResourceManager.h"
-#include "PolyCore.h"
-#include "PolyMaterial.h"
-#include "PolyRenderer.h"
-#include "PolyScreenEntity.h"
-#include "PolyScreenEvent.h"
-#include "PolyShader.h"
-#include "PolyTexture.h"
-
-using namespace Polycode;
-
-Screen::Screen() : EventDispatcher() {
-	enabled = true;
-	focusChild = NULL;
-	originalSceneTexture = NULL;
-	CoreServices::getInstance()->getScreenManager()->addScreen(this);
-	filterShaderMaterial = NULL;
-	_hasFilterShader = false;
-	useNormalizedCoordinates = false;
-	processTouchEventsAsMouse = false;
-	ownsChildren = false;
-
-	rootEntity.processInputEvents = true;
-	rootEntity.setPositionMode(ScreenEntity::POSITION_CENTER);
-	rootEntity.setRenderer(renderer);
-	rootEntity.setDefaultScreenOptions(false);		
-}
-
-Screen::~Screen() {
-	CoreServices::getInstance()->getScreenManager()->removeScreen(this);
-
-	for(int i=0; i < localShaderOptions.size(); i++) {
-		delete localShaderOptions[i];
-	}
-	delete originalSceneTexture;			
-}
-
-void Screen::setNormalizedCoordinates(bool newVal, Number yCoordinateSize) {
-	useNormalizedCoordinates = newVal;
-	this->yCoordinateSize = yCoordinateSize;
-}
-
-void Screen::handleInputEvent(InputEvent *inputEvent) {
-	
-		switch(inputEvent->getEventCode()) {
-		
-			case InputEvent::EVENT_TOUCHES_BEGAN:
-				if(processTouchEventsAsMouse) {
-					for(int j=0; j < inputEvent->touches.size(); j++) {
-						rootEntity._onMouseDown(inputEvent->touches[j].position.x, inputEvent->touches[j].position.y, CoreInput::MOUSE_BUTTON1, inputEvent->timestamp);
-					}
-				}
-			break;
-			case InputEvent::EVENT_MOUSEDOWN:
-				rootEntity._onMouseDown(inputEvent->mousePosition.x, inputEvent->mousePosition.y, inputEvent->mouseButton, inputEvent->timestamp);
-			break;
-			case InputEvent::EVENT_MOUSEMOVE:
-				rootEntity._onMouseMove(inputEvent->mousePosition.x, inputEvent->mousePosition.y, inputEvent->timestamp);
-			break;
-			case InputEvent::EVENT_MOUSEUP:
-				rootEntity._onMouseUp(inputEvent->mousePosition.x, inputEvent->mousePosition.y, inputEvent->mouseButton, inputEvent->timestamp);
-			break;
-			case InputEvent::EVENT_MOUSEWHEEL_UP:
-				rootEntity._onMouseWheelUp(inputEvent->mousePosition.x, inputEvent->mousePosition.y, inputEvent->timestamp);
-			break;
-			case InputEvent::EVENT_MOUSEWHEEL_DOWN:
-				rootEntity._onMouseWheelDown(inputEvent->mousePosition.x, inputEvent->mousePosition.y,inputEvent->timestamp);	
-			break;				
-			case InputEvent::EVENT_KEYDOWN:
-				rootEntity._onKeyDown(inputEvent->key, inputEvent->charCode);
-			break;
-			case InputEvent::EVENT_KEYUP:
-				rootEntity._onKeyUp(inputEvent->key, inputEvent->charCode);
-			break;			
-		}
-}
-
-void Screen::setRenderer(Renderer *renderer) {
-	this->renderer = renderer;
-}
-
-void Screen::setScreenShader(const String& shaderName) {
-	filterShaderMaterial = (Material*)CoreServices::getInstance()->getResourceManager()->getResource(Resource::RESOURCE_MATERIAL, shaderName);
-	if(!filterShaderMaterial)
-		return;
-		
-	if(filterShaderMaterial->getNumShaders() == 0)
-		return;
-	
-	if(!originalSceneTexture) {
-		CoreServices::getInstance()->getRenderer()->createRenderTextures(&originalSceneTexture, NULL, CoreServices::getInstance()->getCore()->getXRes(), CoreServices::getInstance()->getCore()->getYRes(), filterShaderMaterial->fp16RenderTargets);
-	}
-	
-	for(int i=0; i < filterShaderMaterial->getNumShaders(); i++) {
-		ShaderBinding* binding = filterShaderMaterial->getShader(i)->createBinding();	
-		localShaderOptions.push_back(binding);
-	}	
-	_hasFilterShader = true;
-	
-}
-
-void Screen::clearScreenShader() {
-	if(_hasFilterShader) {
-		_hasFilterShader = false;
-		filterShaderMaterial = NULL;
-	}
-}
-
-
-void Screen::drawFilter() {
-	
-	if(!filterShaderMaterial)
-		return;
-	
-	Renderer *renderer = CoreServices::getInstance()->getRenderer();
-	
-	renderer->bindFrameBufferTexture(originalSceneTexture);
-	
-	Render();
-	renderer->unbindFramebuffers();
-	
-	ShaderBinding* materialBinding;		
-	for(int i=0; i < filterShaderMaterial->getNumShaders(); i++) {
-		materialBinding = filterShaderMaterial->getShaderBinding(i);
-		
-		for(int j=0; j < materialBinding->getNumColorTargetBindings(); j++) {
-			RenderTargetBinding *colorBinding = materialBinding->getColorTargetBinding(j);
-			materialBinding->clearTexture(colorBinding->name);
-			materialBinding->addTexture(colorBinding->name, originalSceneTexture);
-		}
-		
-		renderer->applyMaterial(filterShaderMaterial, localShaderOptions[i], i);	
-			
-		if(i==filterShaderMaterial->getNumShaders()-1) {
-			renderer->loadIdentity();
-			renderer->drawScreenQuad(renderer->getXRes(), renderer->getYRes());		
-		} else {
-			for(int j=0; j < materialBinding->getNumOutTargetBindings(); j++) {
-				Texture *bindingTexture = materialBinding->getOutTargetBinding(j)->texture;
-				renderer->bindFrameBufferTexture(bindingTexture);
-				
-				renderer->drawScreenQuad(bindingTexture->getWidth(), bindingTexture->getHeight());
-				renderer->unbindFramebuffers();
-			}						
-		}
-		renderer->clearShader();
-		renderer->loadIdentity();		
-		renderer->setOrthoMode();
-	}
-	
-}
-
-void Screen::setScreenOffset(Number x, Number y) {
-	offset.x = x;
-	offset.y = y;	
-}
-
-bool Screen::hasFilterShader() const {
-	return _hasFilterShader;
-}
-
-void Screen::addEntity(ScreenEntity *newEntity) {
-	rootEntity.addChild(newEntity);
-}
-
-void Screen::addChild(ScreenEntity *newEntity) {
-	addEntity(newEntity);
-}
-
-void Screen::removeChild(ScreenEntity *entityToRemove) {
-	rootEntity.removeChild(entityToRemove);
-}
-
-void Screen::Shutdown() {
-	
-}
-
-void Screen::Update() {
-	rootEntity.doUpdates();
-}
-
-void Screen::Render() {
-	renderer->loadIdentity();
-	renderer->translate2D(offset.x, offset.y);
-	rootEntity.updateEntityMatrix();
-	rootEntity.transformAndRender();	
-}

+ 0 - 695
Core/Contents/Source/PolyScreenEntity.cpp

@@ -1,695 +0,0 @@
-/*
- Copyright (C) 2011 by Ivan Safrin
- 
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
- 
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
- 
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
-*/
-
-#include "PolyScreenEntity.h"
-#include "PolyInputEvent.h"
-#include "PolyRectangle.h"
-#include "PolyPolygon.h"
-#include "PolyVertex.h"
-#include "PolyRenderer.h"
-#include "PolyCoreServices.h"
-#include "PolyLogger.h"
-
-inline double round(double x) { return floor(x + 0.5); }
-
-using namespace Polycode;
-
-ScreenEntity::ScreenEntity() : Entity() {
-	color = Color(1.0f,1.0f,1.0f,1.0f);
-	width = 0;
-	height = 0;
-	setHitbox(0, 0);
-	backfaceCulled = false;
-	positionMode = POSITION_TOPLEFT;
-	mouseOver = false;
-	dragged = false;
-
-	dragOffsetX = 0;
-	dragOffsetY = 0;
-	parentEntity = NULL;
-	
-	depthWrite = false;
-	depthTest = false;
-	
-	focusable = false;
-	hasFocus = false;
-	focusChildren = false;	
-	blockMouseInput = false;
-	
-	snapToPixels = false;
-
-	lastClickTicks = 0;
-	dragLimits = NULL;
-	
-	xmouse = 0;
-	ymouse = 0;
-		
-	processInputEvents = false;
-	
-}
-
-Entity *ScreenEntity::Clone(bool deepClone, bool ignoreEditorOnly) const {
-	ScreenEntity *newEntity = new ScreenEntity();
-	applyClone(newEntity, deepClone, ignoreEditorOnly);
-	return newEntity;
-}
-
-void ScreenEntity::applyClone(Entity *clone, bool deepClone, bool ignoreEditorOnly) const {
-	Entity::applyClone(clone, deepClone, ignoreEditorOnly);
-
-	ScreenEntity *_clone = (ScreenEntity*) clone;
-	_clone->width = width;
-	_clone->height = height;
-	_clone->setHitbox(hit.x, hit.y, hit.w, hit.h);
-	_clone->positionMode = positionMode;
-	_clone->focusable = focusable;
-	_clone->blockMouseInput = blockMouseInput;
-	_clone->snapToPixels = snapToPixels;
-	_clone->processInputEvents = processInputEvents;
-	
-}
-
-void ScreenEntity::addEntity(Entity *newChild) {
-	((ScreenEntity*)newChild)->setDefaultScreenOptions(snapToPixels);
-	Entity::addEntity(newChild);
-}
-		
-void ScreenEntity::setDefaultScreenOptions(bool snapToPixels) {
-	this->snapToPixels = snapToPixels;
-		for(int i=0; i < children.size(); i++) {
-			((ScreenEntity*)children[i])->setDefaultScreenOptions(snapToPixels);
-		}
-}
-
-void ScreenEntity::focusNextChild() {
-	int j = 0;
-	bool hasFocusedChild = false;
-	if(CoreServices::getInstance()->focusedChild) {
-		for(int i=0; i < children.size(); i++) {
-			if(children[i] == CoreServices::getInstance()->focusedChild) {
-				j = i;
-				hasFocusedChild = true;
-			}
-		}
-	}
-	
-	if(!hasFocusedChild)
-		return;
-	
-	for(int i=0; i < children.size(); i++) {
-		if(((ScreenEntity*)children[j])->isFocusable() && children[j] != CoreServices::getInstance()->focusedChild) {
-			focusChild(((ScreenEntity*)children[j]));
-			return;
-		}
-		
-		j++;
-		if(j == children.size())
-			j = 0;
-	}
-}
-
-Number ScreenEntity::getRotation() const {
-	return this->getRoll();
-}
-
-void ScreenEntity::focusChild(ScreenEntity *child) {
-	if(CoreServices::getInstance()->focusedChild != NULL) {
-		((ScreenEntity*)CoreServices::getInstance()->focusedChild)->onLoseFocus();
-		((ScreenEntity*)CoreServices::getInstance()->focusedChild)->hasFocus = false;
-	}
-	CoreServices::getInstance()->focusedChild = child;
-	if(child) {	
-		((ScreenEntity*)CoreServices::getInstance()->focusedChild)->hasFocus = true;
-		((ScreenEntity*)CoreServices::getInstance()->focusedChild)->onGainFocus();
-	}
-}
-
-void ScreenEntity::moveChildUp(ScreenEntity *child) {
-	for(int i=0; i < children.size(); i++) {
-		if(children[i] == child && i < children.size()-1) {
-			ScreenEntity *next = (ScreenEntity*)children[i+1];
-			children[i+1] = child;
-			children[i] = next;
-			break;
-		}
-	}
-}
-
-void ScreenEntity::moveChildDown(ScreenEntity *child) {
-	for(int i=0; i < children.size(); i++) {
-		if(children[i] == child && i > 0) {
-			ScreenEntity *prev = (ScreenEntity*)children[i-1];
-			children[i-1] = child;
-			children[i] = prev;
-			break;
-		}
-	}
-}
-
-void ScreenEntity::moveChildTop(ScreenEntity *child) {
-	for(int i=0; i < children.size(); i++) {
-		if(children[i] == child && i < children.size()-1) {
-			children.erase(children.begin()+i);
-			children.push_back(child);
-			break;
-		}
-	}
-}
-
-void ScreenEntity::moveChildBottom(ScreenEntity *child) {
-	for(int i=0; i < children.size(); i++) {
-		if(children[i] == child && i > 0) {
-			children.erase(children.begin()+i);
-			children.insert(children.begin(), child);
-			break;
-		}
-	}
-}
-
-bool ScreenEntity::isFocusable() const {
-	return focusable;
-}
-
-void ScreenEntity::startDrag(Number xOffset, Number yOffset) {
-	dragged = true;
-	dragOffsetX = xOffset;
-	dragOffsetY = yOffset;
-}
-
-void ScreenEntity::stopDrag() {
-	dragged = false;
-}
-
-ScreenEntity::~ScreenEntity() {
-	if(CoreServices::getInstance()->focusedChild == this) {
-		CoreServices::getInstance()->focusedChild = NULL;
-	}
-	if(dragLimits) delete dragLimits;
-}
-
-void ScreenEntity::setBlendingMode(int newBlendingMode) {
-	blendingMode = newBlendingMode;
-}
-
-void ScreenEntity::setPosition(Number x, Number y) {
-	position.x  = x;
-	position.y  = y;
-	matrixDirty = true;
-}
-
-void ScreenEntity::setPosition(const Vector2 &v) {
-	position.x  = v.x;
-	position.y  = v.y;
-	matrixDirty = true;	
-}
-
-void ScreenEntity::setScale(Number x, Number y) {
-	scale.x = x;
-	scale.y = y;
-	matrixDirty = true;	
-}
-
-void ScreenEntity::setScale(const Vector2 &v) {
-	scale.x = v.x;
-	scale.y = v.y;
-	matrixDirty = true;	
-}
-
-
-Number ScreenEntity::getWidth() const {
-	return width;
-}
-
-Number ScreenEntity::getHeight() const {
-	return height;
-}
-
-bool isPointInsidePolygon2D(Polycode::Polygon *poly, const Vector2 &p) {
-	Number angle = 0.0;
-	Vector2 p1,p2;
-/*	
-	printf("PIP: %f,%f in [%f,%f], [%f,%f], [%f,%f], [%f,%f]\n", p.x, p.y, 
-		poly->getVertex(0)->x, poly->getVertex(0)->y,
-		poly->getVertex(1)->x, poly->getVertex(1)->y,
-		poly->getVertex(2)->x, poly->getVertex(2)->y,
-		poly->getVertex(3)->x, poly->getVertex(3)->y);
-*/
-	for (int i=0; i < poly->getVertexCount(); i++) {
-
-		p1.x = poly->getVertex(i)->x - p.x;
-		p1.y = poly->getVertex(i)->y - p.y;
-		p2.x = poly->getVertex((i+1)%poly->getVertexCount())->x - p.x;
-		p2.y = poly->getVertex((i+1)%poly->getVertexCount())->y - p.y;
-		
-		Vector2 vec(p1.x,p1.y);
-		angle += vec.angle(Vector2(p2.x,p2.y));
-
-	}
-
-	if (fabs(angle) < PI)
-		return false;
-	else
-		return true;
-}
-
-
-bool ScreenEntity::hitTest(const Number x, const Number y) const {
-
-	Vector3 v;	
-	Polygon testPoly;
-
-	// matrix will give the center of the entity
-	Matrix4 screenMatrix = getScreenConcatenatedMatrix();
-	if(positionMode == POSITION_TOPLEFT) {
-		// Translate hitbox so it matches the visible object bounds
-		// This is a bit of a hack because ScreenEntities are expected
-		// to rotate about their center and not their center point.
-		Matrix4 retMatrix;
-		retMatrix.setPosition(width/2.0, height/2.0, 0.0);
-		screenMatrix = screenMatrix * retMatrix;
-	}
-	
-	v = Vector3(hit.x, hit.y, 0);
-	v = screenMatrix * v;
-	testPoly.addVertex(v.x, v.y, 0.0);
-	
-	v = Vector3(hit.x+hit.w, hit.y, 0);
-	v = screenMatrix * v;
-	testPoly.addVertex(v.x, v.y, 0.0);
-
-	v = Vector3(hit.x+hit.w, hit.y+hit.h, 0);
-	v = screenMatrix * v;
-	testPoly.addVertex(v.x, v.y, 0.0);
-
-	v = Vector3(hit.x,hit.y+hit.h, 0);
-	v = screenMatrix * v;
-	testPoly.addVertex(v.x, v.y, 0.0);
-		
-	return isPointInsidePolygon2D(&testPoly, Vector2(x,y));
-}
-
-bool ScreenEntity::hitTest(Vector2 v) const
-{
-	return hitTest(v.x, v.y);
-}
-
-void ScreenEntity::setPositionMode(int newPositionMode) {
-	positionMode = newPositionMode;
-}
-
-void ScreenEntity::_onKeyDown(PolyKEY key, wchar_t charCode) {
-	onKeyDown(key, charCode);
-	for(int i=0;i<children.size();i++) {
-		((ScreenEntity*)children[i])->_onKeyDown(key, charCode);
-	}
-}
-
-void ScreenEntity::_onKeyUp(PolyKEY key, wchar_t charCode) {
-	onKeyUp(key, charCode);
-	for(int i=0;i<children.size();i++) {
-		((ScreenEntity*)children[i])->_onKeyUp(key, charCode);
-	}
-}
-
-int ScreenEntity::getPositionMode() const {
-	return positionMode;
-}
-
-void ScreenEntity::setDragLimits(Polycode::Rectangle rect) {
-	if(!dragLimits)
-		dragLimits = new Polycode::Rectangle();
-	dragLimits->x = rect.x;
-	dragLimits->y = rect.y;
-	dragLimits->w = rect.w;
-	dragLimits->h = rect.h;		
-}
-
-void ScreenEntity::clearDragLimits() {
-	delete dragLimits;
-	dragLimits = NULL;
-}
-
-Rectangle ScreenEntity::getHitbox() const {
-	return hit;
-}
-
-void ScreenEntity::setHitbox(Number width, Number height) {
-	hit.w = width;
-	hit.h = height;
-	hit.x = -width/2;
-	hit.y = -height/2;
-}
-void ScreenEntity::setHitbox(Number width, Number height, Number left, Number top) {
-	hit.w = width;
-	hit.h = height;
-	hit.x = left;
-	hit.y = top;
-}
-
-bool ScreenEntity::isDragged() {
-	return dragged;
-}
-
-Matrix4 ScreenEntity::getScreenConcatenatedMatrix() const {
-	Matrix4 retMatrix = transformMatrix;
-	if(positionMode == POSITION_TOPLEFT) {
-		retMatrix.setPosition(position.x, position.y, position.z);
-	}
-	
-	if(parentEntity) {
-		return retMatrix * ((ScreenEntity*)parentEntity)->getScreenConcatenatedMatrix();
-	} else {
-		return retMatrix;
-	}
-}
-
-MouseEventResult ScreenEntity::_onMouseMove(Number x, Number y, int timestamp) {
-
-	if(dragged) {
-		Vector3 localCoordinate = Vector3(x,y,0);
-				
-		if(parentEntity) {
-			Matrix4 inverse = ((ScreenEntity*)parentEntity)->getScreenConcatenatedMatrix().Inverse();
-			localCoordinate = inverse * localCoordinate;		
-		}
-	
-		setPosition(localCoordinate.x-dragOffsetX,localCoordinate.y-dragOffsetY);
-		if(dragLimits) {
-			if(position.x < dragLimits->x)
-				position.x = dragLimits->x;
-			if(position.x > dragLimits->x + dragLimits->w)
-				position.x = dragLimits->x + dragLimits->w;
-			if(position.y < dragLimits->y)
-				position.y = dragLimits->y;
-			if(position.y > dragLimits->y + dragLimits->h)
-				position.y = dragLimits->y + dragLimits->h;
-		}
-	}
-
-	MouseEventResult ret;
-	ret.hit = false;
-	ret.blocked = false;
-
-	if(processInputEvents && enabled) {
-		if(hitTest(x,y)) {
-
-			Vector3 localCoordinate = Vector3(x,y,0);
-			Matrix4 inverse = getScreenConcatenatedMatrix().Inverse();
-			localCoordinate = inverse * localCoordinate;
-
-			onMouseMove(localCoordinate.x,localCoordinate.y);
-			xmouse = localCoordinate.x;
-			ymouse = localCoordinate.y;
-
-			dispatchEvent(new InputEvent(Vector2(localCoordinate.x,localCoordinate.y), timestamp), InputEvent::EVENT_MOUSEMOVE);
-
-			if(!mouseOver) {
-					dispatchEvent(new InputEvent(Vector2(localCoordinate.x,localCoordinate.y), timestamp), InputEvent::EVENT_MOUSEOVER);
-					mouseOver = true;
-			}
-			ret.hit = true;
-			if(blockMouseInput) {
-				ret.blocked = true;
-			}
-
-		} else {
-			if(mouseOver) {
-
-				Vector3 localCoordinate = Vector3(x,y,0);
-				Matrix4 inverse = getScreenConcatenatedMatrix().Inverse();
-				localCoordinate = inverse * localCoordinate;
-
-				dispatchEvent(new InputEvent(Vector2(localCoordinate.x,localCoordinate.y), timestamp), InputEvent::EVENT_MOUSEOUT);
-				mouseOver = false;
-			}
-		}
-
-		for(int i=children.size()-1;i>=0;i--) {
-			MouseEventResult childRes = ((ScreenEntity*)children[i])->_onMouseMove(x,y, timestamp);
-			if(childRes.hit)
-				ret.hit = true;
-			if(childRes.blocked) {
-				ret.blocked = true;
-				break;
-			}
-		}
-	}
-	
-	return ret;
-}
-
-MouseEventResult ScreenEntity::_onMouseUp(Number x, Number y, int mouseButton, int timestamp) {
-	MouseEventResult ret;
-	ret.hit = false;
-	ret.blocked = false;
-	
-	if(processInputEvents && enabled) {
-		if(hitTest(x,y)) {
-			Vector3 localCoordinate = Vector3(x,y,0);
-
-			Matrix4 inverse = getScreenConcatenatedMatrix().Inverse();
-			localCoordinate = inverse * localCoordinate;
-
-			onMouseUp(localCoordinate.x,localCoordinate.y);
-			InputEvent *inputEvent = new InputEvent(Vector2(localCoordinate.x,localCoordinate.y), timestamp);
-			inputEvent->mouseButton = mouseButton;
-			dispatchEvent(inputEvent, InputEvent::EVENT_MOUSEUP);
-
-			ret.hit = true;
-			if(blockMouseInput) {
-				ret.blocked = true;
-			}
-
-		} else {
-			Vector3 localCoordinate = Vector3(x,y,0);
-
-			Matrix4 inverse = getScreenConcatenatedMatrix().Inverse();
-			localCoordinate = inverse * localCoordinate;
-
-			InputEvent *inputEvent = new InputEvent(Vector2(localCoordinate.x,localCoordinate.y), timestamp);
-			inputEvent->mouseButton = mouseButton;
-			dispatchEvent(inputEvent, InputEvent::EVENT_MOUSEUP_OUTSIDE);
-		}
-
-		for(int i=children.size()-1;i>=0;i--) {
-			MouseEventResult childRes = ((ScreenEntity*)children[i])->_onMouseUp(x,y, mouseButton, timestamp);
-			if(childRes.hit)
-				ret.hit = true;
-			if(childRes.blocked) {
-				ret.blocked = true;
-				break;
-			}
-			
-		}
-	}
-	
-	return ret;
-}
-
-MouseEventResult ScreenEntity::_onMouseWheelUp(Number x, Number y, int timestamp) {
-
-	MouseEventResult ret;
-	ret.hit = false;
-	ret.blocked = false;
-	
-	if(processInputEvents && enabled) {
-		if(hitTest(x,y)) {
-			Vector3 localCoordinate = Vector3(x,y,0);
-
-			Matrix4 inverse = getScreenConcatenatedMatrix().Inverse();
-			localCoordinate = inverse * localCoordinate;
-
-			onMouseWheelUp(localCoordinate.x,localCoordinate.y);
-
-			InputEvent *inputEvent = new InputEvent(Vector2(localCoordinate.x,localCoordinate.y), timestamp);
-			dispatchEvent(inputEvent, InputEvent::EVENT_MOUSEWHEEL_UP);
-
-			ret.hit = true;
-			if(blockMouseInput) {
-				ret.blocked = true;
-			}
-
-		}
-
-		for(int i=children.size()-1;i>=0;i--) {
-			MouseEventResult childRes = ((ScreenEntity*)children[i])->_onMouseWheelUp(x,y, timestamp);
-			if(childRes.hit)
-				ret.hit = true;
-			if(childRes.blocked) {
-				ret.blocked = true;
-				break;
-			}
-		}
-	}
-	return ret;	
-}
-
-MouseEventResult ScreenEntity::_onMouseWheelDown(Number x, Number y, int timestamp) {
-	MouseEventResult ret;
-	ret.hit = false;
-	ret.blocked = false;
-	
-	if(processInputEvents && enabled) {
-		if(hitTest(x,y)) {
-			Vector3 localCoordinate = Vector3(x,y,0);
-
-			Matrix4 inverse = getScreenConcatenatedMatrix().Inverse();
-			localCoordinate = inverse * localCoordinate;
-
-			onMouseWheelDown(localCoordinate.x,localCoordinate.y);
-
-			InputEvent *inputEvent = new InputEvent(Vector2(localCoordinate.x,localCoordinate.y), timestamp);
-			dispatchEvent(inputEvent, InputEvent::EVENT_MOUSEWHEEL_DOWN);
-
-			ret.hit = true;
-			if(blockMouseInput) {
-				ret.blocked = true;
-			}
-		}
-
-		for(int i=children.size()-1;i>=0;i--) {
-			MouseEventResult childRes = ((ScreenEntity*)children[i])->_onMouseWheelDown(x,y, timestamp);
-			if(childRes.hit)
-				ret.hit = true;
-			if(childRes.blocked) {
-				ret.blocked = true;
-				break;
-			}
-			
-		}
-	}
-	
-	return ret;
-}
-
-MouseEventResult ScreenEntity::_onMouseDown(Number x, Number y, int mouseButton, int timestamp) {
-	MouseEventResult ret;
-	ret.hit = false;
-	ret.blocked = false;
-
-	if(processInputEvents && enabled) {
-		if(hitTest(x,y)) {
-			Vector3 localCoordinate = Vector3(x,y,0);
-
-			Matrix4 inverse = getScreenConcatenatedMatrix().Inverse();
-			localCoordinate = inverse * localCoordinate;
-
-			onMouseDown(localCoordinate.x,localCoordinate.y);
-
-			InputEvent *inputEvent = new InputEvent(Vector2(localCoordinate.x,localCoordinate.y), timestamp);
-
-			inputEvent->mouseButton = mouseButton;
-			dispatchEvent(inputEvent, InputEvent::EVENT_MOUSEDOWN);
-
-			if(timestamp - lastClickTicks < 400) {
-				InputEvent *inputEvent = new InputEvent(Vector2(x,y), timestamp);
-				inputEvent->mouseButton = mouseButton;
-				dispatchEvent(inputEvent, InputEvent::EVENT_DOUBLECLICK);
-			}
-			lastClickTicks = timestamp;
-			ret.hit = true;
-			if(blockMouseInput) {
-				ret.blocked = true;
-			}
-		}
-
-		for(int i=children.size()-1;i>=0;i--) {
-			MouseEventResult childRes = ((ScreenEntity*)children[i])->_onMouseDown(x,y, mouseButton, timestamp);
-			if(childRes.hit)
-				ret.hit = true;
-			if(childRes.blocked) {
-				ret.blocked = true;
-				break;
-			}
-		}
-	}
-	
-	return ret;
-}
-
-Vector2 ScreenEntity::getScreenPosition() const {
-	Matrix4 screenTransform = getScreenConcatenatedMatrix();
-	Vector3 screenPosition = screenTransform.getPosition();
-	return Vector2(screenPosition.x, screenPosition.y);
-}
-
-void ScreenEntity::setRotation(Number rotation) {
-	setRoll(rotation);
-}
-
-Vector2 ScreenEntity::getPosition2D() const {
-	return Vector2(position.x, position.y);
-}
-
-Vector2 ScreenEntity::getScale2D() const {
-	return Vector2(scale.x, scale.y);
-}
-
-Matrix4 ScreenEntity::buildPositionMatrix() {
-
-	Matrix4 posMatrix;
-	switch(positionMode) {
-		case POSITION_TOPLEFT:
-			posMatrix.m[3][0] = (position.x+floor(width/2.0f)*scale.x)*matrixAdj;
-			posMatrix.m[3][1] = (position.y+floor(height/2.0f)*scale.y)*matrixAdj;
-			posMatrix.m[3][2] = position.z*matrixAdj;			
-		break;
-		case POSITION_CENTER:
-			posMatrix.m[3][0] = position.x*matrixAdj;
-			posMatrix.m[3][1] = position.y*matrixAdj;
-			posMatrix.m[3][2] = position.z*matrixAdj;
-		break;
-	}
-	
-	
-	if(snapToPixels) {
-		posMatrix.m[3][0] = round(posMatrix.m[3][0]);
-		posMatrix.m[3][1] = round(posMatrix.m[3][1]);
-		posMatrix.m[3][2] = round(posMatrix.m[3][2]);		
-	}
-	
-	return posMatrix;
-}
-
-void ScreenEntity::adjustMatrixForChildren() {
-	if(positionMode == POSITION_TOPLEFT) {
-		if(snapToPixels) {
-			renderer->translate2D(-floor(width/2.0f), -floor(height/2.0f));			
-		} else {
-			renderer->translate2D(-width/2.0f, -height/2.0f);	
-		}
-	}
-}
-
-ScreenEntity *ScreenEntity::getScreenEntityById(String id, bool recursive) const {
-	return (ScreenEntity*)getEntityById(id, recursive);
-}
-
-std::vector<ScreenEntity*> ScreenEntity::getScreenEntitiesByTag(String tag, bool recursive) const {
-	std::vector<Entity*> entities = getEntitiesByTag(tag, recursive);
-	std::vector<ScreenEntity*> retEntities;
-	for(int i=0; i < entities.size(); i++) {
-		retEntities.push_back((ScreenEntity*)entities[i]);
-	}
-	return retEntities;
-}
-

+ 0 - 398
Core/Contents/Source/PolyScreenEntityInstance.cpp

@@ -1,398 +0,0 @@
-/*
- Copyright (C) 2011 by Ivan Safrin
- 
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
- 
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
- 
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
-*/
-
-#include "PolyScreenEntityInstance.h"
-#include "PolyLogger.h"
-#include "PolyCoreServices.h"
-#include "PolyResourceManager.h"
-
-using namespace Polycode;
-
-ScreenEntityInstanceResourceEntry::ScreenEntityInstanceResourceEntry(ScreenEntityInstance *instance)  : Resource(Resource::RESOURCE_SCREEN_ENTITY_INSTANCE) {
-	this->instance = instance;
-}
-
-ScreenEntityInstanceResourceEntry::~ScreenEntityInstanceResourceEntry() {
-
-}
-
-ScreenEntityInstance *ScreenEntityInstanceResourceEntry::getInstance() {
-	return instance;
-}
-
-void ScreenEntityInstanceResourceEntry::reloadResource() {
-	instance->reloadEntityInstance();
-	Resource::reloadResource();
-}
-
-ScreenEntityInstance *ScreenEntityInstance::BlankScreenEntityInstance() {
-	return new ScreenEntityInstance();
-}
-
-ScreenEntityInstance::ScreenEntityInstance(const String& fileName) : ScreenEntity() {
-	setPositionMode(ScreenEntity::POSITION_CENTER);
-	resourceEntry = new ScreenEntityInstanceResourceEntry(this);		
-	loadFromFile(fileName);
-	resourceEntry->setResourceName(fileName);
-	resourceEntry->setResourcePath(fileName);
-	cloneUsingReload = false;
-	ownsChildren = true;	
-}
-
-ScreenEntityInstance::ScreenEntityInstance() : ScreenEntity() {
-	cloneUsingReload = true;
-	ownsChildren = true;
-	resourceEntry = new ScreenEntityInstanceResourceEntry(this);
-}
-
-ScreenEntityInstance::~ScreenEntityInstance() {	
-	CoreServices::getInstance()->getResourceManager()->removeResource(resourceEntry);
-	delete resourceEntry;
-}
-
-void ScreenEntityInstance::reloadEntityInstance() {
-	loadFromFile(fileName);
-}
-
-ScreenEntityInstanceResourceEntry *ScreenEntityInstance::getResourceEntry() {
-	return resourceEntry;
-}
-
-Entity *ScreenEntityInstance::Clone(bool deepClone, bool ignoreEditorOnly) const {
-	ScreenEntityInstance *newEntity;
-	if(cloneUsingReload) {
-		newEntity = new ScreenEntityInstance(fileName);
-	} else {
-		newEntity = new ScreenEntityInstance();
-	}
-	applyClone(newEntity, deepClone, ignoreEditorOnly);
-	return newEntity;
-}
-
-void ScreenEntityInstance::applyClone(Entity *clone, bool deepClone, bool ignoreEditorOnly) const {
-	if(cloneUsingReload) {
-		ScreenEntity::applyClone(clone, false, ignoreEditorOnly);
-	} else {
-		ScreenEntity::applyClone(clone, deepClone, ignoreEditorOnly);
-		ScreenEntityInstance *_clone = (ScreenEntityInstance*) clone;
-		_clone->fileName = fileName;
-	}
-}
-
-void ScreenEntityInstance::applyScreenShape(ObjectEntry *entry, ScreenShape *shape) {
-	if(!entry) 
-		return;
-		
-	Number swidth = (*entry)["width"]->NumberVal;
-	Number sheight = (*entry)["height"]->NumberVal;
-	int type = (*entry)["type"]->intVal;
-	
-	shape->setShapeType(type);
-	shape->setShapeSize(swidth, sheight);
-
-	Number strokeColorR = (*entry)["strokeColorR"]->NumberVal;
-	Number strokeColorG = (*entry)["strokeColorG"]->NumberVal;
-	Number strokeColorB = (*entry)["strokeColorB"]->NumberVal;
-	Number strokeColorA = (*entry)["strokeColorA"]->NumberVal;
-
-	bool strokeEnabled = (*entry)["strokeEnabled"]->boolVal;					
-	Number strokeWidth = (*entry)["strokeWidth"]->NumberVal;
-	
-	shape->strokeEnabled = strokeEnabled;
-	shape->strokeWidth = strokeWidth;
-	shape->strokeColor = Color(strokeColorR, strokeColorG, strokeColorB, strokeColorA);
-	
-	
-}
-
-void ScreenEntityInstance::parseObjectIntoCurve(ObjectEntry *entry, BezierCurve *curve) {
-	curve->clearControlPoints();
-	ObjectEntry *controlPoints =(*entry)["controlPoints"];
-	if(controlPoints) {
-		for(int i=0; i < controlPoints->length; i++) {		
-			ObjectEntry *controlPoint = ((*controlPoints))[i];		
-			if(controlPoint) {
-				Vector2 vpt1;
-				Vector2 vpt2;
-				Vector2 vpt3;
-												
-				ObjectEntry *pt1 = ((*controlPoint))["pt1"];
-				if(pt1) {
-					vpt1.x = ((*pt1))["x"]->NumberVal;
-					vpt1.y = ((*pt1))["y"]->NumberVal;					
-				}
-
-				ObjectEntry *pt2 = ((*controlPoint))["pt2"];
-				if(pt2) {
-					vpt2.x = ((*pt2))["x"]->NumberVal;
-					vpt2.y = ((*pt2))["y"]->NumberVal;					
-				}
-
-				ObjectEntry *pt3 = ((*controlPoint))["pt3"];
-				if(pt3) {
-					vpt3.x = ((*pt3))["x"]->NumberVal;
-					vpt3.y = ((*pt3))["y"]->NumberVal;					
-				}
-
-				curve->addControlPoint(vpt1.x, vpt1.y, 0.0, vpt2.x, vpt2.y, 0.0, vpt3.x, vpt3.y, 0.0);
-			}
-		}
-	}
-	
-}
-
-ScreenEntity *ScreenEntityInstance::loadObjectEntryIntoEntity(ObjectEntry *entry, ScreenEntity *targetEntity) {
-
-	ScreenEntity *entity = NULL;
-	
-	ObjectEntry *entityType = (*entry)["type"];
-	if(entityType) {
-	
-		if(entityType->stringVal == "ScreenImage") {
-			ObjectEntry *screenImageEntry = (*entry)["ScreenImage"];			
-			String imagePath = (*screenImageEntry)["filePath"]->stringVal;
-			ScreenImage *image = new ScreenImage(imagePath);
-			
-			ObjectEntry *screenShapeEntry = (*entry)["ScreenShape"];
-			applyScreenShape(screenShapeEntry, image);
-			entity = image;
-		}
-		
-		if(entityType->stringVal == "ScreenParticleEmitter") {
-			ObjectEntry *emitterEntry = (*entry)["ScreenParticleEmitter"];
-									
-			ScreenParticleEmitter *placingEmitter = new ScreenParticleEmitter((*emitterEntry)["texturePath"]->stringVal, Particle::BILLBOARD_PARTICLE, ParticleEmitter::CONTINUOUS_EMITTER, (*emitterEntry)["lifespan"]->NumberVal, (*emitterEntry)["particleCount"]->NumberVal, Vector3((*emitterEntry)["dirX"]->NumberVal, (*emitterEntry)["dirY"]->NumberVal, 0.0), Vector3((*emitterEntry)["gravX"]->NumberVal, (*emitterEntry)["gravY"]->NumberVal, 0.0), Vector3((*emitterEntry)["deviationX"]->NumberVal, (*emitterEntry)["deviationY"]->NumberVal, 0.0), Vector3((*emitterEntry)["radiusX"]->NumberVal, (*emitterEntry)["radiusY"]->NumberVal, 0.0));
-			
-				placingEmitter->brightnessDeviation = (*emitterEntry)["brightnessDeviation"]->NumberVal;
-				placingEmitter->particleSize = (*emitterEntry)["particleSize"]->NumberVal;
-				placingEmitter->perlinModSize = (*emitterEntry)["perlinModSize"]->NumberVal;
-				placingEmitter->perlinEnabled = (*emitterEntry)["perlinEnabled"]->boolVal;
-				placingEmitter->particleSpeedMod = (*emitterEntry)["particleSpeedMod"]->NumberVal;
-
-				placingEmitter->rotationSpeed = (*emitterEntry)["rotationSpeed"]->NumberVal;
-				placingEmitter->rotationFollowsPath = (*emitterEntry)["rotationFollowsPath"]->boolVal;
-				placingEmitter->useScaleCurves = (*emitterEntry)["useScaleCurves"]->boolVal;
-				placingEmitter->useColorCurves = (*emitterEntry)["useColorCurves"]->boolVal;
-				
-				bool boolVal;
-				if(emitterEntry->readBool("ignoreParentMatrix", &boolVal)) {
-					placingEmitter->setIgnoreParentMatrix(boolVal);
-				}
-									
-				placingEmitter->setParticleBlendingMode((*emitterEntry)["particleBlendMode"]->intVal);			
-				
-				placingEmitter->setWidth(placingEmitter->emitterRadius.x);
-				placingEmitter->setHeight(placingEmitter->emitterRadius.y);	
-				
-				parseObjectIntoCurve((*emitterEntry)["scaleCurve"], &placingEmitter->scaleCurve);
-				parseObjectIntoCurve((*emitterEntry)["colorCurveR"], &placingEmitter->colorCurveR);
-				parseObjectIntoCurve((*emitterEntry)["colorCurveG"], &placingEmitter->colorCurveG);
-				parseObjectIntoCurve((*emitterEntry)["colorCurveB"], &placingEmitter->colorCurveB);
-				parseObjectIntoCurve((*emitterEntry)["colorCurveA"], &placingEmitter->colorCurveA);										
-			
-			entity = placingEmitter;
-		
-		}		
-
-		if(entityType->stringVal == "ScreenSprite") {
-			ObjectEntry *screenSpriteEntry = (*entry)["ScreenSprite"];			
-			String filePath = (*screenSpriteEntry)["filePath"]->stringVal;
-			
-			ScreenSprite *sprite = new ScreenSprite(filePath);
-			
-			String animName = (*screenSpriteEntry)["anim"]->stringVal;
-			sprite->playAnimation(animName, -1, false);
-		
-
-			ObjectEntry *screenShapeEntry = (*entry)["ScreenShape"];
-			applyScreenShape(screenShapeEntry, sprite);
-			entity = sprite;
-		}
-
-
-		if(entityType->stringVal == "ScreenEntityInstance") {
-			ObjectEntry *screenInstanceEntry = (*entry)["ScreenEntityInstance"];
-			String filePath = (*screenInstanceEntry)["filePath"]->stringVal;
-			ScreenEntityInstance *instance = new ScreenEntityInstance(filePath);			
-			entity = instance;
-		}
-		
-
-		if(entityType->stringVal == "ScreenShape") {
-			ObjectEntry *screenShapeEntry = (*entry)["ScreenShape"];
-			ScreenShape *shape = new ScreenShape(0, 1, 1);
-			applyScreenShape(screenShapeEntry, shape);
-			entity = shape;
-		}
-		
-		if(entityType->stringVal == "ScreenSound") {
-			ObjectEntry *screenSoundEntry = (*entry)["ScreenSound"];
-			
-			String filePath = (*screenSoundEntry)["filePath"]->stringVal;
-			Number refDistance = (*screenSoundEntry)["refDistance"]->NumberVal;
-			Number maxDistance = (*screenSoundEntry)["maxDistance"]->NumberVal;
-			Number volume = (*screenSoundEntry)["volume"]->NumberVal;
-			Number pitch = (*screenSoundEntry)["pitch"]->NumberVal;
-															
-			ScreenSound *sound = new ScreenSound(filePath, refDistance, maxDistance);
-			sound->getSound()->setVolume(volume);
-			sound->getSound()->setPitch(pitch);	
-			
-			sound->setWidth(50);
-			sound->setHeight(50);				
-										
-			entity = sound;
-		}		
-		
-
-		if(entityType->stringVal == "ScreenLabel") {
-			ObjectEntry *screenLabelEntry = (*entry)["ScreenLabel"];
-			
-			String text = (*screenLabelEntry)["text"]->stringVal;
-			String font = (*screenLabelEntry)["font"]->stringVal;
-			int size = (*screenLabelEntry)["size"]->intVal;
-			int aaMode = (*screenLabelEntry)["aaMode"]->intVal;
-												
-			ScreenLabel *label = new ScreenLabel(text, size, font, aaMode);
-			label->positionAtBaseline = false;
-			
-			ObjectEntry *screenShapeEntry = (*entry)["ScreenShape"];			
-			applyScreenShape(screenShapeEntry, label);
-			entity = label;
-		}
-	
-	} 
-
-	if(!entity) {
-		if(targetEntity) {
-			entity = targetEntity;
-		} else {
-			entity = new ScreenEntity();
-		}
-	}
-	
-	entity->ownsChildren = true;
-	
-	if((*entry)["positionMode"]) {
-		entity->setPositionMode((*entry)["positionMode"]->intVal);
-	} else {
-		entity->setPositionMode(ScreenEntity::POSITION_CENTER);
-	}
-
-	Number _width, _height;
-	
-	if(entry->readNumber("width", &_width)) {
-		entity->setWidth(_width);	
-	}
-	
-	if(entry->readNumber("height", &_height)) {
-		entity->setHeight(_height);	
-	}
-
-	entity->color.r = (*entry)["colorR"]->NumberVal;
-	entity->color.g = (*entry)["colorG"]->NumberVal;
-	entity->color.b = (*entry)["colorB"]->NumberVal;
-	entity->color.a = (*entry)["colorA"]->NumberVal;
-
-
-	if(!targetEntity) {	
-		entity->blendingMode = (*entry)["blendMode"]->intVal;
-
-		entity->scale.x = (*entry)["scaleX"]->NumberVal;
-		entity->scale.y = (*entry)["scaleY"]->NumberVal;
-
-		entity->position.x = (*entry)["posX"]->NumberVal;
-		entity->position.y = (*entry)["posY"]->NumberVal;
-
-		entity->setRotation((*entry)["rotation"]->NumberVal);
-	} else {
-	
-	}
-	
-	if((*entry)["id"]->stringVal != "") {
-		entity->id = (*entry)["id"]->stringVal;
-	}
-	
-	String tagString = (*entry)["tags"]->stringVal; 
-	
-	if(tagString != "") {
-		std::vector<String> tags = tagString.split(",");
-		for(int i=0; i < tags.size(); i++) {
-			entity->addTag(tags[i]);
-		}
-	}
-	
-	ObjectEntry *props = (*entry)["props"];
-	if(props) {
-		for(int i=0; i < props->length; i++) {		
-			ObjectEntry *prop = ((*props))[i];		
-			if(prop) {
-				entity->setEntityProp((*prop)["name"]->stringVal, (*prop)["value"]->stringVal);
-			}
-		}
-	}
-														
-	ObjectEntry *children = (*entry)["children"];
-	
-	if(children) {
-		for(int i=0; i < children->length; i++) {
-			ObjectEntry *childEntry = ((*children))[i];
-			ScreenEntity *childEntity = loadObjectEntryIntoEntity(childEntry);
-			entity->addChild(childEntity);				
-		}
-	}
-		
-	return entity;
-}
-
-String ScreenEntityInstance::getFileName() const {
-	return fileName;
-}
-
-void ScreenEntityInstance::clearInstance() {
-	for(int i=0; i < children.size(); i++) {
-		removeChild(children[i]);
-		children[i]->setOwnsChildrenRecursive(true);
-		delete children[i];
-	}
-}
-
-bool ScreenEntityInstance::loadFromFile(const String& fileName) {
-
-	clearInstance();
-	
-	resourceEntry->resourceFileTime = OSBasics::getFileTime(fileName);
-
-	this->ownsChildren = true;
-	this->fileName = fileName;
-	Object loadObject;
-	if(!loadObject.loadFromBinary(fileName)) {
-		Logger::log("Error loading entity instance.\n");
-	}	
-	ObjectEntry *root = loadObject.root["root"];
-	
-	if(root) {
-		loadObjectEntryIntoEntity(root, this);
-	}
-	
-	return true;
-}

+ 0 - 33
Core/Contents/Source/PolyScreenEvent.cpp

@@ -1,33 +0,0 @@
-/*
- Copyright (C) 2011 by Ivan Safrin
- 
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
- 
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
- 
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
-*/
-
-#include "PolyScreenEvent.h"
-
-using namespace Polycode;
-
-ScreenEvent::ScreenEvent() {
-	eventType = "ScreenEvent";
-}
-
-ScreenEvent::~ScreenEvent() {
-
-}

+ 0 - 100
Core/Contents/Source/PolyScreenLabel.cpp

@@ -1,100 +0,0 @@
-/*
- Copyright (C) 2011 by Ivan Safrin
- 
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
- 
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
- 
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
-*/
-
-#include "PolyScreenLabel.h"
-#include "PolyCoreServices.h"
-#include "PolyFontManager.h"
-#include "PolyFont.h"
-#include "PolyLabel.h"
-#include "PolyMaterialManager.h"
-#include "PolyMesh.h"
-#include "PolyPolygon.h"
-#include "PolyScreenImage.h"
-#include "PolyRenderer.h"
-
-using namespace Polycode;
-
-ScreenLabel::ScreenLabel(const String& text, int size, const String& fontName, int amode, bool premultiplyAlpha) : ScreenShape(ScreenShape::SHAPE_RECT,1,1) {
-	label = new Label(CoreServices::getInstance()->getFontManager()->getFontByName(fontName), text, size, amode, premultiplyAlpha);
-	texture = NULL;
-	updateTexture();
-	setPositionMode(POSITION_TOPLEFT);
-	colorAffectsChildren = false;
-	positionAtBaseline = true;
-}
-
-ScreenLabel::~ScreenLabel() {
-	delete label;
-}
-
-Label *ScreenLabel::getLabel() const {
-	return label;
-}
-
-Entity *ScreenLabel::Clone(bool deepClone, bool ignoreEditorOnly) const {
-	ScreenLabel *newLabel = new ScreenLabel(getText(), label->getSize(), label->getFont()->getFontName(), label->getAntialiasMode());
-	applyClone(newLabel, deepClone, ignoreEditorOnly);
-	return newLabel;
-}
-
-void ScreenLabel::applyClone(Entity *clone, bool deepClone, bool ignoreEditorOnly) const {
-	ScreenShape::applyClone(clone, deepClone, ignoreEditorOnly);
-	ScreenLabel *_clone = (ScreenLabel*) clone;
-	_clone->positionAtBaseline = positionAtBaseline;
-}
-
-const String& ScreenLabel::getText() const {
-	return label->getText();
-}	
-
-void ScreenLabel::updateTexture() {
-	
-	if(texture) {
-		CoreServices::getInstance()->getMaterialManager()->deleteTexture(texture);
-	}
-	
-	texture = NULL;
-	if(!label->getFont())
-		return;
-	if(!label->getFont()->isValid())
-		return;				
-	
-	texture = CoreServices::getInstance()->getMaterialManager()->createTextureFromImage(label, true, false);
-	setWidth(label->getWidth());
-	setHeight(label->getHeight());
-	setShapeSize(width, height);
-
-}
-
-void ScreenLabel::Render() {
-	if(positionAtBaseline) {
-		CoreServices::getInstance()->getRenderer()->translate2D(0.0, -label->getBaselineAdjust() + label->getSize());
-	}
-	ScreenShape::Render();
-}
-
-void ScreenLabel::setText(const String& newText) {
-	if(newText != label->getText() || label->optionsChanged()) {
-		label->setText(newText);	
-		updateTexture();
-	}
-}

+ 0 - 117
Core/Contents/Source/PolyScreenLine.cpp

@@ -1,117 +0,0 @@
-/*
- Copyright (C) 2011 by Ivan Safrin
- 
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
- 
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
- 
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
-*/
-
-#include "PolyScreenLine.h"
-#include "PolyCoreServices.h"
-#include "PolyMesh.h"
-#include "PolyPolygon.h"
-#include "PolyRenderer.h"
-
-using namespace Polycode;
-
-ScreenLine::ScreenLine(Vector2 start, Vector2 end) : ScreenMesh(Mesh::LINE_MESH) {
-	target1 = NULL;
-	initMesh();
-		
-	startVertex->x = start.x;
-	startVertex->y = start.y;
-	endVertex->x = end.x;
-	endVertex->y = end.y;
-	lineWidth = 1.0f;
-	mesh->arrayDirtyMap[RenderDataArray::VERTEX_DATA_ARRAY] = true;	
-}
-
-ScreenLine *ScreenLine::ScreenLineBetweenEntities(ScreenEntity* target1, ScreenEntity* target2) {
-	return new ScreenLine(target1, target2);
-}	
-
-
-ScreenLine::ScreenLine(ScreenEntity* target1, ScreenEntity* target2) : ScreenMesh(Mesh::LINE_MESH) {
-	initMesh();	
-	this->target1 = target1;
-	this->target2 = target2;
-	lineWidth = 1.0f;
-
-}
-
-void ScreenLine::setStart(Vector2 point) {
-	startVertex->x = point.x;
-	startVertex->y = point.y;
-	mesh->arrayDirtyMap[RenderDataArray::VERTEX_DATA_ARRAY] = true;
-}
-
-void ScreenLine::setEnd(Vector2 point) {
-	endVertex->x = point.x;
-	endVertex->y = point.y;
-	mesh->arrayDirtyMap[RenderDataArray::VERTEX_DATA_ARRAY] = true;	
-}
-
-void ScreenLine::initMesh() {
-	Polygon *poly = new Polygon();
-	startVertex = poly->addVertex(0, 0, 0, 0,0);
-	endVertex = poly->addVertex(0,0,0,1,0);	
-	mesh->addPolygon(poly);
-	mesh->arrayDirtyMap[RenderDataArray::VERTEX_DATA_ARRAY] = true;			
-	mesh->arrayDirtyMap[RenderDataArray::COLOR_DATA_ARRAY] = true;			
-	mesh->arrayDirtyMap[RenderDataArray::TEXCOORD_DATA_ARRAY] = true;				
-}
-
-ScreenLine::~ScreenLine() {
-
-}
-
-
-void ScreenLine::setLineWidth(Number width) {
-	lineWidth = width;
-}
-
-void ScreenLine::Update() {
-	if(!target1)
-		return;
-	Vector3 pos1 = target1->getPosition();
-	Vector3 pos2 = target2->getPosition();
-	
-	setPosition(pos1.x, pos1.y);
-	endVertex->x = pos2.x-pos1.x;
-	endVertex->y = pos2.y-pos1.y;
-
-	mesh->arrayDirtyMap[RenderDataArray::VERTEX_DATA_ARRAY] = true;				
-}
-
-
-void ScreenLine::Render() {
-	Renderer *renderer = CoreServices::getInstance()->getRenderer();
-	renderer->setLineSize(lineWidth);
-	if(lineSmooth) {
-		renderer->setLineSmooth(true);
-	}
-	
-	renderer->setTexture(texture);
-	if(mesh->useVertexColors) {
-		renderer->pushDataArrayForMesh(mesh, RenderDataArray::COLOR_DATA_ARRAY);
-	}
-	renderer->pushDataArrayForMesh(mesh, RenderDataArray::VERTEX_DATA_ARRAY);
-	renderer->pushDataArrayForMesh(mesh, RenderDataArray::TEXCOORD_DATA_ARRAY);	
-	renderer->drawArrays(mesh->getMeshType());
-	
-	renderer->setLineSmooth(false);	
-}

+ 0 - 87
Core/Contents/Source/PolyScreenManager.cpp

@@ -1,87 +0,0 @@
-/*
- Copyright (C) 2011 by Ivan Safrin
- 
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
- 
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
- 
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
-*/
-
-#include "PolyScreenManager.h"
-#include "PolyCoreServices.h"
-#include "PolyRenderer.h"
-#include "PolyScreen.h"
-
-using namespace Polycode;
-
-ScreenManager::ScreenManager() : EventDispatcher() {
-	drawScreensFirst = false;
-}
-
-ScreenManager::~ScreenManager() {
-
-}
-
-void ScreenManager::removeScreen(Screen *screen) {
-	for(int i=0;i<screens.size();i++) {
-		if(screens[i] == screen) {
-			screens.erase(screens.begin()+i);
-		}
-	}
-}
-
-void ScreenManager::addScreen(Screen *screen) {
-	screen->setRenderer(CoreServices::getInstance()->getRenderer());
-	screens.push_back(screen);
-}
-
-void ScreenManager::handleEvent(Event *event) {
-//	if(event->getDispatcher() == CoreServices::getInstance()->getCore()->getInput()) {
-		InputEvent *inputEvent = (InputEvent*)event;
-		for(int i=0;i<screens.size();i++) {
-			screens[i]->handleInputEvent(inputEvent);
-		}
-//	}
-}
-
-void ScreenManager::Render() {
-	Renderer *renderer = CoreServices::getInstance()->getRenderer();
-	for(int i=0;i<screens.size();i++) {
-		if(screens[i]->enabled) {
-			if(!screens[i]->usesNormalizedCoordinates()) {
-				renderer->setOrthoMode(renderer->getXRes(), renderer->getYRes(), false);
-			} else {
-				Number yCoordinateSize = screens[i]->getYCoordinateSize();
-				Number ratio = ((Number)renderer->getXRes())/((Number)renderer->getYRes());
-				renderer->setOrthoMode(ratio*yCoordinateSize, yCoordinateSize, true);				
-			}
-		
-			if(screens[i]->hasFilterShader()) {
-				screens[i]->drawFilter();
-			} else {
-				screens[i]->Render();
-			}
-		}
-	}
-}
-
-void ScreenManager::Update() {
-	for(int i=0;i<screens.size();i++) {
-		if(screens[i]->enabled) {
-			screens[i]->Update();
-		}
-	}
-}

+ 0 - 175
Core/Contents/Source/PolyScreenMesh.cpp

@@ -1,175 +0,0 @@
-/*
- Copyright (C) 2011 by Ivan Safrin
- 
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
- 
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
- 
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
-*/
-
-#include "PolyScreenMesh.h"
-#include "PolyCoreServices.h"
-#include "PolyMaterialManager.h"
-#include "PolyResourceManager.h"
-#include "PolyMesh.h"
-#include "PolyRenderer.h"
-
-using namespace Polycode;
-
-ScreenMesh::ScreenMesh(Mesh *mesh) : ScreenEntity(), material(NULL), texture(NULL) {
-	this->mesh = mesh;
-	lineSmooth = false;
-	lineWidth = 1.0;
-	ownsMesh = true;
-	updateHitBox();
-}
-
-ScreenMesh::ScreenMesh(const String& fileName) : ScreenEntity(), material(NULL), texture(NULL) {
-	mesh = new Mesh(fileName);
-	lineSmooth = false;
-	lineWidth = 1.0;
-	
-}
-
-ScreenMesh::ScreenMesh(int meshType) : ScreenEntity(), material(NULL), texture(NULL) {
-	mesh = new Mesh(meshType);
-	lineSmooth = false;
-	lineWidth = 1.0;
-	
-}
-
-ScreenMesh *ScreenMesh::ScreenMeshWithMesh(Mesh *mesh) {
-	return new ScreenMesh(mesh);
-}
-
-ScreenMesh *ScreenMesh::ScreenMeshWithType(int meshType) {
-	return new ScreenMesh(meshType);
-}
-
-ScreenMesh::~ScreenMesh() {
-	if(ownsMesh) {
-		delete mesh;
-	}
-}
-
-Mesh *ScreenMesh::getMesh() const {
-	return mesh;
-}
-
-Texture *ScreenMesh::getTexture() const {
-	return texture;
-}
-
-void ScreenMesh::setTexture(Texture *texture) {
-	this->texture = texture;
-}
-
-void ScreenMesh::loadTexture(const String& fileName) {
-	MaterialManager *materialManager = CoreServices::getInstance()->getMaterialManager();
-	texture = materialManager->createTextureFromFile(fileName, materialManager->clampDefault, materialManager->mipmapsDefault);
-}
-
-void ScreenMesh::loadTexture(Image *image) {
-	MaterialManager *materialManager = CoreServices::getInstance()->getMaterialManager();
-	texture = materialManager->createTextureFromImage(image, materialManager->clampDefault, materialManager->mipmapsDefault);
-}
-
-void ScreenMesh::clearMaterial() {
-	if(localShaderOptions)
-		delete localShaderOptions;
-	localShaderOptions = NULL;
-	this->material = NULL;
-}
-
-void ScreenMesh::setMaterial(Material *material) {
-
-	if(this->material)
-		clearMaterial();
-	
-	if(!material)
-		return;
-		
-	if(material->getNumShaders() == 0)
-			return;
-		
-	this->material = material;
-	localShaderOptions = material->getShader(0)->createBinding();
-	if(texture) {
-		localShaderOptions->clearTexture("diffuse");
-		localShaderOptions->addTexture("diffuse", texture);
-	}
-	
-}
-
-Material *ScreenMesh::getMaterial() {
-	return material;
-}
-
-ShaderBinding *ScreenMesh::getLocalShaderOptions() {
-	return localShaderOptions;
-}
-
-void ScreenMesh::setMaterialByName(const String& materialName) {
-	Material *material =  (Material*)CoreServices::getInstance()->getResourceManager()->getResource(Resource::RESOURCE_MATERIAL, materialName);
-	if(!material)
-		return;
-	setMaterial(material);
-}
-
-void ScreenMesh::Render() {	
-	Renderer *renderer = CoreServices::getInstance()->getRenderer();
-	
-	renderer->clearShader();
-	
-	renderer->setLineSize(lineWidth);
-	renderer->setLineSmooth(lineSmooth);
-	
-	if(material) {
-		renderer->applyMaterial(material, localShaderOptions,0);
-	} else {
-		renderer->setTexture(texture);
-	}
-	
-	if(mesh->useVertexColors) {
-		renderer->pushDataArrayForMesh(mesh, RenderDataArray::COLOR_DATA_ARRAY);
-	}
-	renderer->pushDataArrayForMesh(mesh, RenderDataArray::VERTEX_DATA_ARRAY);
-	renderer->pushDataArrayForMesh(mesh, RenderDataArray::TEXCOORD_DATA_ARRAY);	
-	renderer->drawArrays(mesh->getMeshType());
-}
-
-void ScreenMesh::updateHitBox() {
-	Number xmin, ymin, xmax, ymax;
-	bool any = false;
-	for(int c = 0; c < mesh->getPolygonCount(); c++) {
-		Polygon *poly = mesh->getPolygon(c);
-		for(int d = 0; d < poly->getVertexCount(); d++) {
-			Vertex *v = poly->getVertex(d);
-			if (any) {
-				xmin = MIN(v->x, xmin);
-				ymin = MIN(v->y, ymin);
-				xmax = MAX(v->x, xmax);
-				ymax = MAX(v->y, ymax);
-			} else {
-				xmin = v->x; xmax = v->x;
-				ymin = v->y; ymax = v->y;
-				any = true;
-			}
-		}
-	}
-	
-	setHitbox(xmax-xmin, ymax-ymin, xmin, ymin);
-}

+ 0 - 246
Core/Contents/Source/PolyScreenShape.cpp

@@ -1,246 +0,0 @@
-/*
- Copyright (C) 2011 by Ivan Safrin
- 
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
- 
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
- 
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
-*/
-
-#include "PolyScreenShape.h"
-#include "PolyCoreServices.h"
-#include "PolyMesh.h"
-#include "PolyPolygon.h"
-#include "PolyRenderer.h"
-
-using namespace Polycode;
-
-
-ScreenShape::ScreenShape(int shapeType, Number option1, Number option2, Number option3, Number option4) : ScreenMesh(Mesh::QUAD_MESH) {
-	strokeWidth = 1.0f;
-	this->shapeType = shapeType;
-	width = option1;
-	height = option2;
-	
-	setHitbox(width, height);
-
-	this->option1 = option1;
-	this->option2 = option2;
-	this->option3 = option3;
-	this->option4 = option4;
-	lineSmooth = false;
-		
-	buildShapeMesh();
-	
-	setPositionMode(POSITION_CENTER);
-	strokeEnabled = false;
-}
-
-void ScreenShape::operator=(const ScreenShape& copy) {
-	strokeWidth = copy.strokeWidth;
-	shapeType = copy.getShapeType();
-	
-	width = copy.getWidth();
-	height = copy.getHeight();
-	
-	setHitbox(width, height);
-
-	this->option3 = copy.option3;
-	this->option4 = copy.option4;
-	lineSmooth = copy.lineSmooth;
-		
-	buildShapeMesh();
-	
-	strokeColor = copy.strokeColor;
-	
-	setPositionMode(POSITION_CENTER);
-	strokeEnabled = copy.strokeEnabled;	
-
-}
-
-Entity *ScreenShape::Clone(bool deepClone, bool ignoreEditorOnly) const {
-	ScreenShape *newEntity = new ScreenShape(ScreenShape::SHAPE_RECT, 1,1);
-	applyClone(newEntity, deepClone, ignoreEditorOnly);
-	return newEntity;
-
-}
-
-void ScreenShape::applyClone(Entity *clone, bool deepClone, bool ignoreEditorOnly) const {
-	ScreenEntity::applyClone(clone, deepClone, ignoreEditorOnly);
-	ScreenShape *_clone = (ScreenShape*) clone;
-	*_clone = *this;
-}
-
-void ScreenShape::buildShapeMesh() {
-
-	mesh->clearMesh();
-	
-	switch(shapeType) {
-		case SHAPE_RECT: {
-			mesh->setMeshType(Mesh::QUAD_MESH);
-			
-			Number whalf = width/2.0f;
-			Number hhalf = height/2.0f;
-			
-			if(snapToPixels) {
-				whalf = floor(whalf);
-				hhalf = floor(hhalf);				
-			}
-		
-			Polygon *poly = new Polygon();
-			
-			poly->addVertex(-whalf,-hhalf,0,0,1);
-			poly->addVertex(-whalf+width,-hhalf,0, 1, 1);
-			poly->addVertex(-whalf+width,-hhalf+height,0, 1, 0);
-			poly->addVertex(-whalf,-hhalf+height,0,0,0);
-						
-			mesh->addPolygon(poly);
-			}
-		break;
-		case SHAPE_CIRCLE: {
-			mesh->setMeshType(Mesh::TRIFAN_MESH);
-			Polygon *poly = new Polygon();
-			int step;
-			if(option3 > 0)
-				step = ceil(360/option3);
-			else
-				step = 1;
-			
-			poly->addVertex(cosf(0)*(width/2),sinf(0)*(height/2), 0, (cosf(0)*0.5) + 0.5,(sinf(0) * 0.5)+ 0.5);
-			
-			for (int i=0; i < 361; i+= step) {
-				Number degInRad = i*TORADIANS;
-				poly->addVertex(cos(degInRad)*(width/2),sin(degInRad)*(height/2), 0, (cos(degInRad) * 0.5)+ 0.5 , 1.0- ((sin(degInRad) * 0.5)+ 0.5));
-			}
-			mesh->addPolygon(poly);
-			}
-		break;
-		default:
-		break;
-	}
-
-	mesh->arrayDirtyMap[RenderDataArray::VERTEX_DATA_ARRAY] = true;	
-}
-
-int ScreenShape::getShapeType() const {
-	return shapeType;
-}
-
-void ScreenShape::setShapeType(unsigned int type) {
-	shapeType = type;
-	buildShapeMesh();
-}
-
-void ScreenShape::setShapeSize(Number newWidth, Number newHeight) {
-
-	setWidth(newWidth);
-	setHeight(newHeight);
-	
-
-	if(shapeType == SHAPE_RECT) {
-			Number whalf = floor(width/2.0f);
-			Number hhalf = floor(height/2.0f);
-			Polygon *polygon;
-			Vertex *vertex;
-
-			polygon = mesh->getPolygon(0);	
-			vertex = polygon->getVertex(0);
-			vertex->set(-whalf,-hhalf,0);			
-			vertex = polygon->getVertex(1);
-			vertex->set(-whalf+width,-hhalf,0);			
-			vertex = polygon->getVertex(2);
-			vertex->set(-whalf+width,-hhalf+height,0);			
-			vertex = polygon->getVertex(3);	
-			vertex->set(-whalf,-hhalf+height,0);				
-			mesh->arrayDirtyMap[RenderDataArray::VERTEX_DATA_ARRAY] = true;	
-	} else {	
-		buildShapeMesh();
-	}
-		
-	rebuildTransformMatrix();
-	matrixDirty = true;
-}
-
-void ScreenShape::setGradient(Number r1, Number g1, Number b1, Number a1, Number r2, Number g2, Number b2, Number a2) {
-
-	mesh->useVertexColors = true;
-	for(int i=0; i < mesh->getPolygon(0)->getVertexCount(); i++) {
-		mesh->getPolygon(0)->getVertex(i)->useVertexColor = true;
-	}
-	
-	switch(shapeType) {
-		case SHAPE_RECT:
-				mesh->getPolygon(0)->getVertex(0)->vertexColor.setColor(r1,g1,b1,a1);
-				mesh->getPolygon(0)->getVertex(1)->vertexColor.setColor(r1,g1,b1,a1);
-				mesh->getPolygon(0)->getVertex(2)->vertexColor.setColor(r2,g2,b2,a2);
-				mesh->getPolygon(0)->getVertex(3)->vertexColor.setColor(r2,g2,b2,a2);
-		break;
-		case SHAPE_CIRCLE:	
-			mesh->getPolygon(0)->getVertex(0)->vertexColor.setColor(r1,g1,b1,a1);
-			for(int i=1; i < mesh->getPolygon(0)->getVertexCount(); i++) {
-				mesh->getPolygon(0)->getVertex(i)->vertexColor.setColor(r2,g2,b2,a2);
-			}
-		break;
-	}
-}
-
-void ScreenShape::clearGradient() {
-	for(int i=0; i < mesh->getPolygon(0)->getVertexCount(); i++) {
-		mesh->getPolygon(0)->getVertex(i)->useVertexColor = false;
-	}
-	mesh->useVertexColors = false;
-}
-
-void ScreenShape::setStrokeWidth(Number width) {
-	strokeWidth = width;
-}
-
-void ScreenShape::setStrokeColor(Number r, Number g, Number b, Number a) {
-	strokeColor.setColor(r,g,b,a);
-}
-
-void ScreenShape::Render() {
-	Renderer *renderer = CoreServices::getInstance()->getRenderer();
-
-	ScreenMesh::Render();
-
-	if(strokeEnabled) {
-		renderer->setTexture(NULL);
-		if(lineSmooth) {
-				renderer->setLineSmooth(true);
-		}
-		
-		renderer->setLineSize(strokeWidth);
-		renderer->setVertexColor(strokeColor.r,strokeColor.g,strokeColor.b,strokeColor.a);
-		int rmode = renderer->getRenderMode();
-		renderer->setRenderMode(Renderer::RENDER_MODE_WIREFRAME);
-
-//		renderer->pushDataArrayForMesh(mesh, RenderDataArray::COLOR_DATA_ARRAY);
-		renderer->pushDataArrayForMesh(mesh, RenderDataArray::VERTEX_DATA_ARRAY);
-//		renderer->pushDataArrayForMesh(mesh, RenderDataArray::TEXCOORD_DATA_ARRAY);	
-		renderer->drawArrays(mesh->getMeshType());		
-		
-		renderer->setRenderMode(rmode);
-		renderer->setLineSize(1.0f);
-		renderer->setLineSmooth(false);
-	}
-
-}
-
-
-ScreenShape::~ScreenShape() {
-
-}

+ 0 - 88
Core/Contents/Source/PolyScreenSound.cpp

@@ -1,88 +0,0 @@
-/*
-Copyright (C) 2011 by Ivan Safrin
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#include "PolyScreenSound.h"
-#include "PolySound.h"
-#include "PolyCoreServices.h"
-#include "PolySoundManager.h"
-
-using namespace Polycode;
-
-ScreenSoundListener::ScreenSoundListener() : ScreenEntity() {
-
-}
-ScreenSoundListener::~ScreenSoundListener() {
-
-}
-
-void ScreenSoundListener::Update() {
-	Matrix4 finalMatrix = getConcatenatedMatrix();
-	CoreServices::getInstance()->getSoundManager()->setListenerPosition(finalMatrix.getPosition());
-
-	Vector3 upVector = Vector3(0.0, 1.0, 0.0);
-		
-	Vector3 direction;
-	direction.x = 0;		
-	direction.y = 0;
-	direction.z = -1;
-//	direction = finalMatrix.rotateVector(direction);	
-
-	CoreServices::getInstance()->getSoundManager()->setListenerOrientation(direction, upVector);
-
-}
-
-Entity *ScreenSound::Clone(bool deepClone, bool ignoreEditorOnly) const {
-	ScreenSound *newSound = new ScreenSound(sound->getFileName(), sound->getReferenceDistance(), sound->getMaxDistance());
-	applyClone(newSound, deepClone, ignoreEditorOnly);
-	return newSound;
-}
-
-void ScreenSound::applyClone(Entity *clone, bool deepClone, bool ignoreEditorOnly) const {
-	ScreenEntity::applyClone(clone, deepClone, ignoreEditorOnly);
-}
-
-ScreenSound::ScreenSound(const String& fileName, Number referenceDistance, Number maxDistance) : ScreenEntity() {
-	sound = new Sound(fileName);
-	sound->setIsPositional(true);
-	sound->setPositionalProperties(referenceDistance, maxDistance);	
-}
-
-ScreenSound::~ScreenSound() {
-	delete sound;
-}
-
-void ScreenSound::Update() {
-	Matrix4 finalMatrix = getConcatenatedMatrix();
-	sound->setSoundPosition(finalMatrix.getPosition());
-	
-	Vector3 direction;
-	direction.x = 0;		
-	direction.y = 0;
-	direction.z = -1;
-//	direction = finalMatrix.rotateVector(direction);
-	sound->setSoundDirection(direction);
-	
-}
-
-Sound *ScreenSound::getSound() const {
-	return sound;
-}

+ 0 - 388
Core/Contents/Source/PolyScreenSprite.cpp

@@ -1,388 +0,0 @@
-/*
- Copyright (C) 2011 by Ivan Safrin
- 
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
- 
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
- 
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
-*/
-
-#include "PolyScreenSprite.h"
-#include "PolyCore.h"
-#include "PolyCoreServices.h"
-#include "PolyMesh.h"
-#include "PolyPolygon.h"
-#include "PolyTexture.h"
-
-using std::vector;
-using namespace Polycode;
-
-ScreenSpriteResourceEntry::ScreenSpriteResourceEntry(ScreenSprite *sprite)  : Resource(Resource::RESOURCE_SCREEN_ENTITY_INSTANCE) {
-	this->sprite = sprite;
-}
-
-ScreenSpriteResourceEntry::~ScreenSpriteResourceEntry() {
-
-}
-
-ScreenSprite *ScreenSpriteResourceEntry::getSprite() {
-	return sprite;
-}
-
-void ScreenSpriteResourceEntry::reloadResource() {
-	sprite->reloadSprite();
-	Resource::reloadResource();
-}
-
-ScreenSprite* ScreenSprite::ScreenSpriteFromImageFile(const String& fileName, Number spriteWidth, Number spriteHeight) {
-	return new ScreenSprite(fileName, spriteWidth, spriteHeight);
-}
-
-ScreenSprite::ScreenSprite(const String& fileName) : ScreenShape(ScreenShape::SHAPE_RECT, 1, 1) {
-
-	currentFrame = 0;
-	currentAnimation = NULL;	
-	paused = false;
-
-	resourceEntry = new ScreenSpriteResourceEntry(this);		
-	loadFromFile(fileName);
-	resourceEntry->setResourceName(fileName);
-	resourceEntry->setResourcePath(fileName);	
-}
-
-Entity *ScreenSprite::Clone(bool deepClone, bool ignoreEditorOnly) const {
-	ScreenSprite *newSprite = new ScreenSprite(getTexture()->getResourcePath(), spriteWidth, spriteHeight);
-	for(int i=0; i < animations.size(); i++) {
-		newSprite->addAnimation(animations[i]->name, animations[i]->frames, animations[i]->speed);
-	}
-	if(currentAnimation) {
-		newSprite->playAnimation(currentAnimation->name, currentFrame, playingOnce);
-	}
-	applyClone(newSprite, deepClone, ignoreEditorOnly);
-	return newSprite;
-}
-
-void ScreenSprite::applyClone(Entity *clone, bool deepClone, bool ignoreEditorOnly) const {
-	ScreenShape::applyClone(clone, deepClone, ignoreEditorOnly);
-	
-}
-
-bool ScreenSprite::loadFromFile(const String& fileName) {
-	Object loadObject;
-	
-	animations.clear();
-	
-	if(!loadObject.loadFromXML(fileName)) {
-		return false;
-	}
-	
-	this->fileName = fileName;
-	
-	ObjectEntry *image = loadObject.root["image"];
-	if(image) {
-		ObjectEntry *frameWidth = (*image)["frameWidth"];
-		ObjectEntry *frameHeight = (*image)["frameHeight"];	
-		ObjectEntry *fileName = (*image)["fileName"];
-		
-		if(fileName) {
-			loadTexture(fileName->stringVal);
-		}
-
-		if(frameWidth && frameHeight) {
-			setShapeSize(frameWidth->NumberVal, frameHeight->NumberVal);
-			setSpriteSize(frameWidth->NumberVal, frameHeight->NumberVal);
-		}
-	}
-	
-	ObjectEntry *animationsEntry = loadObject.root["animations"];
-	
-	if(animationsEntry) {
-		for(int i=0; i < animationsEntry->length; i++) {
-			ObjectEntry *animation = (*animationsEntry)[i];
-			if(animation) {
-				ObjectEntry *name = (*animation)["name"];
-				ObjectEntry *frames = (*animation)["frames"];	
-				ObjectEntry *speed = (*animation)["speed"];
-				
-				if(name && frames && speed) {
-					addAnimation(name->stringVal, frames->stringVal, speed->NumberVal);
-				} else {
-					printf("Error parsing animation node\n");
-				}
-			}
-		}
-	}
-	
-	recalculateSpriteDimensions();
-
-	return true;
-}
-
-unsigned int ScreenSprite::getNumAnimations() {
-	return animations.size();
-}
-
-SpriteAnimation *ScreenSprite::getAnimationAtIndex(unsigned int index) {
-	if(index < animations.size()) {
-		return animations[index];
-	} else {
-		return NULL;
-	}
-}
-
-void ScreenSprite::reloadSprite() {
-	
-	String _animName = "";
-	int _currentFrame;
-	bool _playingOnce;
-	
-	if(currentAnimation) {
-		_animName = currentAnimation->name;
-		_currentFrame = currentFrame;
-		_playingOnce = playingOnce;
-	}
-	loadFromFile(fileName);
-	
-	if(_animName != "") {
-		playAnimation(_animName, _currentFrame, _playingOnce);
-	}
-}
-
-ScreenSpriteResourceEntry *ScreenSprite::getResourceEntry() {
-	return resourceEntry;
-}
-
-ScreenSprite::ScreenSprite(const String& fileName, Number spriteWidth, Number spriteHeight) : ScreenShape(ScreenShape::SHAPE_RECT, spriteWidth, spriteHeight) {
-	this->spriteWidth = spriteWidth;
-	this->spriteHeight = spriteHeight;	
-	loadTexture(fileName);
-		
-	recalculateSpriteDimensions();
-	currentFrame = 0;
-	currentAnimation = NULL;	
-	paused = false;
-}
-
-ScreenSprite::~ScreenSprite() {
-	
-}
-
-void ScreenSprite::recalculateSpriteDimensions() {
-	if(!texture)
-		return;
-		
-	spriteUVWidth = 1.0f / ((Number) texture->getWidth() / spriteWidth);
-	spriteUVHeight = 1.0f / ((Number) texture->getHeight() / spriteHeight);
-	
-	for(int i =0 ; i < animations.size(); i++) {
-		animations[i]->numFramesX = texture->getWidth() / spriteWidth;	
-		if(animations[i]->numFramesX < 1) {
-			animations[i]->numFramesX = 1;
-		}
-		animations[i]->numFramesY = texture->getHeight() / spriteHeight;
-		if(animations[i]->numFramesY < 1) {
-			animations[i]->numFramesY = 1;
-		}		
-		animations[i]->spriteUVWidth = spriteUVWidth;
-		animations[i]->spriteUVHeight = spriteUVHeight;	
-		animations[i]->setOffsetsFromFrameString(animations[i]->frames);
-	}
-}
-
-Vector2 ScreenSprite::getSpriteSize() {
-	return Vector2(spriteWidth, spriteHeight);
-}
-
-String ScreenSprite::getFileName() const {
-	return fileName;
-}
-
-void ScreenSprite::setSpriteSize(const Number spriteWidth, const Number spriteHeight) {
-	this->spriteWidth = spriteWidth;
-	this->spriteHeight = spriteHeight;	
-	
-	recalculateSpriteDimensions();	
-}
-
-SpriteAnimation *ScreenSprite::getCurrentAnimation() {
-	return currentAnimation;
-}
-
-unsigned int ScreenSprite::getCurrentAnimationFrame() { 
-   return currentFrame; 
-}
-
-bool ScreenSprite::isCurrentAnimationFinished() {
-    if(currentAnimation) {
-        if(currentFrame >= currentAnimation->numFrames)
-            return true;
-    }
-    return false;
-}
-
-void SpriteAnimation::setOffsetsFromFrameString(const String& frames) {
-	framesOffsets.clear();
-	vector<String> frameNumbers = frames.split(",");
-	
-	int frameNumber;
-	int frameX;
-	int frameY;
-	
-	numFrames = 0;
-	
-	for(int i=0; i < frameNumbers.size(); i++) {
-		if(frameNumbers[i].find_first_of("-") != -1) {
-			vector<String> _frameNumbers = frameNumbers[i].split("-");
-			if(_frameNumbers.size() > 1) {
-				int frameNumberStart = atoi(_frameNumbers[0].c_str());
-				int frameNumberEnd = atoi(_frameNumbers[1].c_str());
-				int dir = 1;
-				if(frameNumberEnd < frameNumberStart) {
-					dir = -1;
-				}				
-				for(int j=frameNumberStart; j != frameNumberEnd + dir; j += dir) {
-					frameX = j % numFramesX;
-					frameY = j/numFramesX;
-					framesOffsets.push_back(Vector2(spriteUVWidth * frameX, spriteUVHeight * frameY));
-					numFrames++;
-				}
-			}
-		} else if(frameNumbers[i].find_first_of("x") != -1) {
-			vector<String> _frameNumbers = frameNumbers[i].split("x");
-			if(_frameNumbers.size() > 1) {
-				int _frameNumber = atoi(_frameNumbers[0].c_str());
-				int frameNumberCount = atoi(_frameNumbers[1].c_str());				
-				for(int j=0; j < frameNumberCount; j++) {
-					frameX = _frameNumber % numFramesX;
-					frameY = _frameNumber/numFramesX;
-					framesOffsets.push_back(Vector2(spriteUVWidth * frameX, spriteUVHeight * frameY));
-					numFrames++;					
-				}
-			}				
-		} else {	
-			frameNumber = atoi(frameNumbers[i].c_str());
-			frameX = frameNumber % numFramesX;
-			frameY = frameNumber/numFramesX;
-			framesOffsets.push_back(Vector2(spriteUVWidth * frameX, spriteUVHeight * frameY));
-			numFrames++;			
-		}
-	}
-	
-	this->frames = frames;
-
-}
-
-SpriteAnimation *ScreenSprite::addAnimation(const String& name, const String& frames, Number speed) {
-	SpriteAnimation *newAnimation = new SpriteAnimation();	
-	
-	
-	newAnimation->numFramesX = texture->getWidth() / spriteWidth;	
-	if(newAnimation->numFramesX < 1) {
-		newAnimation->numFramesX = 1;
-	}
-	newAnimation->numFramesY = texture->getHeight() / spriteHeight;
-	if(newAnimation->numFramesY < 1) {
-		newAnimation->numFramesY = 1;
-	}	
-	newAnimation->spriteUVWidth = spriteUVWidth;
-	newAnimation->spriteUVHeight = spriteUVHeight;
-	
-	newAnimation->setOffsetsFromFrameString(frames);
-			
-	newAnimation->speed = speed;
-	newAnimation->name = name;
-	animations.push_back(newAnimation);
-	return newAnimation;
-}
-
-void ScreenSprite::playAnimation(const String& name, int startFrame, bool once) {
-	paused = false;
-	for(int i=0; i < animations.size(); i++) {
-		if(animations[i]->name == name) {
-			if(currentAnimation == animations[i] && !playingOnce && !once)
-				return;
-			currentFrame = 0;			
-			currentAnimation = animations[i];
-			if(startFrame == -1) {
-				currentFrame = rand() % currentAnimation->numFrames;
-			} else {
-				if(startFrame < currentAnimation->numFrames) {
-					currentFrame = startFrame;
-				}
-			}
-			playingOnce = once;
-			lastTick = 0;
-		}
-	}
-}
-
-void ScreenSprite::Pause(bool val) {
-	paused = val;
-}
-
-void ScreenSprite::showFrame(unsigned int frameIndex) {
-	if(!currentAnimation)
-		return;
-
-	if(frameIndex < currentAnimation->numFrames) {
-		currentFrame = frameIndex;
-		updateSprite();
-	}
-}
-
-void ScreenSprite::Update() {
-	if(!currentAnimation)
-		return;
-	
-	Number newTick = CoreServices::getInstance()->getCore()->getTicksFloat();
-	
-	Number elapsed = newTick - lastTick;
-	
-	if(paused)
-		return;
-	
-	if(elapsed > currentAnimation->speed) {
-	currentFrame++;
-	if(currentFrame >= currentAnimation->numFrames) {
-		if(playingOnce) {
-			dispatchEvent(new Event(), Event::COMPLETE_EVENT);
-			return;			
-		} else {
-			currentFrame = 0;
-		}
-	}
-	
-	updateSprite();
-			
-	lastTick = newTick;
-		
-	}
-}
-
-void ScreenSprite::updateSprite() {
-	Number xOffset = currentAnimation->framesOffsets[currentFrame].x;
-	Number yOffset = 1.0f - currentAnimation->framesOffsets[currentFrame].y - spriteUVHeight;
-	
-	Polygon *imagePolygon = mesh->getPolygon(0);
-		
-	imagePolygon->getVertex(0)->setTexCoord(xOffset, yOffset+spriteUVHeight);	
-	imagePolygon->getVertex(1)->setTexCoord(xOffset+spriteUVWidth, yOffset+spriteUVHeight);
-	imagePolygon->getVertex(2)->setTexCoord(xOffset+spriteUVWidth, yOffset);
-	imagePolygon->getVertex(3)->setTexCoord(xOffset, yOffset);	
-		
-	mesh->arrayDirtyMap[RenderDataArray::TEXCOORD_DATA_ARRAY] = true;
-
-}

+ 4 - 4
Core/Contents/Source/PolySkeleton.cpp

@@ -35,7 +35,7 @@ Skeleton *Skeleton::BlankSkeleton() {
 	return new Skeleton();
 	return new Skeleton();
 }
 }
 
 
-Skeleton::Skeleton(const String& fileName) : SceneEntity() {
+Skeleton::Skeleton(const String& fileName) : Entity() {
 	loadSkeleton(fileName);
 	loadSkeleton(fileName);
 	currentAnimation = NULL;
 	currentAnimation = NULL;
 }
 }
@@ -130,7 +130,7 @@ void Skeleton::loadSkeleton(const String& fileName) {
 		return;
 		return;
 	}
 	}
 	
 	
-	bonesEntity	= new SceneEntity();
+	bonesEntity	= new Entity();
 	bonesEntity->visible = false;
 	bonesEntity->visible = false;
 	addChild(bonesEntity);
 	addChild(bonesEntity);
 	
 	
@@ -187,7 +187,7 @@ void Skeleton::loadSkeleton(const String& fileName) {
 	}
 	}
 
 
 	Bone *parentBone;
 	Bone *parentBone;
-//	SceneEntity *bProxy;
+//	Entity *bProxy;
 	
 	
 	for(int i=0; i < bones.size(); i++) {
 	for(int i=0; i < bones.size(); i++) {
 		if(bones[i]->parentBoneId != -1) {
 		if(bones[i]->parentBoneId != -1) {
@@ -202,7 +202,7 @@ void Skeleton::loadSkeleton(const String& fileName) {
 			bonesEntity->addEntity(connector);				
 			bonesEntity->addEntity(connector);				
 			connector->setColor(((Number)(rand() % RAND_MAX)/(Number)RAND_MAX),((Number)(rand() % RAND_MAX)/(Number)RAND_MAX),((Number)(rand() % RAND_MAX)/(Number)RAND_MAX),1.0f);
 			connector->setColor(((Number)(rand() % RAND_MAX)/(Number)RAND_MAX),((Number)(rand() % RAND_MAX)/(Number)RAND_MAX),((Number)(rand() % RAND_MAX)/(Number)RAND_MAX),1.0f);
 		} else {
 		} else {
-//			bProxy = new SceneEntity();
+//			bProxy = new Entity();
 //			addEntity(bProxy);			
 //			addEntity(bProxy);			
 //			bProxy->addEntity(bones[i]);
 //			bProxy->addEntity(bones[i]);
 			bonesEntity->addChild(bones[i]);
 			bonesEntity->addChild(bones[i]);

+ 53 - 53
Modules/Contents/2DPhysics/Include/PolyPhysicsScreen.h

@@ -23,7 +23,7 @@ THE SOFTWARE.
 #pragma once
 #pragma once
 #include "PolyGlobals.h"
 #include "PolyGlobals.h"
 #include "PolyEvent.h"
 #include "PolyEvent.h"
-#include "PolyScreen.h"
+#include "PolyScene.h"
 #include "PolyVector2.h"
 #include "PolyVector2.h"
 #include "Box2D/Box2D.h"
 #include "Box2D/Box2D.h"
 #include <vector>
 #include <vector>
@@ -32,37 +32,37 @@ THE SOFTWARE.
 
 
 namespace Polycode {
 namespace Polycode {
 
 
-class ScreenEntity;
-class PhysicsScreenEntity;
+class Entity;
+class PhysicsScene2DEntity;
 class Timer;
 class Timer;
 
 
 /**
 /**
 * Event sent out by the PhysicsScreen class when collisions begin and end.
 * Event sent out by the PhysicsScreen class when collisions begin and end.
 */	
 */	
-class _PolyExport PhysicsScreenEvent : public Event {
+class _PolyExport PhysicsScene2DEvent : public Event {
 	public:	
 	public:	
-		PhysicsScreenEvent();
-		~PhysicsScreenEvent();
+		PhysicsScene2DEvent();
+		~PhysicsScene2DEvent();
 		
 		
 		/**
 		/**
 		* First colliding entity.
 		* First colliding entity.
 		*/
 		*/
-		ScreenEntity *entity1;	
+		Entity *entity1;	
 		
 		
 		/**
 		/**
 		* Second colliding entity.
 		* Second colliding entity.
 		*/		
 		*/		
-		ScreenEntity *entity2;	
+		Entity *entity2;	
 
 
 		/**
 		/**
 		* First colliding entity.
 		* First colliding entity.
 		*/
 		*/
-		ScreenEntity *getFirstEntity();	
+		Entity *getFirstEntity();	
 		
 		
 		/**
 		/**
 		* Second colliding entity.
 		* Second colliding entity.
 		*/		
 		*/		
-		ScreenEntity *getSecondEntity();	
+		Entity *getSecondEntity();	
 
 
 	
 	
 		/**
 		/**
@@ -152,28 +152,28 @@ public:
 /**
 /**
 * A 2D Physics enabled screen. A PhysicsScreen acts like a normal screen, except that entities added to it with addPhysicsChild have physics automatically simulated. You can also use it to check collisions using addCollisionChild.
 * A 2D Physics enabled screen. A PhysicsScreen acts like a normal screen, except that entities added to it with addPhysicsChild have physics automatically simulated. You can also use it to check collisions using addCollisionChild.
 */	
 */	
-class _PolyExport PhysicsScreen : public Screen, b2ContactListener {
+class _PolyExport PhysicsScene2D : public Scene, b2ContactListener {
 
 
 public:
 public:
 
 
 	/**
 	/**
 	* Creates a new physics screen.
 	* Creates a new physics screen.
 	*/ 
 	*/ 
-	PhysicsScreen(Number worldScale, Number freq, int velIterations=10, int posIterations=10);
+	PhysicsScene2D(Number worldScale, Number freq, int velIterations=10, int posIterations=10);
 	
 	
 	/**
 	/**
 	* Default constructor.
 	* Default constructor.
 	*/
 	*/
-	PhysicsScreen();
+	PhysicsScene2D();
 	
 	
-	~PhysicsScreen();
+	~PhysicsScene2D();
 	
 	
 	void Update();
 	void Update();
 	
 	
 	/**
 	/**
-	* Adds a ScreenEntity as a physics enabled child. Once an entity is added as a physics child, its transforms are set by the physics engine and you are not able to position it manually. Use addCollisionChild/trackCollisionChild to track collisions of entities that you can position manually.
+	* Adds a Entity as a physics enabled child. Once an entity is added as a physics child, its transforms are set by the physics engine and you are not able to position it manually. Use addCollisionChild/trackCollisionChild to track collisions of entities that you can position manually.
 	* @param newEntity Screen entity to add.
 	* @param newEntity Screen entity to add.
-	* @param entType Physics entity type to add as. Possible values are PhysicsScreenEntity::ENTITY_RECT, PhysicsScreenEntity::ENTITY_CIRCLE and PhysicsScreenEntity::ENTITY_MESH. If the type is ENTITY_MESH, the ScreenEntity passed must be a ScreenMesh!
+	* @param entType Physics entity type to add as. Possible values are PhysicsEntity::ENTITY_RECT, PhysicsEntity::ENTITY_CIRCLE and PhysicsEntity::ENTITY_MESH. If the type is ENTITY_MESH, the Entity passed must be a ScreenMesh!
 	* @param isStatic If this parameter is true, the body is static (doesn't move on its own).
 	* @param isStatic If this parameter is true, the body is static (doesn't move on its own).
 	* @param friction Friction of the physics entity. Friction controls how entities drag along each other.
 	* @param friction Friction of the physics entity. Friction controls how entities drag along each other.
 	* @param density Density of the physics entity. Density controls how heavy the entity is.
 	* @param density Density of the physics entity. Density controls how heavy the entity is.
@@ -183,12 +183,12 @@ public:
     * @param groupIndex is the physiscs shape's collision group. A negative number means objects of that group won't collide with eachother
     * @param groupIndex is the physiscs shape's collision group. A negative number means objects of that group won't collide with eachother
     * @return The physics entity wrapper.
     * @return The physics entity wrapper.
 	*/
 	*/
-	PhysicsScreenEntity *addPhysicsChild(ScreenEntity *newEntity, int entType, bool isStatic, Number friction=0.1, Number density=1, Number restitution = 0, bool isSensor = false, bool fixedRotation = false, int groupIndex = 0);
+	PhysicsScene2DEntity *addPhysicsChild(Entity *newEntity, int entType, bool isStatic, Number friction=0.1, Number density=1, Number restitution = 0, bool isSensor = false, bool fixedRotation = false, int groupIndex = 0);
     
     
 	/**
 	/**
-	* Tracks a ScreenEntity as a physics enabled child. Once an entity is added as a physics child, its transforms are set by the physics engine and you are not able to position it manually. Use addCollisionChild/trackCollisionChild to track collisions of entities that you can position manually.
+	* Tracks a Entity as a physics enabled child. Once an entity is added as a physics child, its transforms are set by the physics engine and you are not able to position it manually. Use addCollisionChild/trackCollisionChild to track collisions of entities that you can position manually.
 	* @param newEntity Screen entity to add.
 	* @param newEntity Screen entity to add.
-	* @param entType Physics entity type to add as. Possible values are PhysicsScreenEntity::ENTITY_RECT, PhysicsScreenEntity::ENTITY_CIRCLE and PhysicsScreenEntity::ENTITY_MESH. If the type is ENTITY_MESH, the ScreenEntity passed must be a ScreenMesh!
+	* @param entType Physics entity type to add as. Possible values are PhysicsEntity::ENTITY_RECT, PhysicsEntity::ENTITY_CIRCLE and PhysicsEntity::ENTITY_MESH. If the type is ENTITY_MESH, the Entity passed must be a ScreenMesh!
 	* @param isStatic If this parameter is true, the body is static (doesn't move on its own).
 	* @param isStatic If this parameter is true, the body is static (doesn't move on its own).
 	* @param friction Friction of the physics entity. Friction controls how entities drag along each other.
 	* @param friction Friction of the physics entity. Friction controls how entities drag along each other.
 	* @param density Density of the physics entity. Density controls how heavy the entity is.
 	* @param density Density of the physics entity. Density controls how heavy the entity is.
@@ -198,39 +198,39 @@ public:
     * @param groupIndex is the physiscs shape's collision group. A negative number means objects of that group won't collide with eachother
     * @param groupIndex is the physiscs shape's collision group. A negative number means objects of that group won't collide with eachother
 	* @return The physics entity wrapper.
 	* @return The physics entity wrapper.
 	*/
 	*/
-	PhysicsScreenEntity *trackPhysicsChild(ScreenEntity *newEntity, int entType, bool isStatic, Number friction=0.1, Number density=1, Number restitution = 0, bool isSensor = false, bool fixedRotation = false, int groupIndex = 0);
+	PhysicsScene2DEntity *trackPhysicsChild(Entity *newEntity, int entType, bool isStatic, Number friction=0.1, Number density=1, Number restitution = 0, bool isSensor = false, bool fixedRotation = false, int groupIndex = 0);
     
     
 	
 	
 	/**
 	/**
 	* Stops physics tracking for this entity but does not remove from screen.
 	* Stops physics tracking for this entity but does not remove from screen.
 	* @param entity Entity to stop tracking for.
 	* @param entity Entity to stop tracking for.
 	*/
 	*/
-	void stopTrackingChild(ScreenEntity *entity);
+	void stopTrackingChild(Entity *entity);
 		
 		
 	/**
 	/**
 	* Removes a physics child from the screen.
 	* Removes a physics child from the screen.
 	* @param entityToRemove Entity to remove from the screen.
 	* @param entityToRemove Entity to remove from the screen.
 	*/
 	*/
-	void removePhysicsChild(ScreenEntity *entityToRemove);
+	void removePhysicsChild(Entity *entityToRemove);
 	
 	
 	
 	
-	void removeChild(ScreenEntity *entityToRemove);
+	void removeChild(Entity *entityToRemove);
 	
 	
 	/**
 	/**
-	* Begins tracking collisions for a ScreenEntity and adds it to the scene.
+	* Begins tracking collisions for a Entity and adds it to the scene.
 	* @param newEntity Entity to track collisions for.
 	* @param newEntity Entity to track collisions for.
-	* @param entType Physics shape of the entity. Possible values are PhysicsScreenEntity::ENTITY_RECT or PhysicsScreenEntity::ENTITY_CIRCLE.
+	* @param entType Physics shape of the entity. Possible values are PhysicsEntity::ENTITY_RECT or PhysicsEntity::ENTITY_CIRCLE.
 	* @param entityToRemove Entity to remove from the screen.
 	* @param entityToRemove Entity to remove from the screen.
 	*/	
 	*/	
-	PhysicsScreenEntity *addCollisionChild(ScreenEntity *newEntity, int entType, int groupIndex = 0, bool sensorOnly = true);
+	PhysicsScene2DEntity *addCollisionChild(Entity *newEntity, int entType, int groupIndex = 0, bool sensorOnly = true);
 	
 	
 	/**
 	/**
-	* Begins tracking collisions for a ScreenEntity.
+	* Begins tracking collisions for a Entity.
 	* @param newEntity Entity to track collisions for.
 	* @param newEntity Entity to track collisions for.
-	* @param entType Physics shape of the entity. Possible values are PhysicsScreenEntity::ENTITY_RECT or PhysicsScreenEntity::ENTITY_CIRCLE.
+	* @param entType Physics shape of the entity. Possible values are PhysicsEntity::ENTITY_RECT or PhysicsEntity::ENTITY_CIRCLE.
 	* @param entityToRemove Entity to remove from the screen.
 	* @param entityToRemove Entity to remove from the screen.
 	*/	
 	*/	
-	PhysicsScreenEntity *trackCollisionChild(ScreenEntity *newEntity, int entType, int groupIndex = 0);	
+	PhysicsScene2DEntity *trackCollisionChild(Entity *newEntity, int entType, int groupIndex = 0);	
 	
 	
 	/**
 	/**
 	* Removes an existing joint.
 	* Removes an existing joint.
@@ -245,7 +245,7 @@ public:
 	* @param collideConnected If set to true, both entities will collide with each other, if false, they will not.
 	* @param collideConnected If set to true, both entities will collide with each other, if false, they will not.
 	* @return Created physics joint.	
 	* @return Created physics joint.	
 	*/ 
 	*/ 
-	PhysicsJoint *createDistanceJoint(ScreenEntity *ent1, ScreenEntity *ent2, bool collideConnected);
+	PhysicsJoint *createDistanceJoint(Entity *ent1, Entity *ent2, bool collideConnected);
 	
 	
 	/**
 	/**
 	* Creates a new prismatic joint. Prismatic joints provide one degree of freedom between two entities. 
 	* Creates a new prismatic joint. Prismatic joints provide one degree of freedom between two entities. 
@@ -263,7 +263,7 @@ public:
 	* @param worldAxis Specifies the relative world axis for the prismatic joint.	
 	* @param worldAxis Specifies the relative world axis for the prismatic joint.	
 	* @return Created physics joint.	
 	* @return Created physics joint.	
 	*/ 	
 	*/ 	
-	PhysicsJoint *createPrismaticJoint(ScreenEntity *ent1, ScreenEntity *ent2, Vector2 worldAxis, Number ax, Number ay, bool collideConnected=false, Number lowerTranslation=0, Number upperTranslation=0, bool enableLimit=false, Number motorSpeed=0, Number motorForce=0, bool motorEnabled=false);
+	PhysicsJoint *createPrismaticJoint(Entity *ent1, Entity *ent2, Vector2 worldAxis, Number ax, Number ay, bool collideConnected=false, Number lowerTranslation=0, Number upperTranslation=0, bool enableLimit=false, Number motorSpeed=0, Number motorForce=0, bool motorEnabled=false);
 
 
 	/**
 	/**
 	* Creates a new revolute joint. Revolute joints enable one entity to rotate around a point on another entity.
 	* Creates a new revolute joint. Revolute joints enable one entity to rotate around a point on another entity.
@@ -279,9 +279,9 @@ public:
 	* @param maxTorque	If motorEnabled is true, specifies the maximum torque applied.		
 	* @param maxTorque	If motorEnabled is true, specifies the maximum torque applied.		
 	* @return Created physics joint.
 	* @return Created physics joint.
 	*/ 		
 	*/ 		
-	PhysicsJoint *createRevoluteJoint(ScreenEntity *ent1, ScreenEntity *ent2, Number ax, Number ay, bool collideConnected=false, bool enableLimit=false, Number lowerLimit=0, Number upperLimit=0, bool motorEnabled=false, Number motorSpeed=0, Number maxTorque=0);
+	PhysicsJoint *createRevoluteJoint(Entity *ent1, Entity *ent2, Number ax, Number ay, bool collideConnected=false, bool enableLimit=false, Number lowerLimit=0, Number upperLimit=0, bool motorEnabled=false, Number motorSpeed=0, Number maxTorque=0);
 	
 	
-//	b2MouseJoint *createMouseJoint(ScreenEntity *ent1, Vector2 *mp);
+//	b2MouseJoint *createMouseJoint(Entity *ent1, Vector2 *mp);
 
 
 	/**
 	/**
 	* Applies linear force to an entity.
 	* Applies linear force to an entity.
@@ -289,7 +289,7 @@ public:
 	* @param fx X value of the force direction vector.
 	* @param fx X value of the force direction vector.
 	* @param fy Y value of the force direction vector.		
 	* @param fy Y value of the force direction vector.		
 	*/ 	
 	*/ 	
-	void applyForce(ScreenEntity *ent, Number fx, Number fy);
+	void applyForce(Entity *ent, Number fx, Number fy);
 	
 	
 	/**
 	/**
 	* Applies an impulse to an entity
 	* Applies an impulse to an entity
@@ -297,7 +297,7 @@ public:
 	* @param fx X value of the impulse direction vector.
 	* @param fx X value of the impulse direction vector.
 	* @param fy Y value of the impulse direction vector.		
 	* @param fy Y value of the impulse direction vector.		
 	*/ 		
 	*/ 		
-	void applyImpulse(ScreenEntity *ent, Number fx, Number fy);
+	void applyImpulse(Entity *ent, Number fx, Number fy);
 
 
 	/**
 	/**
 	* Sets the gravity for this screen.
 	* Sets the gravity for this screen.
@@ -311,11 +311,11 @@ public:
 	* @param pos New position to set.
 	* @param pos New position to set.
 	* @param angle New angle to set.
 	* @param angle New angle to set.
 	*/ 				
 	*/ 				
-	void setTransform(ScreenEntity *ent, Vector2 pos, Number angle);
+	void setTransform(Entity *ent, Vector2 pos, Number angle);
 
 
 	
 	
-	PhysicsScreenEntity *getPhysicsEntityByShape(b2Shape *shape);
-	PhysicsScreenEntity *getPhysicsEntityByFixture(b2Fixture *fixture);
+	PhysicsScene2DEntity *getPhysicsEntityByShape(b2Shape *shape);
+	PhysicsScene2DEntity *getPhysicsEntityByFixture(b2Fixture *fixture);
 
 
 	/**
 	/**
 	* Sets the linear velocity of an entity.
 	* Sets the linear velocity of an entity.
@@ -323,35 +323,35 @@ public:
 	* @param fx X direction of velocity vector.
 	* @param fx X direction of velocity vector.
 	* @param fy Y direction of velocity vector.
 	* @param fy Y direction of velocity vector.
 	*/ 					
 	*/ 					
-	void setVelocity(ScreenEntity *ent, Number fx, Number fy);	
+	void setVelocity(Entity *ent, Number fx, Number fy);	
 
 
 	/**
 	/**
 	* Sets the linear velocity of an entity on the X axis.
 	* Sets the linear velocity of an entity on the X axis.
 	* @param ent Entity to set velocity to.
 	* @param ent Entity to set velocity to.
 	* @param fx X direction of velocity vector.
 	* @param fx X direction of velocity vector.
 	*/ 						
 	*/ 						
-	void setVelocityX(ScreenEntity *ent, Number fx);	
+	void setVelocityX(Entity *ent, Number fx);	
 	
 	
 	/**
 	/**
 	* Sets the linear velocity of an entity on the Y axis.
 	* Sets the linear velocity of an entity on the Y axis.
 	* @param ent Entity to set velocity to.
 	* @param ent Entity to set velocity to.
 	* @param fy Y direction of velocity vector.
 	* @param fy Y direction of velocity vector.
 	*/ 							
 	*/ 							
-	void setVelocityY(ScreenEntity *ent, Number fy);	
+	void setVelocityY(Entity *ent, Number fy);	
 	
 	
 	/**
 	/**
 	* Sets the angular velocity of an entity
 	* Sets the angular velocity of an entity
 	* @param ent Entity to apply spin to.
 	* @param ent Entity to apply spin to.
 	* @param spin Spin value.
 	* @param spin Spin value.
 	*/ 								
 	*/ 								
-	void setAngularVelocity(ScreenEntity *ent, Number spin);
+	void setAngularVelocity(Entity *ent, Number spin);
 
 
 	/**
 	/**
 	* Returns the velocity of an entity.
 	* Returns the velocity of an entity.
 	* @param ent Entity to return velocity for
 	* @param ent Entity to return velocity for
 	* @return Velocity of the specified entity.
 	* @return Velocity of the specified entity.
 	*/ 									
 	*/ 									
-	Vector2 getVelocity(ScreenEntity *ent);
+	Vector2 getVelocity(Entity *ent);
 			
 			
 	void BeginContact (b2Contact *contact);
 	void BeginContact (b2Contact *contact);
 	void EndContact (b2Contact *contact);	
 	void EndContact (b2Contact *contact);	
@@ -362,7 +362,7 @@ public:
 	* Wake up a sleeping entity. The physics engine puts non-moving entities to sleep automatically. Use this to wake them up.
 	* Wake up a sleeping entity. The physics engine puts non-moving entities to sleep automatically. Use this to wake them up.
 	* @param ent Entity to wake up.
 	* @param ent Entity to wake up.
 	*/ 										
 	*/ 										
-	void wakeUp(ScreenEntity *ent);
+	void wakeUp(Entity *ent);
 	
 	
 	void handleEvent(Event *event);
 	void handleEvent(Event *event);
 
 
@@ -372,7 +372,7 @@ public:
 	* @param y Y position.
 	* @param y Y position.
 	* @return If there is a collision-tracked entity at the specified position, it will be returned, NULL if there isn't.
 	* @return If there is a collision-tracked entity at the specified position, it will be returned, NULL if there isn't.
 	*/ 													
 	*/ 													
-	ScreenEntity *getEntityAtPosition(Number x, Number y);
+	Entity *getEntityAtPosition(Number x, Number y);
 	
 	
 	/**
 	/**
 	* Returns true if the specified entity is at the specified position.
 	* Returns true if the specified entity is at the specified position.
@@ -381,23 +381,23 @@ public:
 	* @param y Y position.
 	* @param y Y position.
 	* @return If there specified entity overlaps the specified position, this returns true.
 	* @return If there specified entity overlaps the specified position, this returns true.
 	*/ 														
 	*/ 														
-	bool testEntityAtPosition(ScreenEntity *ent, Number x, Number y);
+	bool testEntityAtPosition(Entity *ent, Number x, Number y);
     
     
 	/**
 	/**
 	* Tests collision between two entities
 	* Tests collision between two entities
 	*/
 	*/
-	bool testEntityCollision(ScreenEntity *ent1, ScreenEntity *ent2);
+	bool testEntityCollision(Entity *ent1, Entity *ent2);
 	
 	
-	bool isEntityColliding(ScreenEntity *ent1);
+	bool isEntityColliding(Entity *ent1);
 	
 	
 	void Shutdown();
 	void Shutdown();
 	
 	
 	/**
 	/**
 	* Returns the physics entity for the specified screen entity. When you add ScreenEntities to the physics screen, these physics entities are created to track the physics status of the screen entities. You don't need to deal with these ever, but if you want, you can get them anyway.
 	* Returns the physics entity for the specified screen entity. When you add ScreenEntities to the physics screen, these physics entities are created to track the physics status of the screen entities. You don't need to deal with these ever, but if you want, you can get them anyway.
-	* @param ent ScreenEntity instance to return the physics entity for.
-	* @return PhysicsEntity associated with the ScreenEntity.
+	* @param ent Entity instance to return the physics entity for.
+	* @return PhysicsEntity associated with the Entity.
 	*/
 	*/
-	PhysicsScreenEntity *getPhysicsByScreenEntity(ScreenEntity *ent);
+	PhysicsScene2DEntity *getPhysicsByEntity(Entity *ent);
 	void destroyMouseJoint(b2MouseJoint *mJoint);
 	void destroyMouseJoint(b2MouseJoint *mJoint);
 
 
 
 
@@ -408,8 +408,8 @@ protected:
 	
 	
     Number worldScale;
     Number worldScale;
     
     
-    std::vector <PhysicsScreenEntity*> physicsChildren;
-	std::vector<PhysicsScreenEvent*> eventsToDispatch;
+    std::vector <PhysicsScene2DEntity*> physicsChildren;
+	std::vector<PhysicsScene2DEvent*> eventsToDispatch;
 			
 			
 	void init(Number worldScale, Number physicsTimeStep, int velIterations, int posIterations, Vector2 physicsGravity);
 	void init(Number worldScale, Number physicsTimeStep, int velIterations, int posIterations, Vector2 physicsGravity);
 
 

+ 7 - 7
Modules/Contents/2DPhysics/Include/PolyPhysicsScreenEntity.h

@@ -27,25 +27,25 @@ THE SOFTWARE.
 
 
 namespace Polycode {
 namespace Polycode {
 
 
-	class ScreenEntity;
+	class Entity;
 
 
 	/**
 	/**
 	* A 2D Physics enabled screen entity. 
 	* A 2D Physics enabled screen entity. 
 	*/	
 	*/	
-	class _PolyExport PhysicsScreenEntity {
+	class _PolyExport PhysicsScene2DEntity {
 		public:
 		public:
         
         
-            PhysicsScreenEntity() { collisionOnly = false; }
+            PhysicsScene2DEntity() { collisionOnly = false; }
         
         
-			PhysicsScreenEntity(ScreenEntity *entity, b2World *world, Number worldScale, int entType, bool isStatic, Number friction, Number density, Number restitution, bool isSensor, bool fixedRotation, int groupIndex = 0);
-			virtual ~PhysicsScreenEntity();
+			PhysicsScene2DEntity(Entity *entity, b2World *world, Number worldScale, int entType, bool isStatic, Number friction, Number density, Number restitution, bool isSensor, bool fixedRotation, int groupIndex = 0);
+			virtual ~PhysicsScene2DEntity();
 
 
 			virtual void Update();
 			virtual void Update();
 			
 			
 			/**
 			/**
 			* Returns the screen entity associated with this physics entity.
 			* Returns the screen entity associated with this physics entity.
 			*/
 			*/
-			ScreenEntity *getScreenEntity();
+			Entity *getEntity();
 			
 			
 			/**
 			/**
 			* Applies torque to the physics entity		
 			* Applies torque to the physics entity		
@@ -148,7 +148,7 @@ namespace Polycode {
 		protected:
 		protected:
         
         
 			Number worldScale;        
 			Number worldScale;        
-			ScreenEntity *screenEntity;   		
+			Entity *entity;
 	};
 	};
 
 
 }
 }

+ 101 - 102
Modules/Contents/2DPhysics/Source/PolyPhysicsScreen.cpp

@@ -22,48 +22,47 @@ THE SOFTWARE.
 
 
 
 
 #include "PolyPhysicsScreen.h"
 #include "PolyPhysicsScreen.h"
-#include "PolyScreenEntity.h"
 #include "PolyPhysicsScreenEntity.h"
 #include "PolyPhysicsScreenEntity.h"
 #include "PolyCoreServices.h"
 #include "PolyCoreServices.h"
 #include "PolyCore.h"
 #include "PolyCore.h"
 
 
 using namespace Polycode;
 using namespace Polycode;
 
 
-PhysicsScreenEvent::PhysicsScreenEvent() : Event() {
+PhysicsScene2DEvent::PhysicsScene2DEvent() : Event() {
 
 
 }
 }
 
 
-PhysicsScreenEvent::~PhysicsScreenEvent() {
+PhysicsScene2DEvent::~PhysicsScene2DEvent() {
 
 
 }
 }
 
 
-ScreenEntity *PhysicsScreenEvent::getFirstEntity() {
+Entity *PhysicsScene2DEvent::getFirstEntity() {
 	return entity1;
 	return entity1;
 }
 }
 
 
-ScreenEntity *PhysicsScreenEvent::getSecondEntity() {
+Entity *PhysicsScene2DEvent::getSecondEntity() {
 	return entity2;
 	return entity2;
 }
 }
 
 
-void PhysicsScreen::PreSolve(b2Contact* contact, const b2Manifold* oldManifold)
+void PhysicsScene2D::PreSolve(b2Contact* contact, const b2Manifold* oldManifold)
 {
 {
-    if(((PhysicsScreenEntity*)contact->GetFixtureA()->GetBody()->GetUserData())->collisionOnly ||
-       ((PhysicsScreenEntity*)contact->GetFixtureB()->GetBody()->GetUserData())->collisionOnly) {
+    if(((PhysicsScene2DEntity*)contact->GetFixtureA()->GetBody()->GetUserData())->collisionOnly ||
+       ((PhysicsScene2DEntity*)contact->GetFixtureB()->GetBody()->GetUserData())->collisionOnly) {
         contact->SetEnabled(false);
         contact->SetEnabled(false);
     }    
     }    
 }
 }
 
 
-void PhysicsScreen::BeginContact (b2Contact *contact) {
+void PhysicsScene2D::BeginContact (b2Contact *contact) {
 
 
 //	if(!contact->GetFixtureA()->IsSensor() && !contact->GetFixtureB()->IsSensor()) {
 //	if(!contact->GetFixtureA()->IsSensor() && !contact->GetFixtureB()->IsSensor()) {
 //		return;
 //		return;
 //	}
 //	}
-	PhysicsScreenEvent *newEvent = new PhysicsScreenEvent();
-	newEvent->entity1 = ((PhysicsScreenEntity*)contact->GetFixtureA()->GetBody()->GetUserData())->getScreenEntity();
-	newEvent->entity2 = ((PhysicsScreenEntity*)contact->GetFixtureB()->GetBody()->GetUserData())->getScreenEntity();
+	PhysicsScene2DEvent *newEvent = new PhysicsScene2DEvent();
+	newEvent->entity1 = ((PhysicsScene2DEntity*)contact->GetFixtureA()->GetBody()->GetUserData())->getEntity();
+	newEvent->entity2 = ((PhysicsScene2DEntity*)contact->GetFixtureB()->GetBody()->GetUserData())->getEntity();
 
 
-    if(((PhysicsScreenEntity*)contact->GetFixtureA()->GetBody()->GetUserData())->collisionOnly ||
-        ((PhysicsScreenEntity*)contact->GetFixtureB()->GetBody()->GetUserData())->collisionOnly) {
+    if(((PhysicsScene2DEntity*)contact->GetFixtureA()->GetBody()->GetUserData())->collisionOnly ||
+        ((PhysicsScene2DEntity*)contact->GetFixtureB()->GetBody()->GetUserData())->collisionOnly) {
         contact->SetEnabled(false);
         contact->SetEnabled(false);
     }
     }
        
        
@@ -92,20 +91,20 @@ void PhysicsScreen::BeginContact (b2Contact *contact) {
 
 
     newEvent->contact = contact;
     newEvent->contact = contact;
     
     
-	newEvent->setEventCode(PhysicsScreenEvent::EVENT_NEW_SHAPE_COLLISION);
+	newEvent->setEventCode(PhysicsScene2DEvent::EVENT_NEW_SHAPE_COLLISION);
 	eventsToDispatch.push_back(newEvent);
 	eventsToDispatch.push_back(newEvent);
 	
 	
 	contacts.push_back(contact);
 	contacts.push_back(contact);
 }
 }
 
 
-void PhysicsScreen::PostSolve(b2Contact* contact, const b2ContactImpulse* impulse) {
-	PhysicsScreenEvent *newEvent = new PhysicsScreenEvent();
-	newEvent->entity1 = ((PhysicsScreenEntity*)contact->GetFixtureA()->GetBody()->GetUserData())->getScreenEntity();
-	newEvent->entity2 = ((PhysicsScreenEntity*)contact->GetFixtureB()->GetBody()->GetUserData())->getScreenEntity();
+void PhysicsScene2D::PostSolve(b2Contact* contact, const b2ContactImpulse* impulse) {
+	PhysicsScene2DEvent *newEvent = new PhysicsScene2DEvent();
+	newEvent->entity1 = ((PhysicsScene2DEntity*)contact->GetFixtureA()->GetBody()->GetUserData())->getEntity();
+	newEvent->entity2 = ((PhysicsScene2DEntity*)contact->GetFixtureB()->GetBody()->GetUserData())->getEntity();
 
 
     
     
-    if(((PhysicsScreenEntity*)contact->GetFixtureA()->GetBody()->GetUserData())->collisionOnly ||
-       ((PhysicsScreenEntity*)contact->GetFixtureB()->GetBody()->GetUserData())->collisionOnly) {
+    if(((PhysicsScene2DEntity*)contact->GetFixtureA()->GetBody()->GetUserData())->collisionOnly ||
+       ((PhysicsScene2DEntity*)contact->GetFixtureB()->GetBody()->GetUserData())->collisionOnly) {
         contact->SetEnabled(false);
         contact->SetEnabled(false);
     }
     }
 
 
@@ -141,15 +140,15 @@ void PhysicsScreen::PostSolve(b2Contact* contact, const b2ContactImpulse* impuls
 			newEvent->frictionStrength = impulse->tangentImpulses[i];		
 			newEvent->frictionStrength = impulse->tangentImpulses[i];		
 	}
 	}
 
 
-	newEvent->setEventCode(PhysicsScreenEvent::EVENT_SOLVE_SHAPE_COLLISION);
+	newEvent->setEventCode(PhysicsScene2DEvent::EVENT_SOLVE_SHAPE_COLLISION);
 	eventsToDispatch.push_back(newEvent);
 	eventsToDispatch.push_back(newEvent);
 
 
 }
 }
 
 
-void PhysicsScreen::EndContact (b2Contact *contact) {
-	PhysicsScreenEvent *newEvent = new PhysicsScreenEvent();
-	newEvent->entity1 = ((PhysicsScreenEntity*)contact->GetFixtureA()->GetBody()->GetUserData())->getScreenEntity();
-	newEvent->entity2 = ((PhysicsScreenEntity*)contact->GetFixtureB()->GetBody()->GetUserData())->getScreenEntity();
+void PhysicsScene2D::EndContact (b2Contact *contact) {
+	PhysicsScene2DEvent *newEvent = new PhysicsScene2DEvent();
+	newEvent->entity1 = ((PhysicsScene2DEntity*)contact->GetFixtureA()->GetBody()->GetUserData())->getEntity();
+	newEvent->entity2 = ((PhysicsScene2DEntity*)contact->GetFixtureB()->GetBody()->GetUserData())->getEntity();
     newEvent->contact = contact;
     newEvent->contact = contact;
     
     
 	for(int i=0; i < contacts.size(); i++) {
 	for(int i=0; i < contacts.size(); i++) {
@@ -158,19 +157,19 @@ void PhysicsScreen::EndContact (b2Contact *contact) {
 			break;
 			break;
 		}
 		}
 	}
 	}
-	newEvent->setEventCode(PhysicsScreenEvent::EVENT_END_SHAPE_COLLISION);
+	newEvent->setEventCode(PhysicsScene2DEvent::EVENT_END_SHAPE_COLLISION);
 	eventsToDispatch.push_back(newEvent);
 	eventsToDispatch.push_back(newEvent);
 
 
 }
 }
 
 
-bool PhysicsScreen::isEntityColliding(ScreenEntity *ent1) {
-	PhysicsScreenEntity *pEnt1 = getPhysicsByScreenEntity(ent1);
+bool PhysicsScene2D::isEntityColliding(Entity *ent1) {
+	PhysicsScene2DEntity *pEnt1 = getPhysicsByEntity(ent1);
 	if(pEnt1 == NULL)
 	if(pEnt1 == NULL)
 		return false;
 		return false;
 
 
 	for(int i=0; i < contacts.size(); i++) {
 	for(int i=0; i < contacts.size(); i++) {
-		ScreenEntity *cEnt1 = ((PhysicsScreenEntity*)contacts[i]->GetFixtureA()->GetBody()->GetUserData())->getScreenEntity();
-		ScreenEntity *cEnt2 = ((PhysicsScreenEntity*)contacts[i]->GetFixtureB()->GetBody()->GetUserData())->getScreenEntity();
+		Entity *cEnt1 = ((PhysicsScene2DEntity*)contacts[i]->GetFixtureA()->GetBody()->GetUserData())->getEntity();
+		Entity *cEnt2 = ((PhysicsScene2DEntity*)contacts[i]->GetFixtureB()->GetBody()->GetUserData())->getEntity();
 		if(cEnt1 == ent1 || cEnt2 == ent1) {
 		if(cEnt1 == ent1 || cEnt2 == ent1) {
 			return true;
 			return true;
 		}
 		}
@@ -178,15 +177,15 @@ bool PhysicsScreen::isEntityColliding(ScreenEntity *ent1) {
 	return false;
 	return false;
 }
 }
 
 
-bool PhysicsScreen::testEntityCollision(ScreenEntity *ent1, ScreenEntity *ent2) {
-	PhysicsScreenEntity *pEnt1 = getPhysicsByScreenEntity(ent1);
-	PhysicsScreenEntity *pEnt2 = getPhysicsByScreenEntity(ent2);	
+bool PhysicsScene2D::testEntityCollision(Entity *ent1, Entity *ent2) {
+	PhysicsScene2DEntity *pEnt1 = getPhysicsByEntity(ent1);
+	PhysicsScene2DEntity *pEnt2 = getPhysicsByEntity(ent2);	
 	if(pEnt1 == NULL || pEnt2 == NULL)
 	if(pEnt1 == NULL || pEnt2 == NULL)
 		return false;
 		return false;
 	
 	
 	for(int i=0; i < contacts.size(); i++) {
 	for(int i=0; i < contacts.size(); i++) {
-		ScreenEntity *cEnt1 = ((PhysicsScreenEntity*)contacts[i]->GetFixtureA()->GetBody()->GetUserData())->getScreenEntity();
-		ScreenEntity *cEnt2 = ((PhysicsScreenEntity*)contacts[i]->GetFixtureB()->GetBody()->GetUserData())->getScreenEntity();
+		Entity *cEnt1 = ((PhysicsScene2DEntity*)contacts[i]->GetFixtureA()->GetBody()->GetUserData())->getEntity();
+		Entity *cEnt2 = ((PhysicsScene2DEntity*)contacts[i]->GetFixtureB()->GetBody()->GetUserData())->getEntity();
 		
 		
 	        
 	        
 		if((cEnt1 == ent1 && cEnt2 == ent2) || (cEnt1 == ent2 && cEnt2 == ent1)) {
 		if((cEnt1 == ent1 && cEnt2 == ent2) || (cEnt1 == ent2 && cEnt2 == ent1)) {
@@ -196,15 +195,15 @@ bool PhysicsScreen::testEntityCollision(ScreenEntity *ent1, ScreenEntity *ent2)
 	return false;
 	return false;
 }
 }
 
 
-PhysicsScreen::PhysicsScreen() : Screen() {
+PhysicsScene2D::PhysicsScene2D() : Scene() {
 	init(10.0f, 1.0f/60.0f,10,10,Vector2(0.0f, 10.0f));
 	init(10.0f, 1.0f/60.0f,10,10,Vector2(0.0f, 10.0f));
 }
 }
 
 
-PhysicsScreen::PhysicsScreen(Number worldScale, Number freq, int velIterations, int posIterations): Screen() {
+PhysicsScene2D::PhysicsScene2D(Number worldScale, Number freq, int velIterations, int posIterations): Scene() {
 	init(worldScale, 1.0f/freq,velIterations, posIterations, Vector2(0.0f, 10.0f));	
 	init(worldScale, 1.0f/freq,velIterations, posIterations, Vector2(0.0f, 10.0f));	
 }
 }
 
 
-void PhysicsScreen::init(Number worldScale, Number physicsTimeStep, int velIterations, int posIterations, Vector2 physicsGravity) {
+void PhysicsScene2D::init(Number worldScale, Number physicsTimeStep, int velIterations, int posIterations, Vector2 physicsGravity) {
 	
 	
 	cyclesLeftOver = 0.0;
 	cyclesLeftOver = 0.0;
 	this->worldScale = worldScale;
 	this->worldScale = worldScale;
@@ -220,26 +219,26 @@ void PhysicsScreen::init(Number worldScale, Number physicsTimeStep, int velItera
 	world->SetContactListener(this);
 	world->SetContactListener(this);
 }
 }
 
 
-void PhysicsScreen::setGravity(Vector2 newGravity) {
+void PhysicsScene2D::setGravity(Vector2 newGravity) {
 	world->SetGravity(b2Vec2(newGravity.x, newGravity.y));
 	world->SetGravity(b2Vec2(newGravity.x, newGravity.y));
 }
 }
                                 
                                 
-PhysicsScreenEntity *PhysicsScreen::getPhysicsByScreenEntity(ScreenEntity *ent) {
+PhysicsScene2DEntity *PhysicsScene2D::getPhysicsByEntity(Entity *ent) {
 	for(int i=0; i<physicsChildren.size();i++) {
 	for(int i=0; i<physicsChildren.size();i++) {
-		if(physicsChildren[i]->getScreenEntity() == ent)
+		if(physicsChildren[i]->getEntity() == ent)
 			return physicsChildren[i];
 			return physicsChildren[i];
 	}	
 	}	
 	return NULL;
 	return NULL;
 }
 }
 
 
-void PhysicsScreen::destroyJoint(PhysicsJoint *joint) {
+void PhysicsScene2D::destroyJoint(PhysicsJoint *joint) {
 	world->DestroyJoint(joint->box2DJoint);
 	world->DestroyJoint(joint->box2DJoint);
 }
 }
 
 
 
 
-PhysicsJoint *PhysicsScreen::createRevoluteJoint(ScreenEntity *ent1, ScreenEntity *ent2, Number ax, Number ay, bool collideConnected, bool enableLimit, Number lowerLimit, Number upperLimit, bool motorEnabled, Number motorSpeed, Number maxTorque) {
-	PhysicsScreenEntity *pEnt1 = getPhysicsByScreenEntity(ent1);
-	PhysicsScreenEntity *pEnt2 = getPhysicsByScreenEntity(ent2);
+PhysicsJoint *PhysicsScene2D::createRevoluteJoint(Entity *ent1, Entity *ent2, Number ax, Number ay, bool collideConnected, bool enableLimit, Number lowerLimit, Number upperLimit, bool motorEnabled, Number motorSpeed, Number maxTorque) {
+	PhysicsScene2DEntity *pEnt1 = getPhysicsByEntity(ent1);
+	PhysicsScene2DEntity *pEnt2 = getPhysicsByEntity(ent2);
 	if(pEnt1 == NULL || pEnt2 == NULL)
 	if(pEnt1 == NULL || pEnt2 == NULL)
     {
     {
 		return NULL;
 		return NULL;
@@ -261,9 +260,9 @@ PhysicsJoint *PhysicsScreen::createRevoluteJoint(ScreenEntity *ent1, ScreenEntit
 	
 	
 }
 }
 
 
-PhysicsJoint *PhysicsScreen::createPrismaticJoint(ScreenEntity *ent1, ScreenEntity *ent2, Vector2 worldAxis, Number ax, Number ay, bool collideConnected, Number lowerTranslation, Number upperTranslation, bool enableLimit, Number motorSpeed, Number motorForce, bool motorEnabled) {
-	PhysicsScreenEntity *pEnt1 = getPhysicsByScreenEntity(ent1);
-	PhysicsScreenEntity *pEnt2 = getPhysicsByScreenEntity(ent2);
+PhysicsJoint *PhysicsScene2D::createPrismaticJoint(Entity *ent1, Entity *ent2, Vector2 worldAxis, Number ax, Number ay, bool collideConnected, Number lowerTranslation, Number upperTranslation, bool enableLimit, Number motorSpeed, Number motorForce, bool motorEnabled) {
+	PhysicsScene2DEntity *pEnt1 = getPhysicsByEntity(ent1);
+	PhysicsScene2DEntity *pEnt2 = getPhysicsByEntity(ent2);
 	if(pEnt1 == NULL || pEnt2 == NULL)
 	if(pEnt1 == NULL || pEnt2 == NULL)
 		return NULL;
 		return NULL;
 	
 	
@@ -290,8 +289,8 @@ PhysicsJoint *PhysicsScreen::createPrismaticJoint(ScreenEntity *ent1, ScreenEnti
 
 
 }
 }
 
 
-void PhysicsScreen::wakeUp(ScreenEntity *ent) {
-	PhysicsScreenEntity *pEnt = getPhysicsByScreenEntity(ent);
+void PhysicsScene2D::wakeUp(Entity *ent) {
+	PhysicsScene2DEntity *pEnt = getPhysicsByEntity(ent);
 	if(pEnt == NULL)
 	if(pEnt == NULL)
 		return;
 		return;
 		
 		
@@ -299,8 +298,8 @@ void PhysicsScreen::wakeUp(ScreenEntity *ent) {
 }
 }
 
 
 
 
-Vector2 PhysicsScreen::getVelocity(ScreenEntity *ent) {
-	PhysicsScreenEntity *pEnt = getPhysicsByScreenEntity(ent);
+Vector2 PhysicsScene2D::getVelocity(Entity *ent) {
+	PhysicsScene2DEntity *pEnt = getPhysicsByEntity(ent);
 	if(pEnt == NULL)
 	if(pEnt == NULL)
 		return Vector2(0,0);
 		return Vector2(0,0);
 	
 	
@@ -308,61 +307,61 @@ Vector2 PhysicsScreen::getVelocity(ScreenEntity *ent) {
 	return Vector2(vec.x, vec.y);
 	return Vector2(vec.x, vec.y);
 }
 }
 
 
-void PhysicsScreen::setAngularVelocity(ScreenEntity *ent, Number spin) {
-	PhysicsScreenEntity *pEnt = getPhysicsByScreenEntity(ent);
+void PhysicsScene2D::setAngularVelocity(Entity *ent, Number spin) {
+	PhysicsScene2DEntity *pEnt = getPhysicsByEntity(ent);
 	if(pEnt == NULL)
 	if(pEnt == NULL)
 		return;
 		return;
 
 
 	pEnt->body->SetAngularVelocity(spin);
 	pEnt->body->SetAngularVelocity(spin);
 }
 }
 
 
-void PhysicsScreen::setVelocity(ScreenEntity *ent, Number fx, Number fy) {
-	PhysicsScreenEntity *pEnt = getPhysicsByScreenEntity(ent);
+void PhysicsScene2D::setVelocity(Entity *ent, Number fx, Number fy) {
+	PhysicsScene2DEntity *pEnt = getPhysicsByEntity(ent);
 	if(pEnt == NULL)
 	if(pEnt == NULL)
 		return;
 		return;
 	pEnt->setVelocity(fx, fy);	
 	pEnt->setVelocity(fx, fy);	
 }
 }
 
 
-void PhysicsScreen::setVelocityX(ScreenEntity *ent, Number fx) {
-	PhysicsScreenEntity *pEnt = getPhysicsByScreenEntity(ent);
+void PhysicsScene2D::setVelocityX(Entity *ent, Number fx) {
+	PhysicsScene2DEntity *pEnt = getPhysicsByEntity(ent);
 	if(pEnt == NULL)
 	if(pEnt == NULL)
 		return;
 		return;
 	pEnt->setVelocityX(fx);
 	pEnt->setVelocityX(fx);
 }
 }
 
 
-void PhysicsScreen::setVelocityY(ScreenEntity *ent, Number fy) {
-	PhysicsScreenEntity *pEnt = getPhysicsByScreenEntity(ent);
+void PhysicsScene2D::setVelocityY(Entity *ent, Number fy) {
+	PhysicsScene2DEntity *pEnt = getPhysicsByEntity(ent);
 	if(pEnt == NULL)
 	if(pEnt == NULL)
 		return;
 		return;
 	pEnt->setVelocityY(fy);
 	pEnt->setVelocityY(fy);
 }
 }
 
 
 
 
-PhysicsScreenEntity *PhysicsScreen::addCollisionChild(ScreenEntity *newEntity, int entType, int groupIndex, bool sensorOnly) {
-	PhysicsScreenEntity *ret;
+PhysicsScene2DEntity *PhysicsScene2D::addCollisionChild(Entity *newEntity, int entType, int groupIndex, bool sensorOnly) {
+	PhysicsScene2DEntity *ret;
 	ret = addPhysicsChild(newEntity, entType, false, 0,0,0, sensorOnly, false, groupIndex);
 	ret = addPhysicsChild(newEntity, entType, false, 0,0,0, sensorOnly, false, groupIndex);
 	newEntity->ignoreParentMatrix = false;    
 	newEntity->ignoreParentMatrix = false;    
 	ret->collisionOnly = true; 
 	ret->collisionOnly = true; 
 	return ret;
 	return ret;
 }
 }
 
 
-PhysicsScreenEntity *PhysicsScreen::trackCollisionChild(ScreenEntity *newEntity, int entType, int groupIndex) {
-	PhysicsScreenEntity *ret;
+PhysicsScene2DEntity *PhysicsScene2D::trackCollisionChild(Entity *newEntity, int entType, int groupIndex) {
+	PhysicsScene2DEntity *ret;
 	ret = trackPhysicsChild(newEntity, entType, false, 0,0.0,0, true, false, groupIndex);
 	ret = trackPhysicsChild(newEntity, entType, false, 0,0.0,0, true, false, groupIndex);
 	ret->collisionOnly = true;
 	ret->collisionOnly = true;
 	newEntity->ignoreParentMatrix = false;
 	newEntity->ignoreParentMatrix = false;
 	return ret;
 	return ret;
 }
 }
 
 
-void PhysicsScreen::setTransform(ScreenEntity *ent, Vector2 pos, Number angle) {
-	PhysicsScreenEntity *pEnt = getPhysicsByScreenEntity(ent);
+void PhysicsScene2D::setTransform(Entity *ent, Vector2 pos, Number angle) {
+	PhysicsScene2DEntity *pEnt = getPhysicsByEntity(ent);
 	if(pEnt == NULL)
 	if(pEnt == NULL)
 		return;
 		return;
 	pEnt->setTransform(pos, angle);
 	pEnt->setTransform(pos, angle);
 }
 }
 
 
-void PhysicsScreen::applyForce(ScreenEntity *ent, Number fx, Number fy) {
-	PhysicsScreenEntity *pEnt = getPhysicsByScreenEntity(ent);
+void PhysicsScene2D::applyForce(Entity *ent, Number fx, Number fy) {
+	PhysicsScene2DEntity *pEnt = getPhysicsByEntity(ent);
 	if(pEnt == NULL)
 	if(pEnt == NULL)
 		return;
 		return;
 
 
@@ -373,17 +372,17 @@ void PhysicsScreen::applyForce(ScreenEntity *ent, Number fx, Number fy) {
 	pEnt->body->ApplyForce(f, p);
 	pEnt->body->ApplyForce(f, p);
 }
 }
 
 
-void PhysicsScreen::applyImpulse(ScreenEntity *ent, Number fx, Number fy) {
-	PhysicsScreenEntity *pEnt = getPhysicsByScreenEntity(ent);
+void PhysicsScene2D::applyImpulse(Entity *ent, Number fx, Number fy) {
+	PhysicsScene2DEntity *pEnt = getPhysicsByEntity(ent);
 	if(pEnt == NULL)
 	if(pEnt == NULL)
 		return;
 		return;
 	pEnt->applyImpulse(fx, fy);
 	pEnt->applyImpulse(fx, fy);
 }
 }
 
 
 
 
-PhysicsJoint *PhysicsScreen::createDistanceJoint(ScreenEntity *ent1, ScreenEntity *ent2, bool collideConnected) {
-	PhysicsScreenEntity *pEnt1 = getPhysicsByScreenEntity(ent1);
-	PhysicsScreenEntity *pEnt2 = getPhysicsByScreenEntity(ent2);
+PhysicsJoint *PhysicsScene2D::createDistanceJoint(Entity *ent1, Entity *ent2, bool collideConnected) {
+	PhysicsScene2DEntity *pEnt1 = getPhysicsByEntity(ent1);
+	PhysicsScene2DEntity *pEnt2 = getPhysicsByEntity(ent2);
 	if(pEnt1 == NULL || pEnt2 == NULL)
 	if(pEnt1 == NULL || pEnt2 == NULL)
 		return NULL;
 		return NULL;
 	
 	
@@ -398,9 +397,9 @@ PhysicsJoint *PhysicsScreen::createDistanceJoint(ScreenEntity *ent1, ScreenEntit
 	return joint;	
 	return joint;	
 }
 }
 /*
 /*
-b2MouseJoint *PhysicsScreen::createMouseJoint(ScreenEntity *ent1, Vector2 *mp) {
+b2MouseJoint *PhysicsScene2D::createMouseJoint(Entity *ent1, Vector2 *mp) {
 	
 	
-	PhysicsScreenEntity *pEnt1 = getPhysicsByScreenEntity(ent1);
+	PhysicsScene2DEntity *pEnt1 = getPhysicsByEntity(ent1);
 	if(pEnt1 == NULL)
 	if(pEnt1 == NULL)
 		return NULL;
 		return NULL;
 
 
@@ -422,19 +421,19 @@ b2MouseJoint *PhysicsScreen::createMouseJoint(ScreenEntity *ent1, Vector2 *mp) {
 }
 }
 */
 */
 
 
-ScreenEntity *PhysicsScreen::getEntityAtPosition(Number x, Number y) {
-	ScreenEntity *ret = NULL;
+Entity *PhysicsScene2D::getEntityAtPosition(Number x, Number y) {
+	Entity *ret = NULL;
 	
 	
 	b2Vec2 mousePosition;
 	b2Vec2 mousePosition;
 	mousePosition.x = x/worldScale;
 	mousePosition.x = x/worldScale;
 	mousePosition.y = y/worldScale;
 	mousePosition.y = y/worldScale;
 	
 	
 	for(int i=0;i<physicsChildren.size();i++) {
 	for(int i=0;i<physicsChildren.size();i++) {
-		PhysicsScreenEntity *ent = physicsChildren[i];
+		PhysicsScene2DEntity *ent = physicsChildren[i];
 		if(ent->fixture) {
 		if(ent->fixture) {
 			for (b2Fixture* f = ent->body->GetFixtureList(); f; f = f->GetNext()) {
 			for (b2Fixture* f = ent->body->GetFixtureList(); f; f = f->GetNext()) {
 				if(f->TestPoint(mousePosition)) {
 				if(f->TestPoint(mousePosition)) {
-					return ent->getScreenEntity();
+					return ent->getEntity();
 				}
 				}
 			}
 			}
 		}
 		}
@@ -442,8 +441,8 @@ ScreenEntity *PhysicsScreen::getEntityAtPosition(Number x, Number y) {
 	return ret;
 	return ret;
 }
 }
 
 
-bool PhysicsScreen::testEntityAtPosition(ScreenEntity *ent, Number x, Number y) {
-	PhysicsScreenEntity *pEnt = getPhysicsByScreenEntity(ent);	
+bool PhysicsScene2D::testEntityAtPosition(Entity *ent, Number x, Number y) {
+	PhysicsScene2DEntity *pEnt = getPhysicsByEntity(ent);	
 	
 	
 	if(pEnt == NULL)
 	if(pEnt == NULL)
 		return false;
 		return false;
@@ -463,27 +462,27 @@ bool PhysicsScreen::testEntityAtPosition(ScreenEntity *ent, Number x, Number y)
 	return false;
 	return false;
 }
 }
 
 
-void PhysicsScreen::destroyMouseJoint(b2MouseJoint *mJoint) {
+void PhysicsScene2D::destroyMouseJoint(b2MouseJoint *mJoint) {
 		world->DestroyJoint(mJoint);
 		world->DestroyJoint(mJoint);
 		mJoint = NULL;
 		mJoint = NULL;
 }
 }
 
 
-PhysicsScreenEntity *PhysicsScreen::addPhysicsChild(ScreenEntity *newEntity, int entType, bool isStatic, Number friction, Number density, Number restitution, bool isSensor, bool fixedRotation, int groupIndex) {
+PhysicsScene2DEntity *PhysicsScene2D::addPhysicsChild(Entity *newEntity, int entType, bool isStatic, Number friction, Number density, Number restitution, bool isSensor, bool fixedRotation, int groupIndex) {
 	addChild(newEntity);
 	addChild(newEntity);
 	return trackPhysicsChild(newEntity, entType, isStatic, friction, density, restitution, isSensor, fixedRotation, groupIndex);
 	return trackPhysicsChild(newEntity, entType, isStatic, friction, density, restitution, isSensor, fixedRotation, groupIndex);
 
 
 }
 }
 
 
-PhysicsScreenEntity *PhysicsScreen::trackPhysicsChild(ScreenEntity *newEntity, int entType, bool isStatic, Number friction, Number density, Number restitution, bool isSensor, bool fixedRotation, int groupIndex) {
-	newEntity->setPositionMode(ScreenEntity::POSITION_CENTER);
-	PhysicsScreenEntity *newPhysicsEntity = new PhysicsScreenEntity(newEntity, world, worldScale, entType, isStatic, friction, density, restitution, isSensor,fixedRotation, groupIndex);
+PhysicsScene2DEntity *PhysicsScene2D::trackPhysicsChild(Entity *newEntity, int entType, bool isStatic, Number friction, Number density, Number restitution, bool isSensor, bool fixedRotation, int groupIndex) {
+	newEntity->setPositionMode(Entity::POSITION_CENTER);
+	PhysicsScene2DEntity *newPhysicsEntity = new PhysicsScene2DEntity(newEntity, world, worldScale, entType, isStatic, friction, density, restitution, isSensor,fixedRotation, groupIndex);
 	physicsChildren.push_back(newPhysicsEntity);
 	physicsChildren.push_back(newPhysicsEntity);
 	newPhysicsEntity->body->SetAwake(true);
 	newPhysicsEntity->body->SetAwake(true);
 	return newPhysicsEntity;
 	return newPhysicsEntity;
 }
 }
 
 
-void PhysicsScreen::stopTrackingChild(ScreenEntity *entity) {
-	PhysicsScreenEntity *physicsEntityToRemove = getPhysicsByScreenEntity(entity);
+void PhysicsScene2D::stopTrackingChild(Entity *entity) {
+	PhysicsScene2DEntity *physicsEntityToRemove = getPhysicsByEntity(entity);
 	if(!physicsEntityToRemove) {
 	if(!physicsEntityToRemove) {
 		return;
 		return;
 	}
 	}
@@ -500,31 +499,31 @@ void PhysicsScreen::stopTrackingChild(ScreenEntity *entity) {
 	delete physicsEntityToRemove;
 	delete physicsEntityToRemove;
 }
 }
 
 
-void PhysicsScreen::removePhysicsChild(ScreenEntity *entityToRemove) {
+void PhysicsScene2D::removePhysicsChild(Entity *entityToRemove) {
 	stopTrackingChild(entityToRemove);
 	stopTrackingChild(entityToRemove);
-	Screen::removeChild(entityToRemove);	
+	Scene::removeEntity(entityToRemove);	
 }
 }
 
 
-void PhysicsScreen::removeChild(ScreenEntity *entityToRemove) {
-	if(getPhysicsByScreenEntity(entityToRemove)) {
+void PhysicsScene2D::removeChild(Entity *entityToRemove) {
+	if(getPhysicsByEntity(entityToRemove)) {
 		removePhysicsChild(entityToRemove);
 		removePhysicsChild(entityToRemove);
 	} else {
 	} else {
-		Screen::removeChild(entityToRemove);	
+		Scene::removeEntity(entityToRemove);	
 	}
 	}
 }
 }
 
 
-void PhysicsScreen::Shutdown() {
+void PhysicsScene2D::Shutdown() {
 
 
 }
 }
 
 
-PhysicsScreen::~PhysicsScreen() {
+PhysicsScene2D::~PhysicsScene2D() {
 	for(int i=0; i<physicsChildren.size();i++) {
 	for(int i=0; i<physicsChildren.size();i++) {
 			delete physicsChildren[i];
 			delete physicsChildren[i];
 	}
 	}
 	delete world;	
 	delete world;	
 }
 }
 
 
-PhysicsScreenEntity *PhysicsScreen::getPhysicsEntityByFixture(b2Fixture *fixture) {
+PhysicsScene2DEntity *PhysicsScene2D::getPhysicsEntityByFixture(b2Fixture *fixture) {
 	for(int i=0; i < physicsChildren.size(); i++) {											
 	for(int i=0; i < physicsChildren.size(); i++) {											
 		for (b2Fixture* f = physicsChildren[i]->body->GetFixtureList(); f; f = f->GetNext()) {
 		for (b2Fixture* f = physicsChildren[i]->body->GetFixtureList(); f; f = f->GetNext()) {
 			if(f == fixture)
 			if(f == fixture)
@@ -534,7 +533,7 @@ PhysicsScreenEntity *PhysicsScreen::getPhysicsEntityByFixture(b2Fixture *fixture
 	return NULL;	
 	return NULL;	
 }
 }
 
 
-PhysicsScreenEntity *PhysicsScreen::getPhysicsEntityByShape(b2Shape *shape) {
+PhysicsScene2DEntity *PhysicsScene2D::getPhysicsEntityByShape(b2Shape *shape) {
 	for(int i=0; i < physicsChildren.size(); i++) {
 	for(int i=0; i < physicsChildren.size(); i++) {
 		for (b2Fixture *f = physicsChildren[i]->body->GetFixtureList(); f; f = f->GetNext()) {
 		for (b2Fixture *f = physicsChildren[i]->body->GetFixtureList(); f; f = f->GetNext()) {
 			if(f->GetShape() == shape)
 			if(f->GetShape() == shape)
@@ -544,11 +543,11 @@ PhysicsScreenEntity *PhysicsScreen::getPhysicsEntityByShape(b2Shape *shape) {
 	return NULL;
 	return NULL;
 }
 }
 	
 	
-void PhysicsScreen::handleEvent(Event *event) {	
-	Screen::handleEvent(event);
+void PhysicsScene2D::handleEvent(Event *event) {	
+	Scene::handleEvent(event);
 }
 }
 
 
-void PhysicsScreen::Update() {
+void PhysicsScene2D::Update() {
     
     
 	Number elapsed = CoreServices::getInstance()->getCore()->getElapsed() + cyclesLeftOver;
 	Number elapsed = CoreServices::getInstance()->getCore()->getElapsed() + cyclesLeftOver;
 	
 	
@@ -565,5 +564,5 @@ void PhysicsScreen::Update() {
 		eventsToDispatch.clear();
 		eventsToDispatch.clear();
 	}
 	}
 	cyclesLeftOver = elapsed;
 	cyclesLeftOver = elapsed;
-	Screen::Update();
+	Scene::Update();
 }
 }

+ 49 - 46
Modules/Contents/2DPhysics/Source/PolyPhysicsScreenEntity.cpp

@@ -26,17 +26,16 @@ THE SOFTWARE.
 #include "PolyLogger.h"
 #include "PolyLogger.h"
 #include "PolyMesh.h"
 #include "PolyMesh.h"
 #include "PolyPolygon.h"
 #include "PolyPolygon.h"
-#include "PolyScreenEntity.h"
-#include "PolyScreenMesh.h"
+#include "PolyEntity.h"
 
 
 using namespace Polycode;
 using namespace Polycode;
 
 
-PhysicsScreenEntity::PhysicsScreenEntity(ScreenEntity *entity, b2World *world, Number worldScale, int entType, bool isStatic, Number friction, Number density, Number restitution, bool isSensor, bool fixedRotation, int groupIndex) {
+PhysicsScene2DEntity::PhysicsScene2DEntity(Entity *entity, b2World *world, Number worldScale, int entType, bool isStatic, Number friction, Number density, Number restitution, bool isSensor, bool fixedRotation, int groupIndex) {
 	
 	
-	screenEntity = entity;
+	this->entity = entity;
 
 
 	Vector3 entityScale = entity->getCompoundScale();
 	Vector3 entityScale = entity->getCompoundScale();
-	Matrix4 compoundMatrix = screenEntity->getConcatenatedMatrix();
+	Matrix4 compoundMatrix = entity->getConcatenatedMatrix();
 	entity->ignoreParentMatrix = true;
 	entity->ignoreParentMatrix = true;
 	entity->scale = entityScale;
 	entity->scale = entityScale;
 	entityScale.x = fabs(entityScale.x);
 	entityScale.x = fabs(entityScale.x);
@@ -48,7 +47,7 @@ PhysicsScreenEntity::PhysicsScreenEntity(ScreenEntity *entity, b2World *world, N
 	// Create body definition---------------------------------------
 	// Create body definition---------------------------------------
 	b2BodyDef bodyDef;
 	b2BodyDef bodyDef;
 	bodyDef.position.Set(compoundMatrix.getPosition().x/worldScale, compoundMatrix.getPosition().y/worldScale);
 	bodyDef.position.Set(compoundMatrix.getPosition().x/worldScale, compoundMatrix.getPosition().y/worldScale);
-	bodyDef.angle = screenEntity->getRotation()*(PI/180.0f);	
+	bodyDef.angle = entity->rotation.roll*(PI/180.0f);	
 	bodyDef.bullet = isSensor;	
 	bodyDef.bullet = isSensor;	
 	bodyDef.fixedRotation = fixedRotation;	
 	bodyDef.fixedRotation = fixedRotation;	
 	if(isStatic)
 	if(isStatic)
@@ -74,7 +73,7 @@ PhysicsScreenEntity::PhysicsScreenEntity(ScreenEntity *entity, b2World *world, N
 			b2CircleShape Shape;
 			b2CircleShape Shape;
 			fDef.shape = &Shape;
 			fDef.shape = &Shape;
 			// Set the shape
 			// Set the shape
-			Shape.m_radius = screenEntity->getWidth()/(worldScale*2.0f);
+			Shape.m_radius = entity->getWidth()/(worldScale*2.0f);
 			// Create the fixture
 			// Create the fixture
 			fixture = body->CreateFixture(&fDef);
 			fixture = body->CreateFixture(&fDef);
 			break;
 			break;
@@ -83,26 +82,26 @@ PhysicsScreenEntity::PhysicsScreenEntity(ScreenEntity *entity, b2World *world, N
 			b2PolygonShape Shape;
 			b2PolygonShape Shape;
 			fDef.shape = &Shape;
 			fDef.shape = &Shape;
 			// Set the shape
 			// Set the shape
-			Shape.SetAsBox(screenEntity->getWidth()/(worldScale*2.0f) * entityScale.x, screenEntity->getHeight()/(worldScale*2.0f) * entityScale.y);
+			Shape.SetAsBox(entity->getWidth()/(worldScale*2.0f) * entityScale.x, entity->getHeight()/(worldScale*2.0f) * entityScale.y);
 			// Create the fixture
 			// Create the fixture
 			fixture = body->CreateFixture(&fDef);
 			fixture = body->CreateFixture(&fDef);
 			break;
 			break;
 		}
 		}
 		case ENTITY_EDGE: {
 		case ENTITY_EDGE: {
 			b2PolygonShape Shape;	
 			b2PolygonShape Shape;	
-			Shape.SetAsEdge(b2Vec2(-screenEntity->getWidth()/(worldScale*2.0f),-screenEntity->getHeight()/(2.0*worldScale)),
-							b2Vec2(screenEntity->getWidth()/(worldScale*2.0f),-screenEntity->getHeight()/(2.0*worldScale)));
+			Shape.SetAsEdge(b2Vec2(-entity->getWidth()/(worldScale*2.0f),-entity->getHeight()/(2.0*worldScale)),
+							b2Vec2(entity->getWidth()/(worldScale*2.0f),-entity->getHeight()/(2.0*worldScale)));
 			fDef.shape = &Shape;
 			fDef.shape = &Shape;
 			fixture = body->CreateFixture(&fDef);
 			fixture = body->CreateFixture(&fDef);
 			break;
 			break;
         }
         }
 		case ENTITY_CAPSULE: {
 		case ENTITY_CAPSULE: {
 		
 		
-			Number rectSize = (screenEntity->getHeight()/(worldScale*2.0f) * entityScale.y) - (screenEntity->getWidth()/(worldScale*2.0f * entityScale.y));
+			Number rectSize = (entity->getHeight()/(worldScale*2.0f) * entityScale.y) - (entity->getWidth()/(worldScale*2.0f * entityScale.y));
 					
 					
 			b2CircleShape Shape;
 			b2CircleShape Shape;
 			fDef.shape = &Shape;
 			fDef.shape = &Shape;
-			Shape.m_radius = screenEntity->getWidth()/(worldScale*2.0f);			
+			Shape.m_radius = entity->getWidth()/(worldScale*2.0f);			
 			Shape.m_p.y = rectSize;
 			Shape.m_p.y = rectSize;
 			fixture = body->CreateFixture(&fDef);
 			fixture = body->CreateFixture(&fDef);
 			Shape.m_p.y = -rectSize;
 			Shape.m_p.y = -rectSize;
@@ -110,18 +109,18 @@ PhysicsScreenEntity::PhysicsScreenEntity(ScreenEntity *entity, b2World *world, N
 			
 			
 			b2PolygonShape Shape2;
 			b2PolygonShape Shape2;
 			fDef.shape = &Shape2;
 			fDef.shape = &Shape2;
-			Shape2.SetAsBox(screenEntity->getWidth()/(worldScale*2.0f) * entityScale.x, rectSize);
+			Shape2.SetAsBox(entity->getWidth()/(worldScale*2.0f) * entityScale.x, rectSize);
 			fixture = body->CreateFixture(&fDef);
 			fixture = body->CreateFixture(&fDef);
 			break;						
 			break;						
 		}
 		}
 		break;
 		break;
 		case ENTITY_TRIPLE_CIRCLE: {
 		case ENTITY_TRIPLE_CIRCLE: {
 		
 		
-			Number rectSize = (screenEntity->getHeight()/(worldScale*2.0f) * entityScale.y) - (screenEntity->getWidth()/(worldScale*2.0f * entityScale.y));
+			Number rectSize = (entity->getHeight()/(worldScale*2.0f) * entityScale.y) - (entity->getWidth()/(worldScale*2.0f * entityScale.y));
 					
 					
 			b2CircleShape Shape;
 			b2CircleShape Shape;
 			fDef.shape = &Shape;
 			fDef.shape = &Shape;
-			Shape.m_radius = screenEntity->getWidth()/(worldScale*2.0f);			
+			Shape.m_radius = entity->getWidth()/(worldScale*2.0f);			
 			Shape.m_p.y = rectSize;
 			Shape.m_p.y = rectSize;
 			fixture = body->CreateFixture(&fDef);
 			fixture = body->CreateFixture(&fDef);
 			Shape.m_p.y = -rectSize;
 			Shape.m_p.y = -rectSize;
@@ -131,7 +130,9 @@ PhysicsScreenEntity::PhysicsScreenEntity(ScreenEntity *entity, b2World *world, N
 			break;						
 			break;						
 		}
 		}
 		break;	
 		break;	
-		case ENTITY_MESH: {
+		case ENTITY_MESH:
+		/*		
+		{
 			b2PolygonShape Shape;
 			b2PolygonShape Shape;
 			fDef.shape = &Shape;
 			fDef.shape = &Shape;
 			ScreenMesh* screenMesh = dynamic_cast<ScreenMesh*>(entity);
 			ScreenMesh* screenMesh = dynamic_cast<ScreenMesh*>(entity);
@@ -157,23 +158,25 @@ PhysicsScreenEntity::PhysicsScreenEntity(ScreenEntity *entity, b2World *world, N
 			}
 			}
 			else { Logger::log("Tried to make a mesh collision object from a non-mesh\n"); }
 			else { Logger::log("Tried to make a mesh collision object from a non-mesh\n"); }
 		}
 		}
+		*/
+		break;		
 	}
 	}
 }
 }
 
 
-void PhysicsScreenEntity::applyTorque(Number torque) {
+void PhysicsScene2DEntity::applyTorque(Number torque) {
 	body->ApplyTorque(torque);
 	body->ApplyTorque(torque);
 }
 }
 
 
-void PhysicsScreenEntity::applyForce(Vector2 force){
+void PhysicsScene2DEntity::applyForce(Vector2 force){
 	body->SetAwake(true);
 	body->SetAwake(true);
 	body->ApplyForce(b2Vec2(force.x,force.y), b2Vec2(body->GetPosition().x,body->GetPosition().y));
 	body->ApplyForce(b2Vec2(force.x,force.y), b2Vec2(body->GetPosition().x,body->GetPosition().y));
 }
 }
 
 
-ScreenEntity *PhysicsScreenEntity::getScreenEntity() {
-	return screenEntity;
+Entity *PhysicsScene2DEntity::getEntity() {
+	return entity;
 }
 }
 
 
-void PhysicsScreenEntity::setVelocity(Number fx, Number fy) {
+void PhysicsScene2DEntity::setVelocity(Number fx, Number fy) {
 	body->SetAwake(true);
 	body->SetAwake(true);
 	b2Vec2 f = body->GetLinearVelocity();
 	b2Vec2 f = body->GetLinearVelocity();
 	if(fx != 0)
 	if(fx != 0)
@@ -183,14 +186,14 @@ void PhysicsScreenEntity::setVelocity(Number fx, Number fy) {
 	body->SetLinearVelocity(f);
 	body->SetLinearVelocity(f);
 }
 }
 
 
-void PhysicsScreenEntity::setVelocityX( Number fx) {
+void PhysicsScene2DEntity::setVelocityX( Number fx) {
 	body->SetAwake(true);
 	body->SetAwake(true);
 	b2Vec2 f = body->GetLinearVelocity();
 	b2Vec2 f = body->GetLinearVelocity();
 	f.x = fx;	
 	f.x = fx;	
 	body->SetLinearVelocity(f);
 	body->SetLinearVelocity(f);
 }
 }
 
 
-void PhysicsScreenEntity::setVelocityY(Number fy) {
+void PhysicsScene2DEntity::setVelocityY(Number fy) {
 	body->SetAwake(true);
 	body->SetAwake(true);
 	b2Vec2 f = body->GetLinearVelocity();
 	b2Vec2 f = body->GetLinearVelocity();
 	f.y = fy;	
 	f.y = fy;	
@@ -198,70 +201,70 @@ void PhysicsScreenEntity::setVelocityY(Number fy) {
 }
 }
 
 
 
 
-void PhysicsScreenEntity::setCollisionCategory(int categoryBits) {
+void PhysicsScene2DEntity::setCollisionCategory(int categoryBits) {
         b2Filter filter=fixture->GetFilterData();
         b2Filter filter=fixture->GetFilterData();
         filter.categoryBits = categoryBits;
         filter.categoryBits = categoryBits;
         fixture->SetFilterData(filter);
         fixture->SetFilterData(filter);
 }
 }
 
 
-void PhysicsScreenEntity::setCollisionMask(int maskBits) {
+void PhysicsScene2DEntity::setCollisionMask(int maskBits) {
         b2Filter filter=fixture->GetFilterData();
         b2Filter filter=fixture->GetFilterData();
         filter.maskBits = maskBits;
         filter.maskBits = maskBits;
         fixture->SetFilterData(filter);
         fixture->SetFilterData(filter);
 }
 }
 
 
-void PhysicsScreenEntity::setCollisionGroupIndex(int group) {
+void PhysicsScene2DEntity::setCollisionGroupIndex(int group) {
     b2Filter filter=fixture->GetFilterData();
     b2Filter filter=fixture->GetFilterData();
     filter.groupIndex = group;
     filter.groupIndex = group;
     fixture->SetFilterData(filter);    
     fixture->SetFilterData(filter);    
 }
 }
 
 
-void PhysicsScreenEntity::setLinearDamping(Number damping) {
+void PhysicsScene2DEntity::setLinearDamping(Number damping) {
     body->SetLinearDamping(damping);
     body->SetLinearDamping(damping);
 }
 }
 
 
-void PhysicsScreenEntity::setAngularDamping(Number damping) {
+void PhysicsScene2DEntity::setAngularDamping(Number damping) {
     body->SetAngularDamping(damping);
     body->SetAngularDamping(damping);
 }
 }
 
 
-void PhysicsScreenEntity::setFriction(Number friction) {
+void PhysicsScene2DEntity::setFriction(Number friction) {
     if(fixture) {
     if(fixture) {
         fixture->SetFriction(friction);
         fixture->SetFriction(friction);
     }
     }
 }
 }
 
 
-void PhysicsScreenEntity::setDensity(Number density) {
+void PhysicsScene2DEntity::setDensity(Number density) {
     if(fixture) {
     if(fixture) {
         fixture->SetDensity(density);
         fixture->SetDensity(density);
     }
     }
 }
 }
 
 
-Number PhysicsScreenEntity::getLinearDamping() {
+Number PhysicsScene2DEntity::getLinearDamping() {
     return body->GetLinearDamping();
     return body->GetLinearDamping();
 }
 }
 
 
-Number PhysicsScreenEntity::getAngularDamping() {
+Number PhysicsScene2DEntity::getAngularDamping() {
     return body->GetAngularDamping();
     return body->GetAngularDamping();
 }
 }
 
 
-Number PhysicsScreenEntity::getFriction() {
+Number PhysicsScene2DEntity::getFriction() {
     return fixture->GetFriction();
     return fixture->GetFriction();
 }
 }
 
 
-Number PhysicsScreenEntity::getDensity() {
+Number PhysicsScene2DEntity::getDensity() {
     return fixture->GetDensity();
     return fixture->GetDensity();
 }
 }
 
 
-void PhysicsScreenEntity::applyImpulse(Number fx, Number fy) {
+void PhysicsScene2DEntity::applyImpulse(Number fx, Number fy) {
 	body->SetAwake(true);
 	body->SetAwake(true);
 	b2Vec2 f =  b2Vec2(fx,fy);
 	b2Vec2 f =  b2Vec2(fx,fy);
 	b2Vec2 p = body->GetWorldPoint(b2Vec2(0.0f, 0.0f));	
 	b2Vec2 p = body->GetWorldPoint(b2Vec2(0.0f, 0.0f));	
 	body->ApplyLinearImpulse(f, p);	
 	body->ApplyLinearImpulse(f, p);	
 }
 }
 			
 			
-void PhysicsScreenEntity::setTransform(Vector2 pos, Number angle) {
-	if(screenEntity->getParentEntity()) {
-		Matrix4 matrix = screenEntity->getParentEntity()->getConcatenatedMatrix();
+void PhysicsScene2DEntity::setTransform(Vector2 pos, Number angle) {
+	if(entity->getParentEntity()) {
+		Matrix4 matrix = entity->getParentEntity()->getConcatenatedMatrix();
 		Vector3 parentPos = matrix.getPosition();		
 		Vector3 parentPos = matrix.getPosition();		
 		pos.x = parentPos.x + pos.x;
 		pos.x = parentPos.x + pos.x;
 		pos.y = parentPos.y + pos.y;		
 		pos.y = parentPos.y + pos.y;		
@@ -271,9 +274,9 @@ void PhysicsScreenEntity::setTransform(Vector2 pos, Number angle) {
 	Update();
 	Update();
 }
 }
 
 
-void PhysicsScreenEntity::Update() {
+void PhysicsScene2DEntity::Update() {
 	if(collisionOnly) {
 	if(collisionOnly) {
-		Matrix4 matrix = screenEntity->getConcatenatedMatrix();
+		Matrix4 matrix = entity->getConcatenatedMatrix();
 		Vector3 pos = matrix.getPosition();		
 		Vector3 pos = matrix.getPosition();		
 		b2Vec2 newPos;
 		b2Vec2 newPos;
 		newPos.x = pos.x/worldScale;
 		newPos.x = pos.x/worldScale;
@@ -287,13 +290,13 @@ void PhysicsScreenEntity::Update() {
 	} else {
 	} else {
 		b2Vec2 position = body->GetPosition();
 		b2Vec2 position = body->GetPosition();
 		Number angle = body->GetAngle();	
 		Number angle = body->GetAngle();	
-		screenEntity->setRotation(angle*(180.0f/PI));	
-		screenEntity->setPosition(position.x*worldScale, position.y*worldScale);
-		screenEntity->rebuildTransformMatrix();		
+		entity->setRoll(angle*(180.0f/PI));	
+		entity->setPosition(position.x*worldScale, position.y*worldScale, 0.0);
+		entity->rebuildTransformMatrix();		
 	}	
 	}	
 }
 }
 
 
-b2Fixture* PhysicsScreenEntity::getFixture(unsigned short index) {
+b2Fixture* PhysicsScene2DEntity::getFixture(unsigned short index) {
 	if(fixture)	{
 	if(fixture)	{
 		short i = 0;
 		short i = 0;
 		for (b2Fixture* f = body->GetFixtureList(); f; f = f->GetNext()) {
 		for (b2Fixture* f = body->GetFixtureList(); f; f = f->GetNext()) {
@@ -312,13 +315,13 @@ b2Fixture* PhysicsScreenEntity::getFixture(unsigned short index) {
 	return fixture = NULL;	
 	return fixture = NULL;	
 }
 }
 
 
-b2Fixture* PhysicsScreenEntity::getFixture() { return fixture; }
+b2Fixture* PhysicsScene2DEntity::getFixture() { return fixture; }
 
 
 
 
 // I believe that at runtime you are not supposed to edit Shapes; However you still can
 // I believe that at runtime you are not supposed to edit Shapes; However you still can
 // by getting a fixture(above) and then adding "->GetShape()" on the end to get the fixtures shape
 // by getting a fixture(above) and then adding "->GetShape()" on the end to get the fixtures shape
 
 
-PhysicsScreenEntity::~PhysicsScreenEntity() {
+PhysicsScene2DEntity::~PhysicsScene2DEntity() {
 	if(body)
 	if(body)
 		body->GetWorld()->DestroyBody(body);	// DestroyBody deletes fixtures and shapes automaticaly according to box2d documentation
 		body->GetWorld()->DestroyBody(body);	// DestroyBody deletes fixtures and shapes automaticaly according to box2d documentation
 }
 }

+ 15 - 15
Modules/Contents/3DPhysics/Include/PolyCollisionScene.h

@@ -32,8 +32,8 @@ class btCollisionWorld;
 
 
 namespace Polycode {
 namespace Polycode {
 
 
-class SceneEntity;
-class CollisionSceneEntity;
+class Entity;
+class CollisionEntity;
 
 
 /**
 /**
 * Result of a collision test.
 * Result of a collision test.
@@ -66,7 +66,7 @@ struct CollisionResult {
 		/**
 		/**
 		* Entity returned.
 		* Entity returned.
 		*/
 		*/
-		SceneEntity *entity;
+		Entity *entity;
 		
 		
 		/**
 		/**
 		* Ray normal
 		* Ray normal
@@ -94,9 +94,9 @@ struct CollisionResult {
 		
 		
 			virtual void Update();
 			virtual void Update();
 			
 			
-			virtual void removeEntity(SceneEntity *entity);
+			virtual void removeEntity(Entity *entity);
 						
 						
-			CollisionSceneEntity *getCollisionEntityByObject(btCollisionObject *collisionObject);		
+			CollisionEntity *getCollisionEntityByObject(btCollisionObject *collisionObject);		
 
 
 			
 			
 			/** @name Collision scene
 			/** @name Collision scene
@@ -105,23 +105,23 @@ struct CollisionResult {
 			//@{			
 			//@{			
 			
 			
 			RayTestResult getFirstEntityInRay(const Vector3 &origin,  const Vector3 &dest);			
 			RayTestResult getFirstEntityInRay(const Vector3 &origin,  const Vector3 &dest);			
-			void enableCollision(SceneEntity *entity, bool val);											
-			CollisionSceneEntity *getCollisionByScreenEntity(SceneEntity *ent);
-			CollisionResult testCollision(SceneEntity *ent1, SceneEntity *ent2);
-			CollisionResult testCollisionOnCollisionChild(CollisionSceneEntity *cEnt1, CollisionSceneEntity *cEnt2);				
-			CollisionResult testCollisionOnCollisionChild_Convex(CollisionSceneEntity *cEnt1, CollisionSceneEntity *cEnt2);	
+			void enableCollision(Entity *entity, bool val);											
+			CollisionEntity *getCollisionByScreenEntity(Entity *ent);
+			CollisionResult testCollision(Entity *ent1, Entity *ent2);
+			CollisionResult testCollisionOnCollisionChild(CollisionEntity *cEnt1, CollisionEntity *cEnt2);				
+			CollisionResult testCollisionOnCollisionChild_Convex(CollisionEntity *cEnt1, CollisionEntity *cEnt2);	
 		
 		
-			virtual CollisionSceneEntity *addCollisionChild(SceneEntity *newEntity, int type=0, int group=1);
-			CollisionSceneEntity *trackCollision(SceneEntity *newEntity, int type=0, int group=1);
-			void removeCollision(SceneEntity *entity);
-			void adjustForCollision(CollisionSceneEntity *collisionEntity);
+			virtual CollisionEntity *addCollisionChild(Entity *newEntity, int type=0, int group=1);
+			CollisionEntity *trackCollision(Entity *newEntity, int type=0, int group=1);
+			void removeCollision(Entity *entity);
+			void adjustForCollision(CollisionEntity *collisionEntity);
 			
 			
 			//@}
 			//@}
 			// ----------------------------------------------------------------------------------------------------------------
 			// ----------------------------------------------------------------------------------------------------------------
 			
 			
 		protected:
 		protected:
 		
 		
-			std::vector<CollisionSceneEntity*> collisionChildren;
+			std::vector<CollisionEntity*> collisionChildren;
 			btCollisionWorld *world;
 			btCollisionWorld *world;
 			
 			
 			btDefaultCollisionConfiguration *collisionConfiguration;
 			btDefaultCollisionConfiguration *collisionConfiguration;

+ 8 - 8
Modules/Contents/3DPhysics/Include/PolyCollisionSceneEntity.h

@@ -31,25 +31,25 @@ class btCollisionObject;
 
 
 namespace Polycode {
 namespace Polycode {
 
 
-	class SceneEntity;
+	class Entity;
 
 
 	/**
 	/**
-	* A wrapped around SceneEntity that provides collision information.
+	* A wrapped around Entity that provides collision information.
 	*/
 	*/
-	class _PolyExport CollisionSceneEntity {
+	class _PolyExport CollisionEntity {
 		public:
 		public:
 			/**
 			/**
 			* Main constructor.
 			* Main constructor.
 			*/ 
 			*/ 
-			CollisionSceneEntity(SceneEntity *entity, int type, bool compoundChildren = false);
-			virtual ~CollisionSceneEntity();
+			CollisionEntity(Entity *entity, int type, bool compoundChildren = false);
+			virtual ~CollisionEntity();
 			
 			
 			/** @name Collision scene entity
 			/** @name Collision scene entity
 			*  Public methods
 			*  Public methods
 			*/
 			*/
 			//@{			
 			//@{			
 			
 			
-			SceneEntity *getSceneEntity();			
+			Entity *getEntity();			
 			
 			
 			int getType() { return type; }
 			int getType() { return type; }
 						
 						
@@ -59,7 +59,7 @@ namespace Polycode {
 			virtual void Update();
 			virtual void Update();
 		
 		
 			btConvexShape *getConvexShape(){ return convexShape; }					
 			btConvexShape *getConvexShape(){ return convexShape; }					
-			btCollisionShape *createCollisionShape(SceneEntity *entity, int type);		
+			btCollisionShape *createCollisionShape(Entity *entity, int type);		
 			btCollisionObject *collisionObject;		
 			btCollisionObject *collisionObject;		
 			Vector3 lastPosition;
 			Vector3 lastPosition;
 		
 		
@@ -117,7 +117,7 @@ namespace Polycode {
 			btConcaveShape *concaveShape;
 			btConcaveShape *concaveShape;
 		
 		
 			int type;
 			int type;
-			SceneEntity *sceneEntity;
+			Entity *entity;
 	
 	
 	};
 	};
 }
 }

+ 21 - 21
Modules/Contents/3DPhysics/Include/PolyPhysicsScene.h

@@ -35,8 +35,8 @@ class btGeneric6DofConstraint;
 
 
 namespace Polycode {
 namespace Polycode {
 
 
-	class SceneEntity;
-	class PhysicsSceneEntity;
+	class Entity;
+	class PhysicsEntity;
 	class PhysicsCharacter;
 	class PhysicsCharacter;
 	class PhysicsVehicle;
 	class PhysicsVehicle;
 	
 	
@@ -48,8 +48,8 @@ namespace Polycode {
 			static const int EVENTBASE_PHYSICSSCENEEVENT = 0x900;
 			static const int EVENTBASE_PHYSICSSCENEEVENT = 0x900;
 			static const int COLLISION_EVENT = EVENTBASE_PHYSICSSCENEEVENT+0;
 			static const int COLLISION_EVENT = EVENTBASE_PHYSICSSCENEEVENT+0;
 			
 			
-			PhysicsSceneEntity *entityA;
-			PhysicsSceneEntity *entityB;
+			PhysicsEntity *entityA;
+			PhysicsEntity *entityB;
 
 
 			Number appliedImpulse;
 			Number appliedImpulse;
 						
 						
@@ -92,46 +92,46 @@ namespace Polycode {
 		
 		
 		void Update();		
 		void Update();		
 		
 		
-		void removeEntity(SceneEntity *entity);
+		void removeEntity(Entity *entity);
 		
 		
 		void processWorldCollisions();
 		void processWorldCollisions();
 		
 		
-		PhysicsSceneEntity *getPhysicsEntityByCollisionObject(btCollisionObject *object);
+		PhysicsEntity *getPhysicsEntityByCollisionObject(btCollisionObject *object);
 		
 		
 			/** @name Physics scene
 			/** @name Physics scene
 			*  Public methods
 			*  Public methods
 			*/
 			*/
 			//@{			
 			//@{			
 		
 		
-		void removePhysicsChild(SceneEntity *entity);
-		PhysicsSceneEntity *getPhysicsEntityBySceneEntity(SceneEntity *entity);
+		void removePhysicsChild(Entity *entity);
+		PhysicsEntity *getPhysicsEntityByEntity(Entity *entity);
 		
 		
-		PhysicsSceneEntity *addPhysicsChild(SceneEntity *newEntity, int type=0, Number mass = 0.0f, Number friction=1, Number restitution=0, int group=1, bool compoundChildren = false);		
-		PhysicsSceneEntity *trackPhysicsChild(SceneEntity *newEntity, int type=0, Number mass = 0.0f, Number friction=1, Number restitution=0, int group=1, bool compoundChildren = false);		
+		PhysicsEntity *addPhysicsChild(Entity *newEntity, int type=0, Number mass = 0.0f, Number friction=1, Number restitution=0, int group=1, bool compoundChildren = false);		
+		PhysicsEntity *trackPhysicsChild(Entity *newEntity, int type=0, Number mass = 0.0f, Number friction=1, Number restitution=0, int group=1, bool compoundChildren = false);		
 		
 		
-		PhysicsCharacter *addCharacterChild(SceneEntity *newEntity, Number mass, Number friction, Number stepSize, int group  = 1);
+		PhysicsCharacter *addCharacterChild(Entity *newEntity, Number mass, Number friction, Number stepSize, int group  = 1);
 		void removeCharacterChild(PhysicsCharacter *character);
 		void removeCharacterChild(PhysicsCharacter *character);
 		
 		
-		PhysicsHingeConstraint *createHingeConstraint(SceneEntity *entity, Vector3 pivot, Vector3 axis, Number minLimit, Number maxLimit);
+		PhysicsHingeConstraint *createHingeConstraint(Entity *entity, Vector3 pivot, Vector3 axis, Number minLimit, Number maxLimit);
 
 
-		PhysicsHingeConstraint *createHingeJoint(SceneEntity *entity1, SceneEntity *entity2, Vector3 pivot1, Vector3 axis1, Vector3 pivot2, Vector3 axis2, Number minLimit, Number maxLimit);
+		PhysicsHingeConstraint *createHingeJoint(Entity *entity1, Entity *entity2, Vector3 pivot1, Vector3 axis1, Vector3 pivot2, Vector3 axis2, Number minLimit, Number maxLimit);
 		
 		
-		PhysicsGenericConstraint *createGenericConstraint(SceneEntity *entity);
+		PhysicsGenericConstraint *createGenericConstraint(Entity *entity);
 				
 				
-		void setVelocity(SceneEntity *entity, Vector3 velocity);
-		void setSpin(SceneEntity *entity, Vector3 spin);
+		void setVelocity(Entity *entity, Vector3 velocity);
+		void setSpin(Entity *entity, Vector3 spin);
 				
 				
-		void warpEntity(SceneEntity *entity, Vector3 position, bool resetRotation = false);
+		void warpEntity(Entity *entity, Vector3 position, bool resetRotation = false);
 		
 		
 		void removeConstraint(PhysicsHingeConstraint *constraint);
 		void removeConstraint(PhysicsHingeConstraint *constraint);
 		
 		
-		void applyImpulse(SceneEntity *entity, Vector3 force, Vector3 point);
+		void applyImpulse(Entity *entity, Vector3 force, Vector3 point);
 		
 		
-		PhysicsVehicle *addVehicleChild(SceneEntity *newEntity, Number mass, Number friction, int group  = 1);
+		PhysicsVehicle *addVehicleChild(Entity *newEntity, Number mass, Number friction, int group  = 1);
 		
 		
 		void setGravity(Vector3 gravity);
 		void setGravity(Vector3 gravity);
 		
 		
-		void wakeUp(SceneEntity *entity);
+		void wakeUp(Entity *entity);
 			//@}
 			//@}
 			// ----------------------------------------------------------------------------------------------------------------
 			// ----------------------------------------------------------------------------------------------------------------
 
 
@@ -146,7 +146,7 @@ namespace Polycode {
 		btDbvtBroadphase *broadphase;
 		btDbvtBroadphase *broadphase;
 		btGhostPairCallback *ghostPairCallback;
 		btGhostPairCallback *ghostPairCallback;
 		
 		
-		std::vector<PhysicsSceneEntity*> physicsChildren;
+		std::vector<PhysicsEntity*> physicsChildren;
 		
 		
 	};
 	};
 	
 	

+ 12 - 11
Modules/Contents/3DPhysics/Include/PolyPhysicsSceneEntity.h

@@ -30,15 +30,17 @@ THE SOFTWARE.
 class btKinematicCharacterController;
 class btKinematicCharacterController;
 class btPairCachingGhostObject;
 class btPairCachingGhostObject;
 
 
+class Entity;
+
 namespace Polycode {
 namespace Polycode {
 	
 	
 	/**
 	/**
-	* A wrapper around SceneEntity that provides physics information.
+	* A wrapper around Entity that provides physics information.
 	*/
 	*/
-	class _PolyExport PhysicsSceneEntity : public CollisionSceneEntity {
+	class _PolyExport PhysicsEntity : public CollisionEntity {
 	public:
 	public:
-		PhysicsSceneEntity(SceneEntity *entity, int type, Number mass, Number friction, Number restitution, bool compoundChildren = false);
-		virtual ~PhysicsSceneEntity();
+		PhysicsEntity(Entity *entity, int type, Number mass, Number friction, Number restitution, bool compoundChildren = false);
+		virtual ~PhysicsEntity();
 		virtual void Update();
 		virtual void Update();
 				
 				
 			/** @name Physics scene entity
 			/** @name Physics scene entity
@@ -46,7 +48,6 @@ namespace Polycode {
 			*/
 			*/
 			//@{			
 			//@{			
 				
 				
-		SceneEntity *getSceneEntity();
 		void setFriction(Number friction);		
 		void setFriction(Number friction);		
 		int getType() { return type; }	
 		int getType() { return type; }	
 		
 		
@@ -122,9 +123,9 @@ namespace Polycode {
 	/**
 	/**
 	* A Physics character controller.
 	* A Physics character controller.
 	*/
 	*/
-	class _PolyExport PhysicsCharacter : public PhysicsSceneEntity {
+	class _PolyExport PhysicsCharacter : public PhysicsEntity {
 		public:
 		public:
-			PhysicsCharacter(SceneEntity *entity, Number mass, Number friction, Number stepSize);
+			PhysicsCharacter(Entity *entity, Number mass, Number friction, Number stepSize);
 			virtual ~PhysicsCharacter();
 			virtual ~PhysicsCharacter();
 	
 	
 			virtual void Update();
 			virtual void Update();
@@ -166,23 +167,23 @@ namespace Polycode {
 			/**
 			/**
 			* Wheel scene entity.
 			* Wheel scene entity.
 			*/			
 			*/			
-			SceneEntity *wheelEntity;
+			Entity *wheelEntity;
 	};
 	};
 	
 	
 	/**
 	/**
 	* A physics vehicle controller.
 	* A physics vehicle controller.
 	*/
 	*/
-	class _PolyExport PhysicsVehicle : public PhysicsSceneEntity {
+	class _PolyExport PhysicsVehicle : public PhysicsEntity {
 		public:
 		public:
 				
 				
-			PhysicsVehicle(SceneEntity *entity, Number mass, Number friction, btDefaultVehicleRaycaster *rayCaster);
+			PhysicsVehicle(Entity *entity, Number mass, Number friction, btDefaultVehicleRaycaster *rayCaster);
 
 
 			/** @name Physics vehicle
 			/** @name Physics vehicle
 			*  Public methods
 			*  Public methods
 			*/
 			*/
 			//@{			
 			//@{			
 
 
-			void addWheel(SceneEntity *entity, Vector3 connection, Vector3 direction, Vector3 axle, Number suspentionRestLength, Number wheelRadius, bool isFrontWheel,Number suspensionStiffness = 20.0f, Number suspensionDamping = 1.0f, Number suspensionCompression = 4.0f, Number wheelFriction = 10000.0f, Number rollInfluence = 0.05f);
+			void addWheel(Entity *entity, Vector3 connection, Vector3 direction, Vector3 axle, Number suspentionRestLength, Number wheelRadius, bool isFrontWheel,Number suspensionStiffness = 20.0f, Number suspensionDamping = 1.0f, Number suspensionCompression = 4.0f, Number wheelFriction = 10000.0f, Number rollInfluence = 0.05f);
 			void applyEngineForce(Number force, unsigned int wheelIndex);
 			void applyEngineForce(Number force, unsigned int wheelIndex);
 			void setSteeringValue(Number value, unsigned int wheelIndex);
 			void setSteeringValue(Number value, unsigned int wheelIndex);
 			void setBrake(Number value, unsigned int wheelIndex);
 			void setBrake(Number value, unsigned int wheelIndex);

+ 26 - 26
Modules/Contents/3DPhysics/Source/PolyCollisionScene.cpp

@@ -22,7 +22,7 @@ THE SOFTWARE.
 
 
 #include "PolyCollisionScene.h"
 #include "PolyCollisionScene.h"
 #include "PolyCollisionSceneEntity.h"
 #include "PolyCollisionSceneEntity.h"
-#include "PolySceneEntity.h"
+#include "PolyEntity.h"
 
 
 using namespace Polycode;
 using namespace Polycode;
 
 
@@ -55,19 +55,19 @@ void CollisionScene::Update() {
 	
 	
 	for(int i=0; i < collisionChildren.size(); i++) {
 	for(int i=0; i < collisionChildren.size(); i++) {
 		if(collisionChildren[i]->enabled)		
 		if(collisionChildren[i]->enabled)		
-			collisionChildren[i]->lastPosition = collisionChildren[i]->getSceneEntity()->getPosition();
+			collisionChildren[i]->lastPosition = collisionChildren[i]->getEntity()->getPosition();
 	}
 	}
 	Scene::Update();	
 	Scene::Update();	
 }
 }
 
 
-void CollisionScene::enableCollision(SceneEntity *entity, bool val) {
-	CollisionSceneEntity *cEnt = getCollisionByScreenEntity(entity);
+void CollisionScene::enableCollision(Entity *entity, bool val) {
+	CollisionEntity *cEnt = getCollisionByScreenEntity(entity);
 	if(cEnt) {
 	if(cEnt) {
 		cEnt->enabled = val;
 		cEnt->enabled = val;
 	}
 	}
 }
 }
 
 
-void CollisionScene::adjustForCollision(CollisionSceneEntity *collisionEntity) {
+void CollisionScene::adjustForCollision(CollisionEntity *collisionEntity) {
 	CollisionResult result;
 	CollisionResult result;
 //	Number elapsed = CoreServices::getInstance()->getCore()->getElapsed();
 //	Number elapsed = CoreServices::getInstance()->getCore()->getElapsed();
 	result.collided = false;
 	result.collided = false;
@@ -76,25 +76,25 @@ void CollisionScene::adjustForCollision(CollisionSceneEntity *collisionEntity) {
 			result = testCollisionOnCollisionChild(collisionEntity, collisionChildren[i]);
 			result = testCollisionOnCollisionChild(collisionEntity, collisionChildren[i]);
 			if(result.collided) {
 			if(result.collided) {
 				if(result.setOldPosition) {
 				if(result.setOldPosition) {
-					collisionEntity->getSceneEntity()->setPosition(result.newPos);
+					collisionEntity->getEntity()->setPosition(result.newPos);
 				} else {
 				} else {
-					collisionEntity->getSceneEntity()->Translate(result.colNormal.x*result.colDist, result.colNormal.y*result.colDist, result.colNormal.z*result.colDist);
+					collisionEntity->getEntity()->Translate(result.colNormal.x*result.colDist, result.colNormal.y*result.colDist, result.colNormal.z*result.colDist);
 				}
 				}
 			}
 			}
 		}
 		}
 	}
 	}
 }	
 }	
 
 
-CollisionSceneEntity *CollisionScene::getCollisionByScreenEntity(SceneEntity *ent) {
+CollisionEntity *CollisionScene::getCollisionByScreenEntity(Entity *ent) {
 	for(int i=0; i<collisionChildren.size();i++) {
 	for(int i=0; i<collisionChildren.size();i++) {
-		if(collisionChildren[i]->getSceneEntity() == ent)
+		if(collisionChildren[i]->getEntity() == ent)
 			return collisionChildren[i];
 			return collisionChildren[i];
 	}	
 	}	
 	return NULL;
 	return NULL;
 
 
 }
 }
 
 
-CollisionResult CollisionScene::testCollisionOnCollisionChild_Convex(CollisionSceneEntity *cEnt1, CollisionSceneEntity *cEnt2) {
+CollisionResult CollisionScene::testCollisionOnCollisionChild_Convex(CollisionEntity *cEnt1, CollisionEntity *cEnt2) {
 	CollisionResult result;
 	CollisionResult result;
 	result.collided = false;
 	result.collided = false;
 	result.setOldPosition = false;
 	result.setOldPosition = false;
@@ -156,9 +156,9 @@ RayTestResult CollisionScene::getFirstEntityInRay(const Vector3 &origin,  const
 	world->rayTest (fromVec, toVec, cb);	
 	world->rayTest (fromVec, toVec, cb);	
 	
 	
 	if (cb.hasHit ()) {
 	if (cb.hasHit ()) {
-		CollisionSceneEntity *retEnt = getCollisionEntityByObject(cb.m_collisionObject);
+		CollisionEntity *retEnt = getCollisionEntityByObject(cb.m_collisionObject);
 		if(retEnt) {
 		if(retEnt) {
-			ret.entity = retEnt->getSceneEntity();
+			ret.entity = retEnt->getEntity();
 			ret.position = Vector3(cb.m_hitPointWorld.getX(), cb.m_hitPointWorld.getY(), cb.m_hitPointWorld.getZ());
 			ret.position = Vector3(cb.m_hitPointWorld.getX(), cb.m_hitPointWorld.getY(), cb.m_hitPointWorld.getZ());
 			ret.normal = Vector3(cb.m_hitNormalWorld.getX(), cb.m_hitNormalWorld.getY(), cb.m_hitNormalWorld.getZ());			
 			ret.normal = Vector3(cb.m_hitNormalWorld.getX(), cb.m_hitNormalWorld.getY(), cb.m_hitNormalWorld.getZ());			
 			return ret;
 			return ret;
@@ -168,18 +168,18 @@ RayTestResult CollisionScene::getFirstEntityInRay(const Vector3 &origin,  const
 	return ret;
 	return ret;
 }
 }
 
 
-CollisionSceneEntity *CollisionScene::getCollisionEntityByObject(btCollisionObject *collisionObject) {
-	return (CollisionSceneEntity*)collisionObject->getUserPointer();
+CollisionEntity *CollisionScene::getCollisionEntityByObject(btCollisionObject *collisionObject) {
+	return (CollisionEntity*)collisionObject->getUserPointer();
 }
 }
 
 
 
 
-CollisionResult CollisionScene::testCollisionOnCollisionChild(CollisionSceneEntity *cEnt1, CollisionSceneEntity *cEnt2) {
+CollisionResult CollisionScene::testCollisionOnCollisionChild(CollisionEntity *cEnt1, CollisionEntity *cEnt2) {
 		return testCollisionOnCollisionChild_Convex(cEnt1, cEnt2);
 		return testCollisionOnCollisionChild_Convex(cEnt1, cEnt2);
 }
 }
 
 
-CollisionResult CollisionScene::testCollision(SceneEntity *ent1, SceneEntity *ent2) {
-	CollisionSceneEntity *cEnt1 = getCollisionByScreenEntity(ent1);
-	CollisionSceneEntity *cEnt2 = getCollisionByScreenEntity(ent2);
+CollisionResult CollisionScene::testCollision(Entity *ent1, Entity *ent2) {
+	CollisionEntity *cEnt1 = getCollisionByScreenEntity(ent1);
+	CollisionEntity *cEnt2 = getCollisionByScreenEntity(ent2);
 	CollisionResult result;
 	CollisionResult result;
 	result.collided = false;
 	result.collided = false;
 	if(cEnt1 == NULL || cEnt2 == NULL)
 	if(cEnt1 == NULL || cEnt2 == NULL)
@@ -197,13 +197,13 @@ CollisionScene::~CollisionScene() {
 	delete collisionConfiguration;
 	delete collisionConfiguration;
 }
 }
 
 
-void CollisionScene::removeCollision(SceneEntity *entity) {
-	CollisionSceneEntity *cEnt = getCollisionByScreenEntity(entity);
+void CollisionScene::removeCollision(Entity *entity) {
+	CollisionEntity *cEnt = getCollisionByScreenEntity(entity);
 	if(cEnt) {
 	if(cEnt) {
 		world->removeCollisionObject(cEnt->collisionObject);
 		world->removeCollisionObject(cEnt->collisionObject);
 		for(int i=0; i < collisionChildren.size(); i++) {
 		for(int i=0; i < collisionChildren.size(); i++) {
 			if(collisionChildren[i] == cEnt) {
 			if(collisionChildren[i] == cEnt) {
-				std::vector<CollisionSceneEntity*>::iterator target = collisionChildren.begin()+i;
+				std::vector<CollisionEntity*>::iterator target = collisionChildren.begin()+i;
 				delete *target;
 				delete *target;
 				collisionChildren.erase(target);
 				collisionChildren.erase(target);
 			}
 			}
@@ -212,17 +212,17 @@ void CollisionScene::removeCollision(SceneEntity *entity) {
 
 
 }
 }
 
 
-void CollisionScene::removeEntity(SceneEntity *entity) {
+void CollisionScene::removeEntity(Entity *entity) {
 	if(getCollisionByScreenEntity(entity)) {
 	if(getCollisionByScreenEntity(entity)) {
 		removeCollision(entity);	
 		removeCollision(entity);	
 	}
 	}
 	Scene::removeEntity(entity);
 	Scene::removeEntity(entity);
 }
 }
 
 
-CollisionSceneEntity *CollisionScene::trackCollision(SceneEntity *newEntity, int type, int group) {
-	CollisionSceneEntity *newCollisionEntity = new CollisionSceneEntity(newEntity, type);
+CollisionEntity *CollisionScene::trackCollision(Entity *newEntity, int type, int group) {
+	CollisionEntity *newCollisionEntity = new CollisionEntity(newEntity, type);
 
 
-//	if(type == CollisionSceneEntity::CHARACTER_CONTROLLER) {
+//	if(type == CollisionEntity::CHARACTER_CONTROLLER) {
 //		world->addCollisionObject(newCollisionEntity->collisionObject,btBroadphaseProxy::CharacterFilter, btBroadphaseProxy::StaticFilter|btBroadphaseProxy::DefaultFilter);		
 //		world->addCollisionObject(newCollisionEntity->collisionObject,btBroadphaseProxy::CharacterFilter, btBroadphaseProxy::StaticFilter|btBroadphaseProxy::DefaultFilter);		
 //	} else {
 //	} else {
 //		newCollisionEntity->collisionObject->setCollisionFlags(btCollisionObject::CF_NO_CONTACT_RESPONSE);
 //		newCollisionEntity->collisionObject->setCollisionFlags(btCollisionObject::CF_NO_CONTACT_RESPONSE);
@@ -233,7 +233,7 @@ CollisionSceneEntity *CollisionScene::trackCollision(SceneEntity *newEntity, int
 	return newCollisionEntity;
 	return newCollisionEntity;
 }
 }
 
 
-CollisionSceneEntity *CollisionScene::addCollisionChild(SceneEntity *newEntity, int type, int group) {
+CollisionEntity *CollisionScene::addCollisionChild(Entity *newEntity, int type, int group) {
 	addEntity(newEntity);
 	addEntity(newEntity);
 	return trackCollision(newEntity, type, group);
 	return trackCollision(newEntity, type, group);
 
 

+ 11 - 11
Modules/Contents/3DPhysics/Source/PolyCollisionSceneEntity.cpp

@@ -24,14 +24,14 @@ THE SOFTWARE.
 #include "PolyLogger.h"
 #include "PolyLogger.h"
 #include "PolyMesh.h"
 #include "PolyMesh.h"
 #include "PolyPolygon.h"
 #include "PolyPolygon.h"
-#include "PolySceneEntity.h"
+#include "PolyEntity.h"
 #include "PolySceneMesh.h"
 #include "PolySceneMesh.h"
 #include "btBulletCollisionCommon.h"
 #include "btBulletCollisionCommon.h"
 
 
 using namespace Polycode;
 using namespace Polycode;
 
 
-CollisionSceneEntity::CollisionSceneEntity(SceneEntity *entity, int type, bool compoundChildren) {
-	sceneEntity = entity;
+CollisionEntity::CollisionEntity(Entity *entity, int type, bool compoundChildren) {
+	this->entity = entity;
 	shape = NULL;
 	shape = NULL;
 	
 	
 	this->type = type;
 	this->type = type;
@@ -49,7 +49,7 @@ CollisionSceneEntity::CollisionSceneEntity(SceneEntity *entity, int type, bool c
 		 btCompoundShape* compoundShape = new btCompoundShape();
 		 btCompoundShape* compoundShape = new btCompoundShape();
 		 
 		 
 		 for(int i=0; i < entity->getNumChildren(); i++) {
 		 for(int i=0; i < entity->getNumChildren(); i++) {
-			SceneEntity *child = (SceneEntity*)entity->getChildAtIndex(i);
+			Entity *child = (Entity*)entity->getChildAtIndex(i);
 			btCollisionShape *childShape = createCollisionShape(child, child->collisionShapeType);
 			btCollisionShape *childShape = createCollisionShape(child, child->collisionShapeType);
 			btTransform transform;
 			btTransform transform;
 			
 			
@@ -84,7 +84,7 @@ CollisionSceneEntity::CollisionSceneEntity(SceneEntity *entity, int type, bool c
 //	}		
 //	}		
 }
 }
 
 
-btCollisionShape *CollisionSceneEntity::createCollisionShape(SceneEntity *entity, int type) {
+btCollisionShape *CollisionEntity::createCollisionShape(Entity *entity, int type) {
 	
 	
 	btCollisionShape *collisionShape = NULL;	
 	btCollisionShape *collisionShape = NULL;	
 	
 	
@@ -146,11 +146,11 @@ btCollisionShape *CollisionSceneEntity::createCollisionShape(SceneEntity *entity
 	return collisionShape; 
 	return collisionShape; 
 }
 }
 
 
-void CollisionSceneEntity::Update() {	
-	sceneEntity->rebuildTransformMatrix();
+void CollisionEntity::Update() {	
+	entity->rebuildTransformMatrix();
 
 
 	btScalar mat[16];		
 	btScalar mat[16];		
-	Matrix4 ent_mat = sceneEntity->getConcatenatedMatrix();
+	Matrix4 ent_mat = entity->getConcatenatedMatrix();
 	
 	
 	for(int i=0; i < 16; i++) {
 	for(int i=0; i < 16; i++) {
 			mat[i] = ent_mat.ml[i];
 			mat[i] = ent_mat.ml[i];
@@ -159,11 +159,11 @@ void CollisionSceneEntity::Update() {
 	collisionObject->getWorldTransform().setFromOpenGLMatrix(mat);
 	collisionObject->getWorldTransform().setFromOpenGLMatrix(mat);
 }
 }
 
 
-SceneEntity *CollisionSceneEntity::getSceneEntity() {
-	return sceneEntity;
+Entity *CollisionEntity::getEntity() {
+	return entity;
 }
 }
 
 
-CollisionSceneEntity::~CollisionSceneEntity() {
+CollisionEntity::~CollisionEntity() {
 	delete shape;
 	delete shape;
 	delete collisionObject;
 	delete collisionObject;
 }
 }

+ 32 - 32
Modules/Contents/3DPhysics/Source/PolyPhysicsScene.cpp

@@ -94,9 +94,9 @@ void PhysicsScene::setGravity(Vector3 gravity) {
 	physicsWorld->setGravity(btVector3(gravity.x, gravity.y, gravity.z));
 	physicsWorld->setGravity(btVector3(gravity.x, gravity.y, gravity.z));
 }
 }
 
 
-PhysicsSceneEntity *PhysicsScene::getPhysicsEntityByCollisionObject(btCollisionObject *object) {
+PhysicsEntity *PhysicsScene::getPhysicsEntityByCollisionObject(btCollisionObject *object) {
 	for(int i=0; i < physicsChildren.size(); i++) {
 	for(int i=0; i < physicsChildren.size(); i++) {
-		PhysicsSceneEntity *entity = physicsChildren[i];
+		PhysicsEntity *entity = physicsChildren[i];
 		if(entity->rigidBody == object) {
 		if(entity->rigidBody == object) {
 			return entity;
 			return entity;
 		}
 		}
@@ -159,38 +159,38 @@ void PhysicsScene::Update() {
 	
 	
 }
 }
 
 
-void PhysicsScene::setVelocity(SceneEntity *entity, Vector3 velocity) {
-	PhysicsSceneEntity *physicsEntity = getPhysicsEntityBySceneEntity(entity);
+void PhysicsScene::setVelocity(Entity *entity, Vector3 velocity) {
+	PhysicsEntity *physicsEntity = getPhysicsEntityByEntity(entity);
 	if(physicsEntity) {
 	if(physicsEntity) {
 		physicsEntity->setVelocity(velocity);
 		physicsEntity->setVelocity(velocity);
 	}
 	}
 }
 }
 
 
-void PhysicsScene::setSpin(SceneEntity *entity, Vector3 spin) {
-	PhysicsSceneEntity *physicsEntity = getPhysicsEntityBySceneEntity(entity);
+void PhysicsScene::setSpin(Entity *entity, Vector3 spin) {
+	PhysicsEntity *physicsEntity = getPhysicsEntityByEntity(entity);
 	if(physicsEntity) {
 	if(physicsEntity) {
 		physicsEntity->setSpin(spin);
 		physicsEntity->setSpin(spin);
 	}
 	}
 }
 }
 
 
 
 
-void PhysicsScene::warpEntity(SceneEntity *entity, Vector3 position, bool resetRotation) {
-	PhysicsSceneEntity *physicsEntity = getPhysicsEntityBySceneEntity(entity);
+void PhysicsScene::warpEntity(Entity *entity, Vector3 position, bool resetRotation) {
+	PhysicsEntity *physicsEntity = getPhysicsEntityByEntity(entity);
 	if(physicsEntity) {
 	if(physicsEntity) {
 		physicsEntity->rigidBody->setActivationState(DISABLE_DEACTIVATION);	
 		physicsEntity->rigidBody->setActivationState(DISABLE_DEACTIVATION);	
 		physicsEntity->warpTo(position, resetRotation);
 		physicsEntity->warpTo(position, resetRotation);
 	}
 	}
 }
 }
 
 
-void PhysicsScene::applyImpulse(SceneEntity *entity, Vector3 force, Vector3 point) {
-	PhysicsSceneEntity *physicsEntity = getPhysicsEntityBySceneEntity(entity);	
+void PhysicsScene::applyImpulse(Entity *entity, Vector3 force, Vector3 point) {
+	PhysicsEntity *physicsEntity = getPhysicsEntityByEntity(entity);	
 	if(physicsEntity) {
 	if(physicsEntity) {
 		physicsEntity->rigidBody->setActivationState(DISABLE_DEACTIVATION);		
 		physicsEntity->rigidBody->setActivationState(DISABLE_DEACTIVATION);		
 		physicsEntity->applyImpulse(force, point);
 		physicsEntity->applyImpulse(force, point);
 	}
 	}
 }
 }
 
 
-PhysicsCharacter *PhysicsScene::addCharacterChild(SceneEntity *newEntity,Number mass, Number friction, Number stepSize, int group) {
+PhysicsCharacter *PhysicsScene::addCharacterChild(Entity *newEntity,Number mass, Number friction, Number stepSize, int group) {
 	addEntity(newEntity);	
 	addEntity(newEntity);	
 	PhysicsCharacter *newPhysicsEntity = new PhysicsCharacter(newEntity, mass, friction, stepSize);
 	PhysicsCharacter *newPhysicsEntity = new PhysicsCharacter(newEntity, mass, friction, stepSize);
 	
 	
@@ -230,7 +230,7 @@ void PhysicsScene::removeCharacterChild(PhysicsCharacter *character) {
 }
 }
 
 
 
 
-PhysicsVehicle *PhysicsScene::addVehicleChild(SceneEntity *newEntity, Number mass, Number friction, int group) {
+PhysicsVehicle *PhysicsScene::addVehicleChild(Entity *newEntity, Number mass, Number friction, int group) {
 	addEntity(newEntity);		
 	addEntity(newEntity);		
 	
 	
 	btDefaultVehicleRaycaster *m_vehicleRayCaster = new btDefaultVehicleRaycaster(physicsWorld);
 	btDefaultVehicleRaycaster *m_vehicleRayCaster = new btDefaultVehicleRaycaster(physicsWorld);
@@ -259,10 +259,10 @@ PhysicsVehicle *PhysicsScene::addVehicleChild(SceneEntity *newEntity, Number mas
 	return newPhysicsEntity;
 	return newPhysicsEntity;
 }
 }
 
 
-void PhysicsScene::removePhysicsChild(SceneEntity *entity) {
-	PhysicsSceneEntity *ent = getPhysicsEntityBySceneEntity(entity);
+void PhysicsScene::removePhysicsChild(Entity *entity) {
+	PhysicsEntity *ent = getPhysicsEntityByEntity(entity);
 	if(ent) {
 	if(ent) {
-		if(ent->getType() == PhysicsSceneEntity::CHARACTER_CONTROLLER) {
+		if(ent->getType() == PhysicsEntity::CHARACTER_CONTROLLER) {
 			removeCharacterChild((PhysicsCharacter *)ent);
 			removeCharacterChild((PhysicsCharacter *)ent);
 		} else {
 		} else {
 		
 		
@@ -285,8 +285,8 @@ void PhysicsScene::removePhysicsChild(SceneEntity *entity) {
 	CollisionScene::removeEntity(entity);
 	CollisionScene::removeEntity(entity);
 }
 }
 
 
-void PhysicsScene::removeEntity(SceneEntity *entity) {
-	PhysicsSceneEntity *ent = getPhysicsEntityBySceneEntity(entity);
+void PhysicsScene::removeEntity(Entity *entity) {
+	PhysicsEntity *ent = getPhysicsEntityByEntity(entity);
 	if(ent) {
 	if(ent) {
 		removePhysicsChild(entity);
 		removePhysicsChild(entity);
 	} else {
 	} else {
@@ -330,9 +330,9 @@ void PhysicsGenericConstraint::setAngularUpperLimit(Vector3 limit) {
 	btConstraint->setAngularUpperLimit(btLimit);
 	btConstraint->setAngularUpperLimit(btLimit);
 }
 }
 
 
-PhysicsGenericConstraint *PhysicsScene::createGenericConstraint(SceneEntity *entity) {
+PhysicsGenericConstraint *PhysicsScene::createGenericConstraint(Entity *entity) {
 
 
-	PhysicsSceneEntity *pEnt = getPhysicsEntityBySceneEntity(entity);
+	PhysicsEntity *pEnt = getPhysicsEntityByEntity(entity);
 	if(!pEnt) {
 	if(!pEnt) {
 		return NULL;
 		return NULL;
 	}
 	}
@@ -348,8 +348,8 @@ PhysicsGenericConstraint *PhysicsScene::createGenericConstraint(SceneEntity *ent
 	return constraint;
 	return constraint;
 }
 }
 
 
-PhysicsHingeConstraint * PhysicsScene::createHingeConstraint(SceneEntity *entity, Vector3 pivot, Vector3 axis, Number minLimit, Number maxLimit) {
-	PhysicsSceneEntity *pEnt = getPhysicsEntityBySceneEntity(entity);
+PhysicsHingeConstraint * PhysicsScene::createHingeConstraint(Entity *entity, Vector3 pivot, Vector3 axis, Number minLimit, Number maxLimit) {
+	PhysicsEntity *pEnt = getPhysicsEntityByEntity(entity);
 	if(!pEnt) {
 	if(!pEnt) {
 		return NULL;
 		return NULL;
 	}
 	}
@@ -367,10 +367,10 @@ PhysicsHingeConstraint * PhysicsScene::createHingeConstraint(SceneEntity *entity
 	return constraint;
 	return constraint;
 }
 }
 
 
-PhysicsHingeConstraint *PhysicsScene::createHingeJoint(SceneEntity *entity1, SceneEntity *entity2, Vector3 pivot1, Vector3 axis1, Vector3 pivot2, Vector3 axis2, Number minLimit, Number maxLimit) {
+PhysicsHingeConstraint *PhysicsScene::createHingeJoint(Entity *entity1, Entity *entity2, Vector3 pivot1, Vector3 axis1, Vector3 pivot2, Vector3 axis2, Number minLimit, Number maxLimit) {
 	
 	
-	PhysicsSceneEntity *pEnt1 = getPhysicsEntityBySceneEntity(entity1);
-	PhysicsSceneEntity *pEnt2 = getPhysicsEntityBySceneEntity(entity2);
+	PhysicsEntity *pEnt1 = getPhysicsEntityByEntity(entity1);
+	PhysicsEntity *pEnt2 = getPhysicsEntityByEntity(entity2);
 		
 		
 	if(!pEnt1 || !pEnt2) {
 	if(!pEnt1 || !pEnt2) {
 		return NULL;
 		return NULL;
@@ -394,26 +394,26 @@ PhysicsHingeConstraint *PhysicsScene::createHingeJoint(SceneEntity *entity1, Sce
 }
 }
 
 
 
 
-PhysicsSceneEntity *PhysicsScene::getPhysicsEntityBySceneEntity(SceneEntity *entity) {
-	PhysicsSceneEntity *retEntity = NULL;
+PhysicsEntity *PhysicsScene::getPhysicsEntityByEntity(Entity *entity) {
+	PhysicsEntity *retEntity = NULL;
 	for(int i=0; i < physicsChildren.size(); i++) {
 	for(int i=0; i < physicsChildren.size(); i++) {
-		if(physicsChildren[i]->getSceneEntity() == entity) {
+		if(physicsChildren[i]->getEntity() == entity) {
 			retEntity = physicsChildren[i];
 			retEntity = physicsChildren[i];
 		}	
 		}	
 	}
 	}
 	return retEntity;
 	return retEntity;
 }
 }
 
 
-void PhysicsScene::wakeUp(SceneEntity *entity) {
-	PhysicsSceneEntity *pEnt = getPhysicsEntityBySceneEntity(entity);
+void PhysicsScene::wakeUp(Entity *entity) {
+	PhysicsEntity *pEnt = getPhysicsEntityByEntity(entity);
 	if(!pEnt) {
 	if(!pEnt) {
 		return;
 		return;
 	}
 	}
 	pEnt->rigidBody->setActivationState(DISABLE_DEACTIVATION);
 	pEnt->rigidBody->setActivationState(DISABLE_DEACTIVATION);
 }
 }
 
 
-PhysicsSceneEntity *PhysicsScene::trackPhysicsChild(SceneEntity *newEntity, int type, Number mass, Number friction, Number restitution, int group, bool compoundChildren) {
-	PhysicsSceneEntity *newPhysicsEntity = new PhysicsSceneEntity(newEntity, type, mass, friction,restitution, compoundChildren);
+PhysicsEntity *PhysicsScene::trackPhysicsChild(Entity *newEntity, int type, Number mass, Number friction, Number restitution, int group, bool compoundChildren) {
+	PhysicsEntity *newPhysicsEntity = new PhysicsEntity(newEntity, type, mass, friction,restitution, compoundChildren);
 	physicsWorld->addRigidBody(newPhysicsEntity->rigidBody, group,  btBroadphaseProxy::AllFilter); //btBroadphaseProxy::StaticFilter|btBroadphaseProxy::DefaultFilter);	
 	physicsWorld->addRigidBody(newPhysicsEntity->rigidBody, group,  btBroadphaseProxy::AllFilter); //btBroadphaseProxy::StaticFilter|btBroadphaseProxy::DefaultFilter);	
 //	world->addCollisionObject(newPhysicsEntity->collisionObject, group);	
 //	world->addCollisionObject(newPhysicsEntity->collisionObject, group);	
 	//newPhysicsEntity->rigidBody->setActivationState(ISLAND_SLEEPING);	
 	//newPhysicsEntity->rigidBody->setActivationState(ISLAND_SLEEPING);	
@@ -422,7 +422,7 @@ PhysicsSceneEntity *PhysicsScene::trackPhysicsChild(SceneEntity *newEntity, int
 	return newPhysicsEntity;	
 	return newPhysicsEntity;	
 }
 }
 
 
-PhysicsSceneEntity *PhysicsScene::addPhysicsChild(SceneEntity *newEntity, int type, Number mass, Number friction, Number restitution, int group, bool compoundChildren) {
+PhysicsEntity *PhysicsScene::addPhysicsChild(Entity *newEntity, int type, Number mass, Number friction, Number restitution, int group, bool compoundChildren) {
 	addEntity(newEntity);	
 	addEntity(newEntity);	
 	return trackPhysicsChild(newEntity, type, mass, friction, restitution, group, compoundChildren);	
 	return trackPhysicsChild(newEntity, type, mass, friction, restitution, group, compoundChildren);	
 }
 }

+ 19 - 23
Modules/Contents/3DPhysics/Source/PolyPhysicsSceneEntity.cpp

@@ -24,11 +24,11 @@ THE SOFTWARE.
 #include "BulletDynamics/Character/btKinematicCharacterController.h"
 #include "BulletDynamics/Character/btKinematicCharacterController.h"
 #include "BulletCollision/CollisionDispatch/btGhostObject.h"
 #include "BulletCollision/CollisionDispatch/btGhostObject.h"
 #include "PolyMatrix4.h"
 #include "PolyMatrix4.h"
-#include "PolySceneEntity.h"
+#include "PolyEntity.h"
 
 
 using namespace Polycode;
 using namespace Polycode;
 
 
-PhysicsVehicle::PhysicsVehicle(SceneEntity *entity, Number mass, Number friction,btDefaultVehicleRaycaster *_rayCaster): PhysicsSceneEntity(entity, PhysicsSceneEntity::SHAPE_BOX, mass, friction, 1), rayCaster(_rayCaster), vehicle(NULL) {
+PhysicsVehicle::PhysicsVehicle(Entity *entity, Number mass, Number friction,btDefaultVehicleRaycaster *_rayCaster): PhysicsEntity(entity, PhysicsEntity::SHAPE_BOX, mass, friction, 1), rayCaster(_rayCaster), vehicle(NULL) {
 	
 	
 }
 }
 
 
@@ -43,7 +43,7 @@ void PhysicsVehicle::warpVehicle(Vector3 position) {
 
 
 }
 }
 
 
-void PhysicsVehicle::addWheel(SceneEntity *entity, Vector3 connection, Vector3 direction, Vector3 axle, Number suspentionRestLength, Number wheelRadius, bool isFrontWheel,Number  suspensionStiffness, Number  suspensionDamping, Number suspensionCompression, Number  wheelFriction, Number rollInfluence) {
+void PhysicsVehicle::addWheel(Entity *entity, Vector3 connection, Vector3 direction, Vector3 axle, Number suspentionRestLength, Number wheelRadius, bool isFrontWheel,Number  suspensionStiffness, Number  suspensionDamping, Number suspensionCompression, Number  wheelFriction, Number rollInfluence) {
 	vehicle->addWheel(btVector3(connection.x, connection.y, connection.z),
 	vehicle->addWheel(btVector3(connection.x, connection.y, connection.z),
 					btVector3(direction.x, direction.y, direction.z),
 					btVector3(direction.x, direction.y, direction.z),
 					btVector3(axle.x, axle.y, axle.z),	
 					btVector3(axle.x, axle.y, axle.z),	
@@ -106,7 +106,7 @@ void PhysicsVehicle::Update() {
 		wheel_info.wheelEntity->setTransformByMatrixPure(m);		
 		wheel_info.wheelEntity->setTransformByMatrixPure(m);		
 	}
 	}
 	
 	
-	PhysicsSceneEntity::Update();
+	PhysicsEntity::Update();
 }
 }
 
 
 PhysicsVehicle::~PhysicsVehicle() {
 PhysicsVehicle::~PhysicsVehicle() {
@@ -117,7 +117,7 @@ PhysicsVehicle::~PhysicsVehicle() {
 	}
 	}
 }
 }
 
 
-PhysicsCharacter::PhysicsCharacter(SceneEntity *entity, Number mass, Number friction, Number stepSize) : PhysicsSceneEntity(entity, PhysicsSceneEntity::CHARACTER_CONTROLLER, mass, friction, 1) {	
+PhysicsCharacter::PhysicsCharacter(Entity *entity, Number mass, Number friction, Number stepSize) : PhysicsEntity(entity, PhysicsEntity::CHARACTER_CONTROLLER, mass, friction, 1) {	
 	ghostObject = new btPairCachingGhostObject();
 	ghostObject = new btPairCachingGhostObject();
 	
 	
 	Vector3 pos = entity->getPosition();	
 	Vector3 pos = entity->getPosition();	
@@ -171,9 +171,9 @@ bool PhysicsCharacter::onGround() {
 
 
 void PhysicsCharacter::Update() {
 void PhysicsCharacter::Update() {
 	btVector3 pos = ghostObject->getWorldTransform().getOrigin();
 	btVector3 pos = ghostObject->getWorldTransform().getOrigin();
-	sceneEntity->setPosition(pos.x(), pos.y(), pos.z());
-	sceneEntity->rebuildTransformMatrix();
-	sceneEntity->dirtyMatrix(true);
+	entity->setPosition(pos.x(), pos.y(), pos.z());
+	entity->rebuildTransformMatrix();
+	entity->dirtyMatrix(true);
 }
 }
 
 
 PhysicsCharacter::~PhysicsCharacter() {
 PhysicsCharacter::~PhysicsCharacter() {
@@ -181,7 +181,7 @@ PhysicsCharacter::~PhysicsCharacter() {
 	delete ghostObject;	
 	delete ghostObject;	
 }
 }
 
 
-PhysicsSceneEntity::PhysicsSceneEntity(SceneEntity *entity, int type, Number mass, Number friction, Number restitution, bool compoundChildren) : CollisionSceneEntity(entity, type, compoundChildren) {
+PhysicsEntity::PhysicsEntity(Entity *entity, int type, Number mass, Number friction, Number restitution, bool compoundChildren) : CollisionEntity(entity, type, compoundChildren) {
 
 
 	this->mass = mass;
 	this->mass = mass;
 	btVector3 localInertia(0,0,0);
 	btVector3 localInertia(0,0,0);
@@ -220,15 +220,15 @@ PhysicsSceneEntity::PhysicsSceneEntity(SceneEntity *entity, int type, Number mas
 	}
 	}
 }
 }
 
 
-void PhysicsSceneEntity::setFriction(Number friction) {
+void PhysicsEntity::setFriction(Number friction) {
 		rigidBody->setFriction(friction);
 		rigidBody->setFriction(friction);
 }
 }
 
 
-void PhysicsSceneEntity::setMass(Number mass) {
+void PhysicsEntity::setMass(Number mass) {
 	rigidBody->setMassProps(mass, btVector3(0.0, 0.0, 0.0));
 	rigidBody->setMassProps(mass, btVector3(0.0, 0.0, 0.0));
 }
 }
 
 
-void PhysicsSceneEntity::Update() {		
+void PhysicsEntity::Update() {		
 	Matrix4 m;
 	Matrix4 m;
 		
 		
 	btScalar* mat = (btScalar*) malloc(sizeof(btScalar) * 16);				
 	btScalar* mat = (btScalar*) malloc(sizeof(btScalar) * 16);				
@@ -240,33 +240,33 @@ void PhysicsSceneEntity::Update() {
 	
 	
 	free(mat);
 	free(mat);
 	
 	
-	sceneEntity->setTransformByMatrixPure(m);
+	entity->setTransformByMatrixPure(m);
 //	collisionObject->getWorldTransform().setFromOpenGLMatrix(mat);
 //	collisionObject->getWorldTransform().setFromOpenGLMatrix(mat);
 }
 }
 
 
-void PhysicsSceneEntity::setVelocity(Vector3 velocity) {
+void PhysicsEntity::setVelocity(Vector3 velocity) {
 	rigidBody->setLinearVelocity(btVector3(velocity.x, velocity.y, velocity.z));
 	rigidBody->setLinearVelocity(btVector3(velocity.x, velocity.y, velocity.z));
 //	rigidBody->applyForce(btVector3(velocity.x, velocity.y, velocity.z), btVector3(0,0,0));
 //	rigidBody->applyForce(btVector3(velocity.x, velocity.y, velocity.z), btVector3(0,0,0));
 }
 }
 
 
-void PhysicsSceneEntity::setSpin(Vector3 spin) {
+void PhysicsEntity::setSpin(Vector3 spin) {
 	btVector3 angularVel = btVector3(spin.x, spin.y, spin.z);	
 	btVector3 angularVel = btVector3(spin.x, spin.y, spin.z);	
 	rigidBody->setAngularVelocity(angularVel);
 	rigidBody->setAngularVelocity(angularVel);
 }
 }
 
 
-void PhysicsSceneEntity::applyImpulse(Vector3 direction, Vector3 point) {
+void PhysicsEntity::applyImpulse(Vector3 direction, Vector3 point) {
 	btVector3 imp = btVector3(direction.x, direction.y, direction.z);
 	btVector3 imp = btVector3(direction.x, direction.y, direction.z);
 	btVector3 pos = btVector3(point.x, point.y, point.z);
 	btVector3 pos = btVector3(point.x, point.y, point.z);
 		 
 		 
 	rigidBody->applyImpulse(imp, pos);
 	rigidBody->applyImpulse(imp, pos);
 }
 }
 
 
-void PhysicsSceneEntity::warpTo(Vector3 position, bool resetRotation) {
+void PhysicsEntity::warpTo(Vector3 position, bool resetRotation) {
 	btTransform transform;
 	btTransform transform;
 	transform.setIdentity();
 	transform.setIdentity();
 	
 	
 	if(!resetRotation) {
 	if(!resetRotation) {
-		Matrix4 ent_mat = sceneEntity->getConcatenatedMatrix();	
+		Matrix4 ent_mat = entity->getConcatenatedMatrix();	
 		btScalar mat[16];
 		btScalar mat[16];
 		for(int i=0; i < 16; i++) {
 		for(int i=0; i < 16; i++) {
 			mat[i] = ent_mat.ml[i];
 			mat[i] = ent_mat.ml[i];
@@ -278,11 +278,7 @@ void PhysicsSceneEntity::warpTo(Vector3 position, bool resetRotation) {
 	rigidBody->setCenterOfMassTransform(transform);
 	rigidBody->setCenterOfMassTransform(transform);
 }
 }
 
 
-SceneEntity *PhysicsSceneEntity::getSceneEntity() {
-	return sceneEntity;
-}
-
-PhysicsSceneEntity::~PhysicsSceneEntity() {
+PhysicsEntity::~PhysicsEntity() {
 	delete rigidBody;
 	delete rigidBody;
 	delete myMotionState;	
 	delete myMotionState;	
 }
 }

+ 10 - 10
Modules/Contents/UI/Include/PolyUIBox.h

@@ -22,7 +22,7 @@
 
 
 #pragma once
 #pragma once
 #include "PolyGlobals.h"
 #include "PolyGlobals.h"
-#include "PolyScreenImage.h"
+#include "PolySceneImage.h"
 #include "PolyUIElement.h"
 #include "PolyUIElement.h"
 
 
 namespace Polycode {
 namespace Polycode {
@@ -41,16 +41,16 @@ namespace Polycode {
 		Number b;
 		Number b;
 		Number l;
 		Number l;
 		
 		
-		ScreenImage *tlImage;
-		ScreenImage *trImage;		
-		ScreenImage *blImage;		
-		ScreenImage *brImage;			
+		SceneImage *tlImage;
+		SceneImage *trImage;		
+		SceneImage *blImage;		
+		SceneImage *brImage;			
 		
 		
-		ScreenImage *centerImage;
+		SceneImage *centerImage;
 		
 		
-		ScreenImage *tImage;
-		ScreenImage *rImage;
-		ScreenImage *bImage;
-		ScreenImage *lImage;		
+		SceneImage *tImage;
+		SceneImage *rImage;
+		SceneImage *bImage;
+		SceneImage *lImage;		
 	};
 	};
 }
 }

+ 4 - 4
Modules/Contents/UI/Include/PolyUIButton.h

@@ -22,9 +22,9 @@
 
 
 #pragma once
 #pragma once
 #include "PolyGlobals.h"
 #include "PolyGlobals.h"
-#include "PolyScreenLabel.h"
-#include "PolyScreenShape.h"
-#include "PolyScreenEntity.h"
+#include "PolySceneLabel.h"
+#include "PolyScenePrimitive.h"
+#include "PolyEntity.h"
 #include "PolyUIEvent.h"
 #include "PolyUIEvent.h"
 #include "PolyUIBox.h"
 #include "PolyUIBox.h"
 #include "PolyUIElement.h"
 #include "PolyUIElement.h"
@@ -51,7 +51,7 @@ namespace Polycode {
 			Number labelYPos;
 			Number labelYPos;
 			UIBox *buttonRect;
 			UIBox *buttonRect;
 			UIBox *buttonFocusedRect;		
 			UIBox *buttonFocusedRect;		
-			ScreenLabel *buttonLabel;
+			SceneLabel *buttonLabel;
 			bool pressedDown;
 			bool pressedDown;
 	};
 	};
 }
 }

+ 7 - 7
Modules/Contents/UI/Include/PolyUICheckBox.h

@@ -22,10 +22,10 @@
 
 
 #pragma once
 #pragma once
 #include "PolyGlobals.h"
 #include "PolyGlobals.h"
-#include "PolyScreenImage.h"
-#include "PolyScreenLabel.h"
-#include "PolyScreenShape.h"
-#include "PolyScreenEntity.h"
+#include "PolySceneImage.h"
+#include "PolySceneLabel.h"
+#include "PolyScenePrimitive.h"
+#include "PolyEntity.h"
 #include "PolyUIEvent.h"
 #include "PolyUIEvent.h"
 #include "PolyFont.h"
 #include "PolyFont.h"
 #include "PolyUIElement.h"
 #include "PolyUIElement.h"
@@ -45,8 +45,8 @@ namespace Polycode {
 			
 			
 		private:
 		private:
 			bool checked;
 			bool checked;
-			ScreenLabel *captionLabel;
-			ScreenImage *buttonImageChecked;
-			ScreenImage *buttonImageUnchecked;			
+			SceneLabel *captionLabel;
+			SceneImage *buttonImageChecked;
+			SceneImage *buttonImageUnchecked;			
 	};
 	};
 }
 }

+ 13 - 13
Modules/Contents/UI/Include/PolyUIColorBox.h

@@ -22,10 +22,10 @@
 
 
 #pragma once
 #pragma once
 #include "PolyGlobals.h"
 #include "PolyGlobals.h"
-#include "PolyScreenImage.h"
-#include "PolyScreenLabel.h"
-#include "PolyScreenShape.h"
-#include "PolyScreenEntity.h"
+#include "PolySceneImage.h"
+#include "PolySceneLabel.h"
+#include "PolyScenePrimitive.h"
+#include "PolyEntity.h"
 #include "PolyUIEvent.h"
 #include "PolyUIEvent.h"
 #include "PolyUITextInput.h"
 #include "PolyUITextInput.h"
 #include "PolyUIWindow.h"
 #include "PolyUIWindow.h"
@@ -83,17 +83,17 @@ namespace Polycode {
 			UITextInput *bTextInput;
 			UITextInput *bTextInput;
 			UITextInput *aTextInput;						
 			UITextInput *aTextInput;						
 									
 									
-			ScreenImage *mainFrame;
-			ScreenImage *mainBg;			
-			ScreenImage *hueFrame;
-			ScreenImage *hueSelector;
-			ScreenImage *mainSelector;	
+			SceneImage *mainFrame;
+			SceneImage *mainBg;			
+			SceneImage *hueFrame;
+			SceneImage *hueSelector;
+			SceneImage *mainSelector;	
 			
 			
 			UIHSlider *alphaSlider;
 			UIHSlider *alphaSlider;
 			
 			
-			ScreenShape *mainColorRect;
+			ScenePrimitive *mainColorRect;
 			
 			
-			vector<ScreenLabel *> junkLabels; // Kept only to delete
+			vector<SceneLabel *> junkLabels; // Kept only to delete
 	};
 	};
 
 
 	class _PolyExport UIColorBox : public UIElement {
 	class _PolyExport UIColorBox : public UIElement {
@@ -116,8 +116,8 @@ namespace Polycode {
 			Color selectedColor;
 			Color selectedColor;
 				
 				
 			UIBox *frameImage;
 			UIBox *frameImage;
-			ScreenShape *bgImage;
-			ScreenShape *colorShape;			
+			ScenePrimitive *bgImage;
+			ScenePrimitive *colorShape;			
 		
 		
 	};
 	};
 }
 }

+ 6 - 6
Modules/Contents/UI/Include/PolyUIComboBox.h

@@ -22,10 +22,10 @@
 
 
 #pragma once
 #pragma once
 #include "PolyGlobals.h"
 #include "PolyGlobals.h"
-#include "PolyScreenImage.h"
-#include "PolyScreenLabel.h"
-#include "PolyScreenShape.h"
-#include "PolyScreenEntity.h"
+#include "PolySceneImage.h"
+#include "PolySceneLabel.h"
+#include "PolyScenePrimitive.h"
+#include "PolyEntity.h"
 #include "PolyUIEvent.h"
 #include "PolyUIEvent.h"
 #include "PolyUIBox.h"
 #include "PolyUIBox.h"
 #include "PolyUIMenu.h"
 #include "PolyUIMenu.h"
@@ -74,7 +74,7 @@ namespace Polycode {
 			std::vector<UIComboBoxItem*> items;
 			std::vector<UIComboBoxItem*> items;
 			int selectedIndex;
 			int selectedIndex;
 			
 			
-			ScreenLabel *selectedLabel;
+			SceneLabel *selectedLabel;
 			Number comboHeight;
 			Number comboHeight;
 			Number comboWidth;
 			Number comboWidth;
 			Number dropDownX;
 			Number dropDownX;
@@ -85,6 +85,6 @@ namespace Polycode {
 			Number nextItemHeight;
 			Number nextItemHeight;
 
 
 			UIBox *bgBox;
 			UIBox *bgBox;
-			ScreenImage *dropDownImage;
+			SceneImage *dropDownImage;
 	};
 	};
 }
 }

+ 2 - 2
Modules/Contents/UI/Include/PolyUIElement.h

@@ -22,7 +22,7 @@
 
 
 #pragma once
 #pragma once
 #include "PolyGlobals.h"
 #include "PolyGlobals.h"
-#include "PolyScreenEntity.h"
+#include "PolyEntity.h"
 
 
 namespace Polycode {
 namespace Polycode {
 	/*
 	/*
@@ -30,7 +30,7 @@ namespace Polycode {
 	 *
 	 *
 	 * processInputEvent is set to true by default.
 	 * processInputEvent is set to true by default.
 	 */
 	 */
-	class _PolyExport UIElement : public ScreenEntity {
+	class _PolyExport UIElement : public Entity {
 		public:
 		public:
 			UIElement();
 			UIElement();
 			UIElement(Number width, Number height);
 			UIElement(Number width, Number height);

+ 3 - 3
Modules/Contents/UI/Include/PolyUIFileDialog.h

@@ -51,10 +51,10 @@ namespace Polycode {
 			void Deselect();
 			void Deselect();
 
 
 			bool canSelect;
 			bool canSelect;
-			ScreenShape *bg;
-			ScreenLabel *label;
+			ScenePrimitive *bg;
+			SceneLabel *label;
 			OSFileEntry fileEntry;
 			OSFileEntry fileEntry;
-			ScreenImage *icon;
+			SceneImage *icon;
 	};
 	};
 
 
 	/**
 	/**

+ 4 - 4
Modules/Contents/UI/Include/PolyUIHSizer.h

@@ -22,7 +22,7 @@
 
 
 #pragma once
 #pragma once
 #include "PolyGlobals.h"
 #include "PolyGlobals.h"
-#include "PolyScreenShape.h"
+#include "PolyScenePrimitive.h"
 #include "PolyUIElement.h"
 #include "PolyUIElement.h"
 
 
 namespace Polycode {
 namespace Polycode {
@@ -47,7 +47,7 @@ namespace Polycode {
 			
 			
 		protected:
 		protected:
 		
 		
-			ScreenEntity *childElements;			
+			Entity *childElements;			
 			Number mainWidth;
 			Number mainWidth;
 			
 			
 			CoreInput *coreInput;
 			CoreInput *coreInput;
@@ -58,8 +58,8 @@ namespace Polycode {
 			
 			
 			bool leftSizer;
 			bool leftSizer;
 			
 			
-			ScreenShape *separatorHitShape;
-			ScreenShape *separatorBgShape;
+			ScenePrimitive *separatorHitShape;
+			ScenePrimitive *separatorBgShape;
 			
 			
 			UIElement *firstElement;
 			UIElement *firstElement;
 			UIElement *secondElement;			
 			UIElement *secondElement;			

+ 5 - 5
Modules/Contents/UI/Include/PolyUIHSlider.h

@@ -22,9 +22,9 @@
 
 
 #pragma once
 #pragma once
 #include "PolyGlobals.h"
 #include "PolyGlobals.h"
-#include "PolyScreenLabel.h"
-#include "PolyScreenShape.h"
-#include "PolyScreenEntity.h"
+#include "PolySceneLabel.h"
+#include "PolyScenePrimitive.h"
+#include "PolyEntity.h"
 #include "PolyUIEvent.h"
 #include "PolyUIEvent.h"
 #include "PolyUIBox.h"
 #include "PolyUIBox.h"
 #include "PolyUIElement.h"
 #include "PolyUIElement.h"
@@ -58,13 +58,13 @@ namespace Polycode {
 			Number bgHeight;
 			Number bgHeight;
 			
 			
 			UIBox *bgRect;
 			UIBox *bgRect;
-			ScreenImage *gripRect;
+			SceneImage *gripRect;
 			
 			
 			Number sliderValue;
 			Number sliderValue;
 			Number startValue;
 			Number startValue;
 			Number endValue;
 			Number endValue;
 			Number sliderWidth;
 			Number sliderWidth;
 			
 			
-			ScreenShape *bgHitBox;
+			ScenePrimitive *bgHitBox;
 	};
 	};
 }
 }

+ 5 - 5
Modules/Contents/UI/Include/PolyUIImageButton.h

@@ -22,9 +22,9 @@
 
 
 #pragma once
 #pragma once
 #include "PolyGlobals.h"
 #include "PolyGlobals.h"
-#include "PolyScreenImage.h"
-#include "PolyScreenShape.h"
-#include "PolyScreenEntity.h"
+#include "PolySceneImage.h"
+#include "PolyScenePrimitive.h"
+#include "PolyEntity.h"
 #include "PolyUIEvent.h"
 #include "PolyUIEvent.h"
 #include "PolyUIElement.h"
 #include "PolyUIElement.h"
 
 
@@ -38,8 +38,8 @@ namespace Polycode {
 			void handleEvent(Event *event);
 			void handleEvent(Event *event);
 				
 				
 		private:
 		private:
-			ScreenShape *buttonRect;
-			ScreenImage *buttonImage;
+			ScenePrimitive *buttonRect;
+			SceneImage *buttonImage;
 			bool pressedDown;
 			bool pressedDown;
 	};
 	};
 }
 }

+ 5 - 5
Modules/Contents/UI/Include/PolyUIMenu.h

@@ -22,11 +22,11 @@
 
 
 #pragma once
 #pragma once
 #include "PolyUIElement.h"
 #include "PolyUIElement.h"
-#include "PolyScreenLabel.h"
+#include "PolySceneLabel.h"
 #include "PolyUIBox.h"
 #include "PolyUIBox.h"
 
 
 namespace Polycode {
 namespace Polycode {
-	class ScreenLine;
+	class SceneLine;
 
 
 	/**
 	/**
 	 * An single selectable entry in an UIMenu
 	 * An single selectable entry in an UIMenu
@@ -59,7 +59,7 @@ namespace Polycode {
 		protected:
 		protected:
 			UIMenuItem();
 			UIMenuItem();
 
 
-			ScreenLabel *itemLabel;
+			SceneLabel *itemLabel;
 			friend class UIMenu;
 			friend class UIMenu;
 	};
 	};
 
 
@@ -70,7 +70,7 @@ namespace Polycode {
 		bool isSelectable();
 		bool isSelectable();
 
 
 	protected:
 	protected:
-		ScreenLine* line;
+		SceneLine* line;
 	};
 	};
 
 
 	/** 
 	/** 
@@ -151,7 +151,7 @@ namespace Polycode {
 	};
 	};
 
 
 
 
-	class _PolyExport UIGlobalMenu : public ScreenEntity {
+	class _PolyExport UIGlobalMenu : public Entity {
 		public:
 		public:
 			UIGlobalMenu();
 			UIGlobalMenu();
 			~UIGlobalMenu();
 			~UIGlobalMenu();

+ 6 - 6
Modules/Contents/UI/Include/PolyUIMenuBar.h

@@ -22,9 +22,9 @@
 
 
 #pragma once
 #pragma once
 #include "PolyGlobals.h"
 #include "PolyGlobals.h"
-#include "PolyScreenLabel.h"
-#include "PolyScreenShape.h"
-#include "PolyScreenEntity.h"
+#include "PolySceneLabel.h"
+#include "PolyScenePrimitive.h"
+#include "PolyEntity.h"
 #include "PolyUIEvent.h"
 #include "PolyUIEvent.h"
 #include "PolyUIBox.h"
 #include "PolyUIBox.h"
 #include "PolyUIMenu.h"
 #include "PolyUIMenu.h"
@@ -55,8 +55,8 @@ namespace Polycode {
 			void Select();
 			void Select();
 			void Deselect();
 			void Deselect();
 
 
-			ScreenShape *bg;
-			ScreenLabel *label;
+			ScenePrimitive *bg;
+			SceneLabel *label;
 
 
 			std::vector<UIMenuBarEntryItem> items;
 			std::vector<UIMenuBarEntryItem> items;
 
 
@@ -82,7 +82,7 @@ namespace Polycode {
 			bool holdingMouse;
 			bool holdingMouse;
 
 
 			String selectedItem;
 			String selectedItem;
-			ScreenShape *bgShape;
+			ScenePrimitive *bgShape;
 			std::vector<UIMenuBarEntry*> entries;
 			std::vector<UIMenuBarEntry*> entries;
 			UIMenuBarEntry *currentEntry;
 			UIMenuBarEntry *currentEntry;
 	};
 	};

+ 3 - 3
Modules/Contents/UI/Include/PolyUIScrollContainer.h

@@ -38,13 +38,13 @@ namespace Polycode {
 	public:
 	public:
         /**
         /**
         * Create a scroll container.
         * Create a scroll container.
-        * @param scrolledEntity The ScreenEntity that should be scrolled using this element.
+        * @param scrolledEntity The Entity that should be scrolled using this element.
         * @param hScroll Whether the child should be scrolled horizontally.
         * @param hScroll Whether the child should be scrolled horizontally.
         * @param vScroll Whether the child should be scrolled vertically.
         * @param vScroll Whether the child should be scrolled vertically.
         * @param width The width of the scroll container.
         * @param width The width of the scroll container.
         * @param height The height of the scroll container.
         * @param height The height of the scroll container.
         */
         */
-		UIScrollContainer(ScreenEntity *scrolledEntity, bool hScroll, bool vScroll, Number width, Number height);
+		UIScrollContainer(Entity *scrolledEntity, bool hScroll, bool vScroll, Number width, Number height);
 		~UIScrollContainer();
 		~UIScrollContainer();
 
 
         /**
         /**
@@ -114,7 +114,7 @@ namespace Polycode {
 		Number contentWidth;
 		Number contentWidth;
 		Number contentHeight;
 		Number contentHeight;
 
 
-		ScreenEntity *scrollChild;
+		Entity *scrollChild;
 
 
 		bool hasHScroll;
 		bool hasHScroll;
 		bool hasVScroll;
 		bool hasVScroll;

+ 13 - 13
Modules/Contents/UI/Include/PolyUITextInput.h

@@ -22,11 +22,11 @@
 
 
 #pragma once
 #pragma once
 #include "PolyGlobals.h"
 #include "PolyGlobals.h"
-#include "PolyScreenLabel.h"
-#include "PolyScreenShape.h"
+#include "PolySceneLabel.h"
+#include "PolyScenePrimitive.h"
 #include "PolyFontManager.h"
 #include "PolyFontManager.h"
 #include "PolyFont.h"
 #include "PolyFont.h"
-#include "PolyScreenEntity.h"
+#include "PolyEntity.h"
 #include "PolyUIEvent.h"
 #include "PolyUIEvent.h"
 #include "PolyUIBox.h"
 #include "PolyUIBox.h"
 #include "PolyUIMenu.h"
 #include "PolyUIMenu.h"
@@ -377,7 +377,7 @@ namespace Polycode {
 			
 			
 			Number resizeTimer;
 			Number resizeTimer;
 
 
-			ScreenEntity *lineNumberAnchor;
+			Entity *lineNumberAnchor;
 		
 		
 			void renumberLines();
 			void renumberLines();
 			bool isNumberOrCharacter(wchar_t charCode);			
 			bool isNumberOrCharacter(wchar_t charCode);			
@@ -427,9 +427,9 @@ namespace Polycode {
 			std::vector<TextColorPair> makeWordWrapBuffer(LineInfo *lineInfo, String indentPrefix);
 			std::vector<TextColorPair> makeWordWrapBuffer(LineInfo *lineInfo, String indentPrefix);
 			std::vector<TextColorPair> splitTokens(String stringToSplit, LineColorInfo *stringColorInfo);
 			std::vector<TextColorPair> splitTokens(String stringToSplit, LineColorInfo *stringColorInfo);
 			
 			
-			ScreenShape *selectorRectTop;
-			ScreenShape *selectorRectMiddle;
-			ScreenShape *selectorRectBottom;		
+			ScenePrimitive *selectorRectTop;
+			ScenePrimitive *selectorRectMiddle;
+			ScenePrimitive *selectorRectBottom;		
 			int numLines;			
 			int numLines;			
 			
 			
 			Number padding;
 			Number padding;
@@ -440,7 +440,7 @@ namespace Polycode {
 			int selectionL;
 			int selectionL;
 			int selectionR;
 			int selectionR;
 			
 			
-			ScreenShape *lineNumberBg;
+			ScenePrimitive *lineNumberBg;
 			
 			
 			int decoratorOffset;
 			int decoratorOffset;
 		
 		
@@ -470,12 +470,12 @@ namespace Polycode {
 			
 			
 			UITextInputSyntaxHighlighter *syntaxHighliter;
 			UITextInputSyntaxHighlighter *syntaxHighliter;
 		
 		
-			ScreenEntity *linesContainer;
+			Entity *linesContainer;
 
 
 			// container for the actual text contents
 			// container for the actual text contents
 			UIElement *textContainer; 
 			UIElement *textContainer; 
 			
 			
-			vector<ScreenLabel*> linesToDelete;	
+			vector<SceneLabel*> linesToDelete;	
 			
 			
 			std::vector<FindMatch> findMatches;
 			std::vector<FindMatch> findMatches;
 			int findIndex;
 			int findIndex;
@@ -488,7 +488,7 @@ namespace Polycode {
 			bool multiLine;
 			bool multiLine;
 			Timer *blinkTimer;
 			Timer *blinkTimer;
 			UIBox *inputRect;
 			UIBox *inputRect;
-			ScreenShape *blinkerRect;
+			ScenePrimitive *blinkerRect;
 			Vector2 dragMouseStart;
 			Vector2 dragMouseStart;
 			
 			
 			Color selectionColor;
 			Color selectionColor;
@@ -521,8 +521,8 @@ namespace Polycode {
 			vector<LineInfo> lines;
 			vector<LineInfo> lines;
 			vector<WordWrapLine> wordWrapLines;
 			vector<WordWrapLine> wordWrapLines;
 									
 									
-			vector<ScreenLabel*> bufferLines;
-			vector<ScreenLabel*> numberLines;
+			vector<SceneLabel*> bufferLines;
+			vector<SceneLabel*> numberLines;
 			
 			
 			Core *core;
 			Core *core;
 			
 			

+ 8 - 8
Modules/Contents/UI/Include/PolyUITree.h

@@ -23,10 +23,10 @@
 #pragma once
 #pragma once
 #include "PolyGlobals.h"
 #include "PolyGlobals.h"
 #include "PolyUIElement.h"
 #include "PolyUIElement.h"
-#include "PolyScreenLabel.h"
-#include "PolyScreenImage.h"
-#include "PolyScreenShape.h"
-#include "PolyScreenEntity.h"
+#include "PolySceneLabel.h"
+#include "PolySceneImage.h"
+#include "PolyScenePrimitive.h"
+#include "PolyEntity.h"
 #include "PolyUITreeEvent.h"
 #include "PolyUITreeEvent.h"
 #include "PolyUIBox.h"
 #include "PolyUIBox.h"
 #include "PolyTween.h"
 #include "PolyTween.h"
@@ -94,14 +94,14 @@ namespace Polycode {
 			Number padding;
 			Number padding;
 			UIBox *selection;
 			UIBox *selection;
 		//	UIBox *bgBox;
 		//	UIBox *bgBox;
-			ScreenShape *bgBox;
-			ScreenLabel *textLabel;
-			ScreenImage *iconImage;
+			ScenePrimitive *bgBox;
+			SceneLabel *textLabel;
+			SceneImage *iconImage;
 			bool selected;
 			bool selected;
 			Number treeHeight;
 			Number treeHeight;
 			vector<UITree*> treeChildren;
 			vector<UITree*> treeChildren;
 			bool collapsed;
 			bool collapsed;
-			ScreenImage *arrowIconImage;
+			SceneImage *arrowIconImage;
 			String arrowIcon;
 			String arrowIcon;
 			Vector2 mouseDownPosition;
 			Vector2 mouseDownPosition;
 			String fontName;
 			String fontName;

+ 2 - 1
Modules/Contents/UI/Include/PolyUITreeContainer.h

@@ -24,6 +24,7 @@
 #include "PolyGlobals.h"
 #include "PolyGlobals.h"
 #include "PolyUITree.h"
 #include "PolyUITree.h"
 #include "PolyUIBox.h"
 #include "PolyUIBox.h"
+#include "PolyInputKeys.h"
 #include "PolyUIElement.h"
 #include "PolyUIElement.h"
 #include "PolyUIScrollContainer.h"
 #include "PolyUIScrollContainer.h"
 
 
@@ -38,7 +39,7 @@ namespace Polycode {
 		void Resize(Number width, Number height);
 		void Resize(Number width, Number height);
 		
 		
 		UITree *getRootNode();
 		UITree *getRootNode();
-		ScreenEntity *scrollChild;
+		Entity *scrollChild;
 		
 		
 		void onKeyDown(PolyKEY key, wchar_t charCode);
 		void onKeyDown(PolyKEY key, wchar_t charCode);
 		void onGainFocus();
 		void onGainFocus();

+ 4 - 4
Modules/Contents/UI/Include/PolyUIVSizer.h

@@ -22,7 +22,7 @@
 
 
 #pragma once
 #pragma once
 #include "PolyGlobals.h"
 #include "PolyGlobals.h"
-#include "PolyScreenShape.h"
+#include "PolyScenePrimitive.h"
 #include "PolyUIElement.h"
 #include "PolyUIElement.h"
 
 
 namespace Polycode {
 namespace Polycode {
@@ -47,7 +47,7 @@ namespace Polycode {
 			
 			
 		protected:
 		protected:
 		
 		
-			ScreenEntity *childElements;			
+			Entity *childElements;			
 			Number mainHeight;
 			Number mainHeight;
 			
 			
 			bool topSizer;
 			bool topSizer;
@@ -58,8 +58,8 @@ namespace Polycode {
 			Number baseMouseY;
 			Number baseMouseY;
 			Number baseMainHeight;
 			Number baseMainHeight;
 			
 			
-			ScreenShape *separatorHitShape;
-			ScreenShape *separatorBgShape;
+			ScenePrimitive *separatorHitShape;
+			ScenePrimitive *separatorBgShape;
 			
 			
 			UIElement *firstElement;
 			UIElement *firstElement;
 			UIElement *secondElement;			
 			UIElement *secondElement;			

+ 7 - 7
Modules/Contents/UI/Include/PolyUIWindow.h

@@ -23,19 +23,19 @@
 #pragma once
 #pragma once
 
 
 #include "PolyGlobals.h"
 #include "PolyGlobals.h"
-#include "PolyScreenShape.h"
-#include "PolyScreenLabel.h"
-#include "PolyScreenEntity.h"
+#include "PolyScenePrimitive.h"
+#include "PolySceneLabel.h"
+#include "PolyEntity.h"
 #include "PolyUIEvent.h"
 #include "PolyUIEvent.h"
 #include "PolyUIImageButton.h"
 #include "PolyUIImageButton.h"
 #include "PolyFont.h"
 #include "PolyFont.h"
-#include "PolyScreenEvent.h"
+#include "PolyInputKeys.h"
 #include "PolyUIBox.h"
 #include "PolyUIBox.h"
 #include "PolyTween.h"
 #include "PolyTween.h"
 
 
 namespace Polycode {
 namespace Polycode {
 
 
-	class _PolyExport UIWindow : public ScreenEntity {
+	class _PolyExport UIWindow : public Entity {
 		public:
 		public:
 			UIWindow(String windowName, Number width, Number height);
 			UIWindow(String windowName, Number width, Number height);
 			virtual ~UIWindow();
 			virtual ~UIWindow();
@@ -64,13 +64,13 @@ namespace Polycode {
 			Number closeIconX;
 			Number closeIconX;
 			Number closeIconY;
 			Number closeIconY;
 			
 			
-			ScreenLabel *titleLabel;
+			SceneLabel *titleLabel;
 		
 		
 			Font *font;
 			Font *font;
 			Tween *windowTween;
 			Tween *windowTween;
 			UIImageButton *closeBtn;
 			UIImageButton *closeBtn;
 			UIBox *windowRect;
 			UIBox *windowRect;
-			ScreenShape *titlebarRect;
+			ScenePrimitive *titlebarRect;
 		
 		
 			bool tweenClosing;
 			bool tweenClosing;
 			void resetTween();
 			void resetTween();

+ 24 - 26
Modules/Contents/UI/Source/PolyUIBox.cpp

@@ -26,61 +26,60 @@ using namespace Polycode;
 
 
 UIBox::UIBox(String imageFile, Number t, Number r, Number b, Number l, Number boxWidth, Number boxHeight) : UIElement() {
 UIBox::UIBox(String imageFile, Number t, Number r, Number b, Number l, Number boxWidth, Number boxHeight) : UIElement() {
 	
 	
-	setPositionMode(ScreenEntity::POSITION_TOPLEFT);	
+	setPositionMode(Entity::POSITION_TOPLEFT);	
 	
 	
-	width=boxWidth;
-	height = boxHeight;
-	setHitbox(boxWidth, boxHeight);
+	setWidth(boxWidth);
+	setHeight(boxHeight);
 	
 	
-	tlImage = new ScreenImage(imageFile);
+	tlImage = new SceneImage(imageFile);
 	tlImage->setImageCoordinates(0,0,l,t);
 	tlImage->setImageCoordinates(0,0,l,t);
 	addChild(tlImage);
 	addChild(tlImage);
 	tlImage->setPosition(0, 0);
 	tlImage->setPosition(0, 0);
 	
 	
-	trImage = new ScreenImage(imageFile);
+	trImage = new SceneImage(imageFile);
 	trImage->setImageCoordinates(trImage->getWidth()-r,0,r,t);
 	trImage->setImageCoordinates(trImage->getWidth()-r,0,r,t);
 	addChild(trImage);	
 	addChild(trImage);	
 	trImage->setPosition(boxWidth-r, 0);
 	trImage->setPosition(boxWidth-r, 0);
 
 
-	blImage = new ScreenImage(imageFile);
+	blImage = new SceneImage(imageFile);
 	blImage->setImageCoordinates(0,blImage->getHeight()-b,l,b);
 	blImage->setImageCoordinates(0,blImage->getHeight()-b,l,b);
 	addChild(blImage);	
 	addChild(blImage);	
 	blImage->setPosition(0, boxHeight-b);
 	blImage->setPosition(0, boxHeight-b);
 
 
-	brImage = new ScreenImage(imageFile);
+	brImage = new SceneImage(imageFile);
 	brImage->setImageCoordinates(brImage->getWidth()-r,brImage->getHeight()-b,r,b);
 	brImage->setImageCoordinates(brImage->getWidth()-r,brImage->getHeight()-b,r,b);
 	addChild(brImage);	
 	addChild(brImage);	
 	brImage->setPosition(boxWidth-r, boxHeight-b);	
 	brImage->setPosition(boxWidth-r, boxHeight-b);	
 	
 	
-	centerImage = new ScreenImage(imageFile);
+	centerImage = new SceneImage(imageFile);
 	centerImage->setImageCoordinates(l,t,centerImage->getWidth()-l-r, centerImage->getHeight()-t-b);
 	centerImage->setImageCoordinates(l,t,centerImage->getWidth()-l-r, centerImage->getHeight()-t-b);
 	addChild(centerImage);	
 	addChild(centerImage);	
 	centerImage->setPosition(l,t);	
 	centerImage->setPosition(l,t);	
-	centerImage->setShapeSize(boxWidth-l-r, boxHeight-t-b);
+	centerImage->setPrimitiveOptions(ScenePrimitive::TYPE_VPLANE, boxWidth-l-r, boxHeight-t-b);
 	
 	
-	tImage = new ScreenImage(imageFile);
+	tImage = new SceneImage(imageFile);
 	tImage->setImageCoordinates(l,0,tImage->getWidth()-l-r,t);
 	tImage->setImageCoordinates(l,0,tImage->getWidth()-l-r,t);
 	addChild(tImage);
 	addChild(tImage);
 	tImage->setPosition(l,0);	
 	tImage->setPosition(l,0);	
-	tImage->setShapeSize(boxWidth-l-r, t);
+	tImage->setPrimitiveOptions(ScenePrimitive::TYPE_VPLANE, boxWidth-l-r, t);
 
 
-	bImage = new ScreenImage(imageFile);
+	bImage = new SceneImage(imageFile);
 	bImage->setImageCoordinates(l,bImage->getHeight()-b,bImage->getWidth()-l-r,b);
 	bImage->setImageCoordinates(l,bImage->getHeight()-b,bImage->getWidth()-l-r,b);
 	addChild(bImage);
 	addChild(bImage);
 	bImage->setPosition(l,boxHeight-b);	
 	bImage->setPosition(l,boxHeight-b);	
-	bImage->setShapeSize(boxWidth-l-r, b);
+	bImage->setPrimitiveOptions(ScenePrimitive::TYPE_VPLANE, boxWidth-l-r, b);
 
 
-	lImage = new ScreenImage(imageFile);
+	lImage = new SceneImage(imageFile);
 	lImage->setImageCoordinates(0,t,l,lImage->getHeight()-t-b);
 	lImage->setImageCoordinates(0,t,l,lImage->getHeight()-t-b);
 	addChild(lImage);
 	addChild(lImage);
 	lImage->setPosition(0,t);	
 	lImage->setPosition(0,t);	
-	lImage->setShapeSize(l, boxHeight-t-b);
+	lImage->setPrimitiveOptions(ScenePrimitive::TYPE_VPLANE, l, boxHeight-t-b);
 
 
-	rImage = new ScreenImage(imageFile);
+	rImage = new SceneImage(imageFile);
 	rImage->setImageCoordinates(rImage->getWidth()-r,t,r,rImage->getHeight()-t-b);
 	rImage->setImageCoordinates(rImage->getWidth()-r,t,r,rImage->getHeight()-t-b);
 	addChild(rImage);
 	addChild(rImage);
 	rImage->setPosition(boxWidth-r,t);	
 	rImage->setPosition(boxWidth-r,t);	
-	rImage->setShapeSize(r, boxHeight-t-b);	
+	rImage->setPrimitiveOptions(ScenePrimitive::TYPE_VPLANE, r, boxHeight-t-b);	
 	
 	
 	this->t = t;
 	this->t = t;
 	this->r = r;
 	this->r = r;
@@ -95,19 +94,18 @@ void UIBox::resizeBox(Number newWidth, Number newHeight) {
 	trImage->setPosition(newWidth-trImage->getWidth(), 0);
 	trImage->setPosition(newWidth-trImage->getWidth(), 0);
 	blImage->setPosition(0, newHeight-blImage->getHeight());
 	blImage->setPosition(0, newHeight-blImage->getHeight());
 	
 	
-	centerImage->setShapeSize(newWidth-l-r, newHeight-t-b);
+	centerImage->setPrimitiveOptions(ScenePrimitive::TYPE_VPLANE, newWidth-l-r, newHeight-t-b);
 		
 		
-	lImage->setShapeSize(l, newHeight-t-b);	
-	rImage->setShapeSize(r, newHeight-t-b);		
-	bImage->setShapeSize(newWidth-l-r, b);
-	tImage->setShapeSize(newWidth-l-r, t);	
+	lImage->setPrimitiveOptions(ScenePrimitive::TYPE_VPLANE, l, newHeight-t-b);	
+	rImage->setPrimitiveOptions(ScenePrimitive::TYPE_VPLANE, r, newHeight-t-b);		
+	bImage->setPrimitiveOptions(ScenePrimitive::TYPE_VPLANE, newWidth-l-r, b);
+	tImage->setPrimitiveOptions(ScenePrimitive::TYPE_VPLANE, newWidth-l-r, t);	
 	
 	
 	bImage->setPosition(bImage->getPosition().x, newHeight-bImage->getHeight());	
 	bImage->setPosition(bImage->getPosition().x, newHeight-bImage->getHeight());	
 	rImage->setPosition(newWidth-rImage->getWidth(),rImage->getPosition().y);
 	rImage->setPosition(newWidth-rImage->getWidth(),rImage->getPosition().y);
 	
 	
-	width=newWidth;
-	height = newHeight;
-	setHitbox(newWidth, newHeight);
+	setWidth(newWidth);
+	setHeight(newHeight);
 	
 	
 	this->rebuildTransformMatrix();
 	this->rebuildTransformMatrix();
 }
 }

+ 2 - 3
Modules/Contents/UI/Source/PolyUIButton.cpp

@@ -70,7 +70,7 @@ UIButton::UIButton(String text, Number width, Number height) : UIElement() {
 		
 		
 	pressedDown = false;
 	pressedDown = false;
 	
 	
-	buttonLabel = new ScreenLabel(text, fontSize, fontName, Label::ANTIALIAS_FULL);
+	buttonLabel = new SceneLabel(text, fontSize, fontName, Label::ANTIALIAS_FULL);
 	buttonLabel->color.setColorHexFromString(conf->getStringValue("Polycode", "uiButtonFontColor"));
 	buttonLabel->color.setColorHexFromString(conf->getStringValue("Polycode", "uiButtonFontColor"));
 	addChild(buttonLabel);
 	addChild(buttonLabel);
 	labelXPos = floor((width-buttonLabel->getWidth())/2.0f) + labelOffsetX;
 	labelXPos = floor((width-buttonLabel->getWidth())/2.0f) + labelOffsetX;
@@ -91,7 +91,6 @@ void UIButton::Resize(Number width, Number height) {
 	this->width = width;
 	this->width = width;
 	this->height = height;	
 	this->height = height;	
 	matrixDirty = true;	
 	matrixDirty = true;	
-	setHitbox(width,height);	
 	
 	
 	labelXPos = floor((width-buttonLabel->getWidth())/2.0f) + labelOffsetX;
 	labelXPos = floor((width-buttonLabel->getWidth())/2.0f) + labelOffsetX;
 	labelYPos = labelOffsetY;
 	labelYPos = labelOffsetY;
@@ -157,7 +156,7 @@ void UIButton::handleEvent(Event *event) {
 			case InputEvent::EVENT_MOUSEDOWN:
 			case InputEvent::EVENT_MOUSEDOWN:
 				pressedDown = true;
 				pressedDown = true;
 				if(parentEntity)
 				if(parentEntity)
-					((ScreenEntity*)parentEntity)->focusChild(this);
+					((Entity*)parentEntity)->focusChild(this);
 				buttonLabel->setPosition(labelXPos+1,labelYPos+1);
 				buttonLabel->setPosition(labelXPos+1,labelYPos+1);
 				buttonRect->setPosition(1,1);
 				buttonRect->setPosition(1,1);
 			break;
 			break;

+ 3 - 3
Modules/Contents/UI/Source/PolyUICheckBox.cpp

@@ -41,13 +41,13 @@ UICheckBox::UICheckBox(String caption, bool checked) : UIElement() {
 	
 	
 	this->checked = checked;
 	this->checked = checked;
 	
 	
-	buttonImageChecked = new ScreenImage(checkImage);
+	buttonImageChecked = new SceneImage(checkImage);
 	buttonImageChecked->visible = checked;
 	buttonImageChecked->visible = checked;
 
 
-	buttonImageUnchecked = new ScreenImage(uncheckImage);
+	buttonImageUnchecked = new SceneImage(uncheckImage);
 	buttonImageUnchecked->visible = !checked;
 	buttonImageUnchecked->visible = !checked;
 	
 	
-	captionLabel = new ScreenLabel(caption, fontSize, fontName, Label::ANTIALIAS_FULL);
+	captionLabel = new SceneLabel(caption, fontSize, fontName, Label::ANTIALIAS_FULL);
 	
 	
 	addChild(captionLabel);
 	addChild(captionLabel);
 	captionLabel->setPosition(buttonImageChecked->getWidth() + checkboxTextOffsetX, checkboxTextOffsetY);
 	captionLabel->setPosition(buttonImageChecked->getWidth() + checkboxTextOffsetX, checkboxTextOffsetY);

+ 17 - 17
Modules/Contents/UI/Source/PolyUIColorBox.cpp

@@ -47,11 +47,11 @@ UIColorPicker::UIColorPicker() : UIWindow(L"", 300, 240) {
 	String hueSelectorImage = conf->getStringValue("Polycode", "uiColorPickerHueSelector");
 	String hueSelectorImage = conf->getStringValue("Polycode", "uiColorPickerHueSelector");
 	String mainSelectorImage = conf->getStringValue("Polycode", "uiColorPickerMainSelector");
 	String mainSelectorImage = conf->getStringValue("Polycode", "uiColorPickerMainSelector");
 
 
-	mainBg = new ScreenImage(mainBgImage);
+	mainBg = new SceneImage(mainBgImage);
 	mainBg->setPosition(padding, topPadding+padding);
 	mainBg->setPosition(padding, topPadding+padding);
 	addChild(mainBg);
 	addChild(mainBg);
 
 
-	mainFrame = new ScreenImage(mainFrameImage);
+	mainFrame = new SceneImage(mainFrameImage);
 	mainFrame->setPosition(padding, topPadding+padding);
 	mainFrame->setPosition(padding, topPadding+padding);
 	
 	
 	alphaSlider = new UIHSlider(0, 1.0, mainFrame->getWidth());
 	alphaSlider = new UIHSlider(0, 1.0, mainFrame->getWidth());
@@ -59,25 +59,25 @@ UIColorPicker::UIColorPicker() : UIWindow(L"", 300, 240) {
 	addChild(alphaSlider);
 	addChild(alphaSlider);
 	alphaSlider->addEventListener(this, UIEvent::CHANGE_EVENT);
 	alphaSlider->addEventListener(this, UIEvent::CHANGE_EVENT);
 	
 	
-	mainColorRect = new ScreenShape(ScreenShape::SHAPE_RECT, mainFrame->getWidth(), mainFrame->getHeight());
-	mainColorRect->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
+	mainColorRect = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, mainFrame->getWidth(), mainFrame->getHeight());
+	mainColorRect->setPositionMode(Entity::POSITION_TOPLEFT);
 	mainColorRect->setPosition(padding+1, topPadding+padding+1);
 	mainColorRect->setPosition(padding+1, topPadding+padding+1);
 	addChild(mainColorRect);
 	addChild(mainColorRect);
 	addChild(mainFrame);
 	addChild(mainFrame);
 
 
-	hueFrame = new ScreenImage(hueFrameImage);
+	hueFrame = new SceneImage(hueFrameImage);
 	hueFrame->setPosition(mainFrame->getPosition().x + mainFrame->getWidth()+10, topPadding+padding);
 	hueFrame->setPosition(mainFrame->getPosition().x + mainFrame->getWidth()+10, topPadding+padding);
 	addChild(hueFrame);
 	addChild(hueFrame);
 	
 	
-	hueSelector = new ScreenImage(hueSelectorImage);
-	hueSelector->setPositionMode(ScreenEntity::POSITION_CENTER);
+	hueSelector = new SceneImage(hueSelectorImage);
+	hueSelector->setPositionMode(Entity::POSITION_CENTER);
 	hueSelector->setPosition(hueFrame->getPosition().x + (hueFrame->getWidth()/2.0), hueFrame->getPosition().y);
 	hueSelector->setPosition(hueFrame->getPosition().x + (hueFrame->getWidth()/2.0), hueFrame->getPosition().y);
 	addChild(hueSelector);	
 	addChild(hueSelector);	
 
 
 	hueSelector->setDragLimits(Polycode::Rectangle(hueSelector->getPosition().x,hueSelector->getPosition().y,0,hueFrame->getHeight()));
 	hueSelector->setDragLimits(Polycode::Rectangle(hueSelector->getPosition().x,hueSelector->getPosition().y,0,hueFrame->getHeight()));
 				
 				
-	mainSelector = new ScreenImage(mainSelectorImage);
-	mainSelector->setPositionMode(ScreenEntity::POSITION_CENTER);	
+	mainSelector = new SceneImage(mainSelectorImage);
+	mainSelector->setPositionMode(Entity::POSITION_CENTER);	
 	mainSelector->setPosition(mainFrame->getPosition());
 	mainSelector->setPosition(mainFrame->getPosition());
 	addChild(mainSelector);	
 	addChild(mainSelector);	
 	
 	
@@ -94,7 +94,7 @@ UIColorPicker::UIColorPicker() : UIWindow(L"", 300, 240) {
 	hueFrame->addEventListener(this, InputEvent::EVENT_MOUSEUP_OUTSIDE);
 	hueFrame->addEventListener(this, InputEvent::EVENT_MOUSEUP_OUTSIDE);
 	hueFrame->processInputEvents = true;	
 	hueFrame->processInputEvents = true;	
 	
 	
-	ScreenLabel *label = new ScreenLabel(L"R:", fontSize, fontName);
+	SceneLabel *label = new SceneLabel(L"R:", fontSize, fontName);
 	label->setPosition(hueFrame->getPosition().x+hueFrame->getWidth() + 15, topPadding+padding + 3);
 	label->setPosition(hueFrame->getPosition().x+hueFrame->getWidth() + 15, topPadding+padding + 3);
 	addChild(label);
 	addChild(label);
 	junkLabels.push_back(label);
 	junkLabels.push_back(label);
@@ -104,7 +104,7 @@ UIColorPicker::UIColorPicker() : UIWindow(L"", 300, 240) {
 	addChild(rTextInput);
 	addChild(rTextInput);
 	rTextInput->addEventListener(this, UIEvent::CHANGE_EVENT);
 	rTextInput->addEventListener(this, UIEvent::CHANGE_EVENT);
 
 
-	label = new ScreenLabel(L"G:", fontSize, fontName);
+	label = new SceneLabel(L"G:", fontSize, fontName);
 	label->setPosition(hueFrame->getPosition().x+hueFrame->getWidth() + 15, topPadding+padding + 33);
 	label->setPosition(hueFrame->getPosition().x+hueFrame->getWidth() + 15, topPadding+padding + 33);
 	addChild(label);
 	addChild(label);
 	junkLabels.push_back(label);
 	junkLabels.push_back(label);
@@ -114,7 +114,7 @@ UIColorPicker::UIColorPicker() : UIWindow(L"", 300, 240) {
 	addChild(gTextInput);
 	addChild(gTextInput);
 	gTextInput->addEventListener(this, UIEvent::CHANGE_EVENT);
 	gTextInput->addEventListener(this, UIEvent::CHANGE_EVENT);
 	
 	
-	label = new ScreenLabel(L"B:", fontSize, fontName);
+	label = new SceneLabel(L"B:", fontSize, fontName);
 	label->setPosition(hueFrame->getPosition().x+hueFrame->getWidth() + 15, topPadding+padding + 63);
 	label->setPosition(hueFrame->getPosition().x+hueFrame->getWidth() + 15, topPadding+padding + 63);
 	addChild(label);
 	addChild(label);
 	junkLabels.push_back(label);
 	junkLabels.push_back(label);
@@ -124,7 +124,7 @@ UIColorPicker::UIColorPicker() : UIWindow(L"", 300, 240) {
 	addChild(bTextInput);
 	addChild(bTextInput);
 	bTextInput->addEventListener(this, UIEvent::CHANGE_EVENT);
 	bTextInput->addEventListener(this, UIEvent::CHANGE_EVENT);
 	
 	
-	label = new ScreenLabel(L"A:", fontSize, fontName);
+	label = new SceneLabel(L"A:", fontSize, fontName);
 	label->setPosition(hueFrame->getPosition().x+hueFrame->getWidth() + 15, topPadding+padding + 93);
 	label->setPosition(hueFrame->getPosition().x+hueFrame->getWidth() + 15, topPadding+padding + 93);
 	addChild(label);
 	addChild(label);
 	junkLabels.push_back(label);
 	junkLabels.push_back(label);
@@ -433,8 +433,8 @@ UIColorBox::UIColorBox(UIColorPicker *colorPicker, Color initialColor, Number wi
 	Number sl = conf->getNumericValue("Polycode", "uiColorBoxFrameImageL");
 	Number sl = conf->getNumericValue("Polycode", "uiColorBoxFrameImageL");
 
 
 
 
-	bgImage = new ScreenShape(ScreenShape::SHAPE_RECT, width-(frameInset*2), height-(frameInset*2));
-	bgImage->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
+	bgImage = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, width-(frameInset*2), height-(frameInset*2));
+	bgImage->setPositionMode(Entity::POSITION_TOPLEFT);
 	bgImage->loadTexture(bgImageFile);
 	bgImage->loadTexture(bgImageFile);
 	bgImage->setPosition(frameInset, frameInset);	
 	bgImage->setPosition(frameInset, frameInset);	
 	addChild(bgImage);
 	addChild(bgImage);
@@ -442,8 +442,8 @@ UIColorBox::UIColorBox(UIColorPicker *colorPicker, Color initialColor, Number wi
 	bgImage->addEventListener(this, InputEvent::EVENT_MOUSEDOWN);
 	bgImage->addEventListener(this, InputEvent::EVENT_MOUSEDOWN);
 	bgImage->processInputEvents = true;
 	bgImage->processInputEvents = true;
 
 
-	colorShape = new ScreenShape(ScreenShape::SHAPE_RECT, width-(frameInset*2), height-(frameInset*2));
-	colorShape->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
+	colorShape = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, width-(frameInset*2), height-(frameInset*2));
+	colorShape->setPositionMode(Entity::POSITION_TOPLEFT);
 	colorShape->setPosition(frameInset, frameInset);
 	colorShape->setPosition(frameInset, frameInset);
 	addChild(colorShape);
 	addChild(colorShape);
 
 

+ 2 - 3
Modules/Contents/UI/Source/PolyUIComboBox.cpp

@@ -61,7 +61,7 @@ UIComboBox::UIComboBox(UIGlobalMenu *globalMenu, Number comboWidth) : UIElement(
 	dropDownX = conf->getNumericValue("Polycode", "uiComboBoxDropX");
 	dropDownX = conf->getNumericValue("Polycode", "uiComboBoxDropX");
 	dropDownY = conf->getNumericValue("Polycode", "uiComboBoxDropY");
 	dropDownY = conf->getNumericValue("Polycode", "uiComboBoxDropY");
 		
 		
-	dropDownImage = new ScreenImage(dropDownImageFile);
+	dropDownImage = new SceneImage(dropDownImageFile);
 	dropDownImage->setPosition(comboWidth - dropDownImage->getWidth() - dropDownX,dropDownY);
 	dropDownImage->setPosition(comboWidth - dropDownImage->getWidth() - dropDownX,dropDownY);
 	
 	
 	this->comboHeight = conf->getNumericValue("Polycode", "uiComboBoxHeight");
 	this->comboHeight = conf->getNumericValue("Polycode", "uiComboBoxHeight");
@@ -73,7 +73,7 @@ UIComboBox::UIComboBox(UIGlobalMenu *globalMenu, Number comboWidth) : UIElement(
 	addChild(bgBox);
 	addChild(bgBox);
 	addChild(dropDownImage);
 	addChild(dropDownImage);
 	
 	
-	selectedLabel = new ScreenLabel("<None>", fontSize, fontName);
+	selectedLabel = new SceneLabel("<None>", fontSize, fontName);
 	selectedLabel->positionAtBaseline = false;
 	selectedLabel->positionAtBaseline = false;
 	selectedLabel->setPosition(paddingX, floor(((dropDownImage->getHeight()/2.0) - selectedLabel->getLabel()->getTextHeight()/2.0) + paddingY));
 	selectedLabel->setPosition(paddingX, floor(((dropDownImage->getHeight()/2.0) - selectedLabel->getLabel()->getTextHeight()/2.0) + paddingY));
 	addChild(selectedLabel);
 	addChild(selectedLabel);
@@ -106,7 +106,6 @@ void UIComboBox::Resize(Number width, Number height) {
 	this->width = width;
 	this->width = width;
 	this->height = height;	
 	this->height = height;	
 	matrixDirty = true;	
 	matrixDirty = true;	
-	setHitbox(width,height);
 	dropDownImage->setPosition(comboWidth - dropDownImage->getWidth() - dropDownX,dropDownY);	
 	dropDownImage->setPosition(comboWidth - dropDownImage->getWidth() - dropDownX,dropDownY);	
 }
 }
 
 

+ 6 - 5
Modules/Contents/UI/Source/PolyUIElement.cpp

@@ -24,15 +24,16 @@
 
 
 using namespace Polycode;
 using namespace Polycode;
 
 
-UIElement::UIElement() : ScreenEntity() {
-	setPositionMode(ScreenEntity::POSITION_TOPLEFT);
+UIElement::UIElement() : Entity() {
+	setPositionMode(Entity::POSITION_TOPLEFT);
 	processInputEvents = true;
 	processInputEvents = true;
 }
 }
 
 
-UIElement::UIElement(Number width, Number height) : ScreenEntity() {
-	setPositionMode(ScreenEntity::POSITION_TOPLEFT);
+UIElement::UIElement(Number width, Number height) : Entity() {
+	setPositionMode(Entity::POSITION_TOPLEFT);
 	processInputEvents = true;
 	processInputEvents = true;
-	this->width = width; this->height = height;
+	setWidth(width);
+	setHeight(height);
 }
 }
 
 
 UIElement::~UIElement() {
 UIElement::~UIElement() {

+ 6 - 6
Modules/Contents/UI/Source/PolyUIFileDialog.cpp

@@ -13,8 +13,8 @@ UIFileDialogEntry::UIFileDialogEntry(OSFileEntry entry, bool canSelect, int widt
 	String folderIconName = conf->getStringValue("Polycode", "uiFileBrowserFolderIcon");
 	String folderIconName = conf->getStringValue("Polycode", "uiFileBrowserFolderIcon");
 	String placeIconName = conf->getStringValue("Polycode", "uiFileBrowserPlaceIcon");
 	String placeIconName = conf->getStringValue("Polycode", "uiFileBrowserPlaceIcon");
 
 
-	bg = new ScreenShape(ScreenShape::SHAPE_RECT, width, 18);
-	bg->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
+	bg = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, width, 18);
+	bg->setPositionMode(Entity::POSITION_TOPLEFT);
 	addChild(bg);
 	addChild(bg);
 	bg->setColor(0.0, 0.0, 0.0, 0.1);
 	bg->setColor(0.0, 0.0, 0.0, 0.1);
 	bg->processInputEvents = true;
 	bg->processInputEvents = true;
@@ -22,19 +22,19 @@ UIFileDialogEntry::UIFileDialogEntry(OSFileEntry entry, bool canSelect, int widt
 	this->fileEntry = entry;
 	this->fileEntry = entry;
 
 
 	if(isPlace) {
 	if(isPlace) {
-		icon = new ScreenImage(placeIconName);
+		icon = new SceneImage(placeIconName);
 	} else {
 	} else {
 		if(entry.type == OSFileEntry::TYPE_FILE) {
 		if(entry.type == OSFileEntry::TYPE_FILE) {
-			icon = new ScreenImage(fileIconName);
+			icon = new SceneImage(fileIconName);
 		} else {
 		} else {
-			icon = new ScreenImage(folderIconName);
+			icon = new SceneImage(folderIconName);
 		}
 		}
 	}
 	}
 
 
 	addChild(icon);
 	addChild(icon);
 	icon->setPosition(3,1);
 	icon->setPosition(3,1);
 
 
-	label = new ScreenLabel(entry.name, 12, "sans");
+	label = new SceneLabel(entry.name, 12, "sans");
 	addChild(label);
 	addChild(label);
 	label->setPosition(25, 2);
 	label->setPosition(25, 2);
 
 

+ 13 - 13
Modules/Contents/UI/Source/PolyUIHSizer.cpp

@@ -31,26 +31,26 @@ using namespace Polycode;
 
 
 UIHSizer::UIHSizer(Number width, Number height, Number mainWidth, bool leftSizer) : UIElement() {
 UIHSizer::UIHSizer(Number width, Number height, Number mainWidth, bool leftSizer) : UIElement() {
 
 
-	this->width = width;
-	this->height = height;
+	setWidth(width);
+	setHeight(height);
 	this->leftSizer = leftSizer;
 	this->leftSizer = leftSizer;
 	this->mainWidth = mainWidth;
 	this->mainWidth = mainWidth;
 	
 	
-	separatorBgShape = new ScreenShape(ScreenShape::SHAPE_RECT, 1,height);
-	separatorBgShape->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
+	separatorBgShape = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 1,height);
+	separatorBgShape->setPositionMode(Entity::POSITION_TOPLEFT);
 	separatorBgShape->setColor(0.0, 0.0, 0.0, 1.0);	
 	separatorBgShape->setColor(0.0, 0.0, 0.0, 1.0);	
 	addChild(separatorBgShape);
 	addChild(separatorBgShape);
 	
 	
 
 
-	childElements = new ScreenEntity();
+	childElements = new Entity();
 	childElements->processInputEvents = true;
 	childElements->processInputEvents = true;
 	addChild(childElements);
 	addChild(childElements);
 	
 	
 	firstElement = NULL;
 	firstElement = NULL;
 	secondElement = NULL;
 	secondElement = NULL;
 	
 	
-	separatorHitShape = new ScreenShape(ScreenShape::SHAPE_RECT, 8,height);
-	separatorHitShape->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
+	separatorHitShape = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 8,height);
+	separatorHitShape->setPositionMode(Entity::POSITION_TOPLEFT);
 	separatorHitShape->setColor(1.0, 0.0, 0.0, 0.5);	
 	separatorHitShape->setColor(1.0, 0.0, 0.0, 0.5);	
 	separatorHitShape->blockMouseInput = true;	
 	separatorHitShape->blockMouseInput = true;	
 	addChild(separatorHitShape);
 	addChild(separatorHitShape);
@@ -126,8 +126,8 @@ void UIHSizer::handleEvent(Event *event) {
 }
 }
 
 
 void UIHSizer::Resize(Number width, Number height) {
 void UIHSizer::Resize(Number width, Number height) {
-	this->width = width;
-	this->height = height;
+	setWidth(width);
+	setHeight(height);
 	matrixDirty = true;
 	matrixDirty = true;
 	updateSizer();
 	updateSizer();
 	UIElement::Resize(width, height);	
 	UIElement::Resize(width, height);	
@@ -167,9 +167,9 @@ void UIHSizer::updateSizer() {
 			secondElement->Resize(width-mainWidth-1, height);	
 			secondElement->Resize(width-mainWidth-1, height);	
 		}
 		}
 
 
-		separatorBgShape->setShapeSize(1, height);
+		separatorBgShape->setPrimitiveOptions(ScenePrimitive::TYPE_VPLANE, 1, height);
 		separatorBgShape->setPosition(mainWidth,0);
 		separatorBgShape->setPosition(mainWidth,0);
-		separatorHitShape->setShapeSize(8, height);
+		separatorHitShape->setPrimitiveOptions(ScenePrimitive::TYPE_VPLANE, 8, height);
 		separatorHitShape->setPosition(mainWidth-4,0);
 		separatorHitShape->setPosition(mainWidth-4,0);
 		
 		
 	} else {
 	} else {
@@ -183,9 +183,9 @@ void UIHSizer::updateSizer() {
 			secondElement->Resize(mainWidth-1, height);	
 			secondElement->Resize(mainWidth-1, height);	
 		}
 		}
 
 
-		separatorBgShape->setShapeSize(1, height);
+		separatorBgShape->setPrimitiveOptions(ScenePrimitive::TYPE_VPLANE, 1, height);
 		separatorBgShape->setPosition(width-mainWidth,0);
 		separatorBgShape->setPosition(width-mainWidth,0);
-		separatorHitShape->setShapeSize(8, height);
+		separatorHitShape->setPrimitiveOptions(ScenePrimitive::TYPE_VPLANE, 8, height);
 		separatorHitShape->setPosition(width-mainWidth-4,0);
 		separatorHitShape->setPosition(width-mainWidth-4,0);
 	
 	
 	}
 	}

+ 5 - 6
Modules/Contents/UI/Source/PolyUIHSlider.cpp

@@ -52,12 +52,12 @@ UIHSlider::UIHSlider(Number start, Number end, Number width) : UIElement() {
 	startValue = start;
 	startValue = start;
 	endValue = end;
 	endValue = end;
 		
 		
-	gripRect = new ScreenImage(gripImage);
-	gripRect->setPositionMode(ScreenEntity::POSITION_CENTER);
+	gripRect = new SceneImage(gripImage);
+	gripRect->setPositionMode(Entity::POSITION_CENTER);
 	gripRect->setPosition(0, floor(bgHeight/2.0));
 	gripRect->setPosition(0, floor(bgHeight/2.0));
 
 
-	bgHitBox = new ScreenShape(ScreenShape::SHAPE_RECT, width, gripRect->getHeight());
-	bgHitBox->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
+	bgHitBox = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, width, gripRect->getHeight());
+	bgHitBox->setPositionMode(Entity::POSITION_TOPLEFT);
 	bgHitBox->setPosition(0, gripRect->getPosition().y - (gripRect->getHeight()/2.0));
 	bgHitBox->setPosition(0, gripRect->getPosition().y - (gripRect->getHeight()/2.0));
 	addChild(bgHitBox);
 	addChild(bgHitBox);
 	bgHitBox->setColor(1.0,0.0,0.0,0.0);
 	bgHitBox->setColor(1.0,0.0,0.0,0.0);
@@ -112,11 +112,10 @@ void UIHSlider::Resize(Number width, Number height) {
 	this->width = width;
 	this->width = width;
 	this->height = height;	
 	this->height = height;	
 	matrixDirty = true;	
 	matrixDirty = true;	
-	setHitbox(width,height);
 	sliderWidth = width;
 	sliderWidth = width;
 	gripRect->setDragLimits(Rectangle(0,floor(bgHeight/2.0),width,0));	
 	gripRect->setDragLimits(Rectangle(0,floor(bgHeight/2.0),width,0));	
 	setSliderValue(sliderValue);
 	setSliderValue(sliderValue);
-	bgHitBox->setShapeSize(width,  gripRect->getHeight());
+	bgHitBox->setPrimitiveOptions(ScenePrimitive::TYPE_VPLANE, width,  gripRect->getHeight());
 }
 }
 			
 			
 void UIHSlider::handleEvent(Event *event) {
 void UIHSlider::handleEvent(Event *event) {

+ 4 - 4
Modules/Contents/UI/Source/PolyUIImageButton.cpp

@@ -29,14 +29,14 @@
 using namespace Polycode;
 using namespace Polycode;
 
 
 UIImageButton::UIImageButton(String imageName) : UIElement() {
 UIImageButton::UIImageButton(String imageName) : UIElement() {
-	setPositionMode(ScreenEntity::POSITION_TOPLEFT);
+	setPositionMode(Entity::POSITION_TOPLEFT);
 	
 	
-	buttonImage = new ScreenImage(imageName.c_str());
+	buttonImage = new SceneImage(imageName.c_str());
 	addChild(buttonImage);
 	addChild(buttonImage);
 	
 	
-	buttonRect = new ScreenShape(ScreenShape::SHAPE_RECT, buttonImage->getWidth(),buttonImage->getHeight(),0,0);
+	buttonRect = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, buttonImage->getWidth(),buttonImage->getHeight(),0,0);
 	buttonRect->setColor(1,1,1,0);
 	buttonRect->setColor(1,1,1,0);
-	buttonRect->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
+	buttonRect->setPositionMode(Entity::POSITION_TOPLEFT);
 	addChild(buttonRect);
 	addChild(buttonRect);
 	
 	
 	buttonRect->addEventListener(this, InputEvent::EVENT_MOUSEOVER);
 	buttonRect->addEventListener(this, InputEvent::EVENT_MOUSEOVER);

+ 8 - 7
Modules/Contents/UI/Source/PolyUIMenu.cpp

@@ -27,7 +27,7 @@
 #include "PolyCoreServices.h"
 #include "PolyCoreServices.h"
 #include "PolyCore.h"
 #include "PolyCore.h"
 #include "PolyConfig.h"
 #include "PolyConfig.h"
-#include "PolyScreenLine.h"
+#include "PolySceneLine.h"
 
 
 using namespace Polycode;
 using namespace Polycode;
 
 
@@ -42,7 +42,7 @@ UIMenuItem::UIMenuItem(String label, String _id, void *data, Number comboWidth,
 	Number paddingX = conf->getNumericValue("Polycode", "uiMenuTextOffsetX");	
 	Number paddingX = conf->getNumericValue("Polycode", "uiMenuTextOffsetX");	
 	Number paddingY = conf->getNumericValue("Polycode", "uiMenuTextOffsetY");	
 	Number paddingY = conf->getNumericValue("Polycode", "uiMenuTextOffsetY");	
 
 
-	itemLabel = new ScreenLabel(label, fontSize, fontName);
+	itemLabel = new SceneLabel(label, fontSize, fontName);
 	itemLabel->setPosition(paddingX, floor(((comboHeight/2.0) - itemLabel->getHeight()/2.0) + paddingY));
 	itemLabel->setPosition(paddingX, floor(((comboHeight/2.0) - itemLabel->getHeight()/2.0) + paddingY));
 	addChild(itemLabel);
 	addChild(itemLabel);
 	
 	
@@ -67,8 +67,9 @@ UIMenuDivider::UIMenuDivider(Number comboWidth, Number comboHeight) : UIMenuItem
 	Config *conf    = CoreServices::getInstance()->getConfig();
 	Config *conf    = CoreServices::getInstance()->getConfig();
 	Number paddingX = conf->getNumericValue("Polycode", "uiMenuSelectorPadding");
 	Number paddingX = conf->getNumericValue("Polycode", "uiMenuSelectorPadding");
 
 
-	line = new ScreenLine(Vector2(paddingX, comboHeight/2.0), Vector2(comboWidth-paddingX, comboHeight/2.0));
-	line->setLineWidth(1.0);
+	line = new SceneLine(Vector3(paddingX, comboHeight/2.0, 0.0), Vector3(comboWidth-paddingX, comboHeight/2.0, 0.0));
+	
+//	line->setLineWidth(1.0);
 	line->setColor(Color(0.0, 0.0, 0.0, 0.7));
 	line->setColor(Color(0.0, 0.0, 0.0, 0.7));
 	addChild(line);
 	addChild(line);
 }
 }
@@ -134,8 +135,8 @@ UIMenu::UIMenu(Number menuWidth) : UIElement() {
 
 
 	initialMouse = CoreServices::getInstance()->getCore()->getInput()->getMousePosition();
 	initialMouse = CoreServices::getInstance()->getCore()->getInput()->getMousePosition();
 	
 	
-	this->width = menuWidth;
-	this->height = menuItemHeight;
+	setWidth(menuWidth);
+	setHeight(menuItemHeight);
 	
 	
 	// ugh, hackz
 	// ugh, hackz
 	ignoreMouse = true;
 	ignoreMouse = true;
@@ -259,7 +260,7 @@ void UIMenu::Resize(Number width, Number height) {
 	UIElement::Resize(width, height);
 	UIElement::Resize(width, height);
 }
 }
 
 
-UIGlobalMenu::UIGlobalMenu() : ScreenEntity() {
+UIGlobalMenu::UIGlobalMenu() : Entity() {
 	currentMenu = NULL;
 	currentMenu = NULL;
 	processInputEvents = true;
 	processInputEvents = true;
 	willHideMenu = false;
 	willHideMenu = false;

+ 6 - 6
Modules/Contents/UI/Source/PolyUIMenuBar.cpp

@@ -37,10 +37,10 @@ bool UIMenuBarEntryItem::checkShortCut(PolyKEY shortCut) {
 
 
 UIMenuBarEntry::UIMenuBarEntry(String name): UIElement() {
 UIMenuBarEntry::UIMenuBarEntry(String name): UIElement() {
 	
 	
-	label = new ScreenLabel(name, 14, "sans");
+	label = new SceneLabel(name, 14, "sans");
 	setWidth(label->getLabel()->getTextWidth() + 20);
 	setWidth(label->getLabel()->getTextWidth() + 20);
-	bg = new ScreenShape(ScreenShape::SHAPE_RECT, width, 25);
-	bg->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
+	bg = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, width, 25);
+	bg->setPositionMode(Entity::POSITION_TOPLEFT);
 	addChild(bg);
 	addChild(bg);
 	bg->color.setColorHex(0xce5a1600);
 	bg->color.setColorHex(0xce5a1600);
 	bg->processInputEvents = true;
 	bg->processInputEvents = true;
@@ -69,10 +69,10 @@ UIMenuBar::UIMenuBar(int width, UIGlobalMenu *globalMenu) : UIElement() {
 
 
 	this->globalMenu = globalMenu;
 	this->globalMenu = globalMenu;
 
 
-	bgShape = new ScreenShape(ScreenShape::SHAPE_RECT, width, 25);
+	bgShape = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, width, 25);
 	addChild(bgShape);
 	addChild(bgShape);
 	bgShape->setColor(0.0, 0.0, 0.0, 1.0);
 	bgShape->setColor(0.0, 0.0, 0.0, 1.0);
-	bgShape->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
+	bgShape->setPositionMode(Entity::POSITION_TOPLEFT);
 	entryOffset = 0;
 	entryOffset = 0;
 
 
 	currentEntry = NULL;
 	currentEntry = NULL;
@@ -178,5 +178,5 @@ UIMenuBar::~UIMenuBar() {
 }
 }
 
 
 void UIMenuBar::Resize(Number width, Number height) {
 void UIMenuBar::Resize(Number width, Number height) {
-	bgShape->setShapeSize(width, 25);
+	bgShape->setPrimitiveOptions(ScenePrimitive::TYPE_VPLANE, width, 25);
 }
 }

+ 2 - 4
Modules/Contents/UI/Source/PolyUIScrollContainer.cpp

@@ -29,9 +29,9 @@
 
 
 using namespace Polycode;
 using namespace Polycode;
 
 
-UIScrollContainer::UIScrollContainer(ScreenEntity *scrolledEntity, bool hScroll, bool vScroll, Number width, Number height) : UIElement() {
+UIScrollContainer::UIScrollContainer(Entity *scrolledEntity, bool hScroll, bool vScroll, Number width, Number height) : UIElement() {
 	
 	
-	scrolledEntity->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
+	scrolledEntity->setPositionMode(Entity::POSITION_TOPLEFT);
 	
 	
 	scrolledEntity->rebuildTransformMatrix();
 	scrolledEntity->rebuildTransformMatrix();
 	Config *conf = CoreServices::getInstance()->getConfig();
 	Config *conf = CoreServices::getInstance()->getConfig();
@@ -42,7 +42,6 @@ UIScrollContainer::UIScrollContainer(ScreenEntity *scrolledEntity, bool hScroll,
 	
 	
 	this->width = width;
 	this->width = width;
 	this->height = height;
 	this->height = height;
-	setHitbox(width, height);
 	
 	
 	Number uiScrollPanePadding = conf->getNumericValue("Polycode", "uiScrollPanePadding");			
 	Number uiScrollPanePadding = conf->getNumericValue("Polycode", "uiScrollPanePadding");			
 	
 	
@@ -79,7 +78,6 @@ UIScrollContainer::UIScrollContainer(ScreenEntity *scrolledEntity, bool hScroll,
 void UIScrollContainer::Resize(Number width, Number height) {
 void UIScrollContainer::Resize(Number width, Number height) {
 	this->width = width;
 	this->width = width;
 	this->height = height;
 	this->height = height;
-	setHitbox(width, height);
 	
 	
 	
 	
 	vScrollBar->Resize(height);
 	vScrollBar->Resize(height);

+ 19 - 20
Modules/Contents/UI/Source/PolyUITextInput.cpp

@@ -86,7 +86,7 @@ UITextInput::UITextInput(bool multiLine, Number width, Number height) : UIElemen
 		rectHeight = fontSize+12;
 		rectHeight = fontSize+12;
 	} 
 	} 
 
 
-	linesContainer = new ScreenEntity();	
+	linesContainer = new Entity();	
 	linesContainer->processInputEvents = true;
 	linesContainer->processInputEvents = true;
 	linesContainer->ownsChildren = true;
 	linesContainer->ownsChildren = true;
 	lineSpacing = conf->getNumericValue("Polycode", "textEditLineSpacing");
 	lineSpacing = conf->getNumericValue("Polycode", "textEditLineSpacing");
@@ -116,13 +116,13 @@ UITextInput::UITextInput(bool multiLine, Number width, Number height) : UIElemen
 	addChild(inputRect);		
 	addChild(inputRect);		
 	
 	
 	if(multiLine) {
 	if(multiLine) {
-		lineNumberBg = new ScreenShape(ScreenShape::SHAPE_RECT, 1,1);
-		lineNumberBg->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
+		lineNumberBg = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 1,1);
+		lineNumberBg->setPositionMode(Entity::POSITION_TOPLEFT);
 		lineNumberBg->setColor(0.0, 0.0, 0.0, 0.3);
 		lineNumberBg->setColor(0.0, 0.0, 0.0, 0.3);
 		addChild(lineNumberBg);
 		addChild(lineNumberBg);
 		lineNumberBg->visible = false;
 		lineNumberBg->visible = false;
 		
 		
-		lineNumberAnchor = new ScreenEntity();
+		lineNumberAnchor = new Entity();
 		linesContainer->addChild(lineNumberAnchor);
 		linesContainer->addChild(lineNumberAnchor);
 	} else {
 	} else {
 		lineNumberBg = NULL;
 		lineNumberBg = NULL;
@@ -143,31 +143,31 @@ UITextInput::UITextInput(bool multiLine, Number width, Number height) : UIElemen
 	inputRect->addEventListener(this, InputEvent::EVENT_MOUSEOVER);
 	inputRect->addEventListener(this, InputEvent::EVENT_MOUSEOVER);
 	inputRect->addEventListener(this, InputEvent::EVENT_MOUSEOUT);
 	inputRect->addEventListener(this, InputEvent::EVENT_MOUSEOUT);
 	inputRect->processInputEvents = true;
 	inputRect->processInputEvents = true;
-	inputRect->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
+	inputRect->setPositionMode(Entity::POSITION_TOPLEFT);
 	
 	
 	selectionColor = Color(181.0f/255.0f, 213.0f/255.0f, 255.0f/255.0f, 1.0f);
 	selectionColor = Color(181.0f/255.0f, 213.0f/255.0f, 255.0f/255.0f, 1.0f);
 	
 	
-	selectorRectTop = new ScreenShape(ScreenShape::SHAPE_RECT, 1,1);
-	selectorRectTop->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
+	selectorRectTop = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 1,1);
+	selectorRectTop->setPositionMode(Entity::POSITION_TOPLEFT);
 	selectorRectTop->setColor(181.0f/255.0f, 213.0f/255.0f, 255.0f/255.0f, 1);
 	selectorRectTop->setColor(181.0f/255.0f, 213.0f/255.0f, 255.0f/255.0f, 1);
 	selectorRectTop->visible = false;
 	selectorRectTop->visible = false;
 	textContainer->addChild(selectorRectTop);
 	textContainer->addChild(selectorRectTop);
 
 
-	selectorRectMiddle = new ScreenShape(ScreenShape::SHAPE_RECT, 1,1);
-	selectorRectMiddle->setPositionMode(ScreenEntity::POSITION_TOPLEFT);	
+	selectorRectMiddle = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 1,1);
+	selectorRectMiddle->setPositionMode(Entity::POSITION_TOPLEFT);	
 	selectorRectMiddle->setColor(181.0f/255.0f, 213.0f/255.0f, 255.0f/255.0f, 1);
 	selectorRectMiddle->setColor(181.0f/255.0f, 213.0f/255.0f, 255.0f/255.0f, 1);
 	selectorRectMiddle->visible = false;
 	selectorRectMiddle->visible = false;
 	textContainer->addChild(selectorRectMiddle);
 	textContainer->addChild(selectorRectMiddle);
 
 
-	selectorRectBottom = new ScreenShape(ScreenShape::SHAPE_RECT, 1,1);
-	selectorRectBottom->setPositionMode(ScreenEntity::POSITION_TOPLEFT);	
+	selectorRectBottom = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 1,1);
+	selectorRectBottom->setPositionMode(Entity::POSITION_TOPLEFT);	
 	selectorRectBottom->setColor(181.0f/255.0f, 213.0f/255.0f, 255.0f/255.0f, 1);
 	selectorRectBottom->setColor(181.0f/255.0f, 213.0f/255.0f, 255.0f/255.0f, 1);
 	selectorRectBottom->visible = false;
 	selectorRectBottom->visible = false;
 	textContainer->addChild(selectorRectBottom);
 	textContainer->addChild(selectorRectBottom);
 		
 		
 	
 	
-	blinkerRect = new ScreenShape(ScreenShape::SHAPE_RECT, 1, fontSize+2,0,0);
-	blinkerRect->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
+	blinkerRect = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 1, fontSize+2,0,0);
+	blinkerRect->setPositionMode(Entity::POSITION_TOPLEFT);
 	blinkerRect->setColor(0,0,0,1);
 	blinkerRect->setColor(0,0,0,1);
 	textContainer->addChild(blinkerRect);
 	textContainer->addChild(blinkerRect);
 	blinkerRect->visible = false;
 	blinkerRect->visible = false;
@@ -228,7 +228,7 @@ void UITextInput::checkBufferLines() {
 
 
 	for(int i=0; i < neededBufferLines - currentBufferLines; i++) {
 	for(int i=0; i < neededBufferLines - currentBufferLines; i++) {
 		if(multiLine) {
 		if(multiLine) {
-			ScreenLabel *newNumberLine = new ScreenLabel(L"", fontSize, fontName, aaMode);
+			SceneLabel *newNumberLine = new SceneLabel(L"", fontSize, fontName, aaMode);
 			newNumberLine->color = lineNumberColor;
 			newNumberLine->color = lineNumberColor;
 			lineNumberAnchor->addChild(newNumberLine);
 			lineNumberAnchor->addChild(newNumberLine);
 			numberLines.push_back(newNumberLine);		
 			numberLines.push_back(newNumberLine);		
@@ -238,7 +238,7 @@ void UITextInput::checkBufferLines() {
 			}
 			}
 		}
 		}
 	
 	
-		ScreenLabel *newLine = new ScreenLabel(L"", fontSize, fontName, aaMode);
+		SceneLabel *newLine = new SceneLabel(L"", fontSize, fontName, aaMode);
 		newLine->color = textColor;
 		newLine->color = textColor;
 		lineHeight = newLine->getHeight();
 		lineHeight = newLine->getHeight();
 		textContainer->addChild(newLine);
 		textContainer->addChild(newLine);
@@ -680,7 +680,7 @@ void UITextInput::doMultilineResize() {
 		restructLines();		
 		restructLines();		
 		readjustBuffer();
 		readjustBuffer();
 		if(lineNumbersEnabled) {
 		if(lineNumbersEnabled) {
-			lineNumberBg->setShapeSize(decoratorOffset, height);
+			lineNumberBg->setPrimitiveOptions(ScenePrimitive::TYPE_VPLANE, decoratorOffset, height);
 		}
 		}
 	}
 	}
 	
 	
@@ -702,7 +702,6 @@ void UITextInput::Resize(Number width, Number height) {
 	this->width = width;
 	this->width = width;
 	this->height = height;	
 	this->height = height;	
 	matrixDirty = true;	
 	matrixDirty = true;	
-	setHitbox(width,height);
 	
 	
 	if(multiLine) {
 	if(multiLine) {
 		inputRect->setHitbox(width - scrollContainer->getVScrollWidth(), height);		
 		inputRect->setHitbox(width - scrollContainer->getVScrollWidth(), height);		
@@ -711,7 +710,7 @@ void UITextInput::Resize(Number width, Number height) {
 		renumberLines();
 		renumberLines();
 		readjustBuffer();
 		readjustBuffer();
 		if(lineNumbersEnabled) {
 		if(lineNumbersEnabled) {
-			lineNumberBg->setShapeSize(decoratorOffset, height);
+			lineNumberBg->setPrimitiveOptions(ScenePrimitive::TYPE_VPLANE, decoratorOffset, height);
 		}		
 		}		
 	}
 	}
 	
 	
@@ -846,7 +845,7 @@ void UITextInput::restructLines() {
 	}
 	}
 	
 	
 	if(multiLine && lineNumbersEnabled) {
 	if(multiLine && lineNumbersEnabled) {
-		lineNumberBg->setShapeSize(decoratorOffset, height);
+		lineNumberBg->setPrimitiveOptions(ScenePrimitive::TYPE_VPLANE, decoratorOffset, height);
 	}
 	}
 	
 	
 	if(scrollContainer) {
 	if(scrollContainer) {
@@ -2514,7 +2513,7 @@ void UITextInput::handleEvent(Event *event) {
 					}
 					}
 				} else {
 				} else {
 					if(parentEntity) {
 					if(parentEntity) {
-						((ScreenEntity*)parentEntity)->focusChild(this);
+						((Entity*)parentEntity)->focusChild(this);
 					} else {
 					} else {
 						hasFocus = true;
 						hasFocus = true;
 					}
 					}

+ 9 - 10
Modules/Contents/UI/Source/PolyUITree.cpp

@@ -48,15 +48,15 @@ UITree::UITree(String icon, String text, Number treeWidth, Number treeOffset) :
 	cellHeight = conf->getNumericValue("Polycode", "uiTreeCellHeight");
 	cellHeight = conf->getNumericValue("Polycode", "uiTreeCellHeight");
 	this->size = conf->getNumericValue("Polycode", "uiDefaultFontSize");
 	this->size = conf->getNumericValue("Polycode", "uiDefaultFontSize");
 	this->arrowIcon = conf->getStringValue("Polycode", "uiTreeArrowIconImage");	
 	this->arrowIcon = conf->getStringValue("Polycode", "uiTreeArrowIconImage");	
-	textLabel = new ScreenLabel(
+	textLabel = new SceneLabel(
 								text,
 								text,
 								size,
 								size,
 								fontName,
 								fontName,
 								Label::ANTIALIAS_FULL);
 								Label::ANTIALIAS_FULL);
 	textLabel->color.setColorHexFromString(conf->getStringValue("Polycode", "uiTreeFontColor"));
 	textLabel->color.setColorHexFromString(conf->getStringValue("Polycode", "uiTreeFontColor"));
 	
 	
-	bgBox = new ScreenShape(ScreenShape::SHAPE_RECT, treeWidth, cellHeight);	
-	bgBox->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
+	bgBox = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, treeWidth, cellHeight);	
+	bgBox->setPositionMode(Entity::POSITION_TOPLEFT);
 	bgBox->setPosition(-treeOffset,0);	
 	bgBox->setPosition(-treeOffset,0);	
 	bgBox->setColor(1, 1, 1, 0);
 	bgBox->setColor(1, 1, 1, 0);
 	addChild(bgBox);
 	addChild(bgBox);
@@ -74,14 +74,14 @@ UITree::UITree(String icon, String text, Number treeWidth, Number treeOffset) :
 						  st,sr,sb,sl,
 						  st,sr,sb,sl,
 						  treeWidth+(padding*2), cellHeight+(padding*2));
 						  treeWidth+(padding*2), cellHeight+(padding*2));
 	
 	
-	selection->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
+	selection->setPositionMode(Entity::POSITION_TOPLEFT);
 	selection->setPosition(-treeOffset-padding,-padding);
 	selection->setPosition(-treeOffset-padding,-padding);
 	selection->visible = false;
 	selection->visible = false;
 	addChild(selection);
 	addChild(selection);
-	arrowIconImage = new ScreenImage(arrowIcon.c_str());
+	arrowIconImage = new SceneImage(arrowIcon.c_str());
 	arrowIconImage->setPosition(cellPadding,(cellHeight-arrowIconImage->getHeight())/2.0f);
 	arrowIconImage->setPosition(cellPadding,(cellHeight-arrowIconImage->getHeight())/2.0f);
 	addChild(arrowIconImage);
 	addChild(arrowIconImage);
-	iconImage = new ScreenImage(icon.c_str());
+	iconImage = new SceneImage(icon.c_str());
 	addChild(iconImage);
 	addChild(iconImage);
 	iconImage->setPosition(arrowIconImage->getWidth()+(cellPadding*2),(cellHeight-iconImage->getHeight())/2.0f);
 	iconImage->setPosition(arrowIconImage->getWidth()+(cellPadding*2),(cellHeight-iconImage->getHeight())/2.0f);
 
 
@@ -105,7 +105,7 @@ UITree::UITree(String icon, String text, Number treeWidth, Number treeOffset) :
 	bgBox->addEventListener(this, InputEvent::EVENT_DOUBLECLICK);	
 	bgBox->addEventListener(this, InputEvent::EVENT_DOUBLECLICK);	
 	bgBox->processInputEvents = true;
 	bgBox->processInputEvents = true;
 		
 		
-	setPositionMode(ScreenEntity::POSITION_CENTER);
+	setPositionMode(Entity::POSITION_CENTER);
 	
 	
 	refreshTree();
 	refreshTree();
 }
 }
@@ -113,7 +113,7 @@ UITree::UITree(String icon, String text, Number treeWidth, Number treeOffset) :
 void UITree::Resize(Number width) {
 void UITree::Resize(Number width) {
 	treeWidth = width;
 	treeWidth = width;
 	selection->resizeBox(treeWidth+(padding*2), cellHeight+(padding*2));
 	selection->resizeBox(treeWidth+(padding*2), cellHeight+(padding*2));
-	bgBox->setShapeSize(width, cellHeight);
+	bgBox->setPrimitiveOptions(ScenePrimitive::TYPE_VPLANE, width, cellHeight);
 	
 	
 	for(int i=0; i < treeChildren.size(); i++) {
 	for(int i=0; i < treeChildren.size(); i++) {
 		treeChildren[i]->Resize(width);
 		treeChildren[i]->Resize(width);
@@ -268,7 +268,6 @@ void UITree::refreshTree() {
 	}
 	}
 	height = treeHeight + cellHeight;
 	height = treeHeight + cellHeight;
 	width = treeWidth;
 	width = treeWidth;
-	setHitbox(width, height);
 	
 	
 	selection->visible = selected;
 	selection->visible = selected;
 	dispatchEvent(new UITreeEvent(), UITreeEvent::NEED_REFRESH_EVENT);	
 	dispatchEvent(new UITreeEvent(), UITreeEvent::NEED_REFRESH_EVENT);	
@@ -309,7 +308,7 @@ void UITree::clearTree() {
 }
 }
 
 
 void UITree::Update() {
 void UITree::Update() {
-	arrowIconImage->setRotation(handleRotation);
+	arrowIconImage->setRoll(handleRotation);
 	if(treeChildren.size() > 0)
 	if(treeChildren.size() > 0)
 		arrowIconImage->visible = true;
 		arrowIconImage->visible = true;
 	else
 	else

+ 2 - 2
Modules/Contents/UI/Source/PolyUITreeContainer.cpp

@@ -49,7 +49,7 @@ UITreeContainer::UITreeContainer(String icon, String text, Number treeWidth, Num
 	blockMouseInput = true;
 	blockMouseInput = true;
 	//bgBox->setPosition(-padding, -padding);
 	//bgBox->setPosition(-padding, -padding);
 	
 	
-	scrollChild = new ScreenEntity();
+	scrollChild = new Entity();
 	scrollChild->processInputEvents = true;
 	scrollChild->processInputEvents = true;
 	
 	
 	rootNode = new UITree(icon, text, treeWidth,0);		
 	rootNode = new UITree(icon, text, treeWidth,0);		
@@ -100,7 +100,7 @@ void UITreeContainer::handleEvent(Event *event) {
 		if (!hasFocus) {
 		if (!hasFocus) {
 			if (event->getEventCode() == InputEvent::EVENT_MOUSEDOWN) {
 			if (event->getEventCode() == InputEvent::EVENT_MOUSEDOWN) {
 				if (parentEntity && isFocusable())
 				if (parentEntity && isFocusable())
-					((ScreenEntity*)parentEntity)->focusChild(this);
+					((Entity*)parentEntity)->focusChild(this);
 			} else if (event->getEventCode() == InputEvent::EVENT_MOUSEOVER) {
 			} else if (event->getEventCode() == InputEvent::EVENT_MOUSEOVER) {
 				CoreServices::getInstance()->getCore()->setCursor(Core::CURSOR_ARROW);
 				CoreServices::getInstance()->getCore()->setCursor(Core::CURSOR_ARROW);
 			}
 			}

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff