Преглед изворни кода

Merge branch 'const-and-opts' into pxljm

Cameron Hart пре 14 година
родитељ
комит
4c721bcc01
2 измењених фајлова са 13 додато и 13 уклоњено
  1. 6 6
      Core/Contents/Include/PolyScreenEntity.h
  2. 7 7
      Core/Contents/Source/PolyScreenEntity.cpp

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

@@ -68,7 +68,7 @@ class _PolyExport ScreenEntity : public Entity, public EventDispatcher {
 		* Returns current rotation.
 		* @return Current rotation value.
 		*/						
-		Number getRotation();
+		Number getRotation() const;
 			
 		bool _onMouseDown(Number x, Number y, int mouseButton, int timestamp);
 		bool _onMouseUp(Number x, Number y, int mouseButton, int timestamp);
@@ -88,7 +88,7 @@ class _PolyExport ScreenEntity : public Entity, public EventDispatcher {
 		virtual void onKeyDown(PolyKEY key, wchar_t charCode){}
 		virtual void onKeyUp(PolyKEY key, wchar_t charCode){}
 		
-		bool hitTest(Number x, Number y);		
+		bool hitTest(Number x, Number y) const;
 	
 		Matrix4 buildPositionMatrix();
 		void adjustMatrixForChildren();
@@ -97,13 +97,13 @@ class _PolyExport ScreenEntity : public Entity, public EventDispatcher {
 		* Returns the width of the screen entity.
 		* @return Height of the screen entity.
 		*/									
-		Number getWidth();
+		Number getWidth() const;
 		
 		/**
 		* Returns the height of the screen entity.
 		* @param w New height value.
 		*/											
-		Number getHeight();
+		Number getHeight() const;
 	
 		/**
 		* Sets the width of the screen entity.
@@ -141,12 +141,12 @@ class _PolyExport ScreenEntity : public Entity, public EventDispatcher {
 		void focusChild(ScreenEntity *child);
 		void focusNextChild();
 	
-		Vector2 getPosition2D();
+		Vector2 getPosition2D() const;
 		
 		static const int POSITION_TOPLEFT = 0;
 		static const int POSITION_CENTER = 1;
 
-		bool isFocusable();
+		bool isFocusable() const;
 		
 		bool hasFocus;
 		bool blockMouseInput;

+ 7 - 7
Core/Contents/Source/PolyScreenEntity.cpp

@@ -30,7 +30,7 @@ inline double round(double x) { return floor(x + 0.5); }
 using namespace Polycode;
 
 ScreenEntity::ScreenEntity() : Entity(), EventDispatcher() {
-	color = new Color(1.0f,1.0f,1.0f,1.0f);
+	color = Color(1.0f,1.0f,1.0f,1.0f);
 	width = 1;
 	height = 1;
 	hitwidth = 1;
@@ -85,7 +85,7 @@ void ScreenEntity::focusNextChild() {
 	}
 }
 
-Number ScreenEntity::getRotation() {
+Number ScreenEntity::getRotation() const {
 	return this->getRoll();
 }
 
@@ -99,7 +99,7 @@ void ScreenEntity::focusChild(ScreenEntity *child) {
 	focusedChild->onGainFocus();
 }
 
-bool ScreenEntity::isFocusable() {
+bool ScreenEntity::isFocusable() const {
 	return focusable;
 }
 
@@ -133,15 +133,15 @@ void ScreenEntity::setScale(Number x, Number y) {
 	matrixDirty = true;	
 }
 
-Number ScreenEntity::getWidth() {
+Number ScreenEntity::getWidth() const {
 	return width;
 }
 
-Number ScreenEntity::getHeight() {
+Number ScreenEntity::getHeight() const {
 	return height;
 }
 
-bool ScreenEntity::hitTest(Number x, Number y) {
+bool ScreenEntity::hitTest(Number x, Number y) const {
 	bool retVal = false;
     // apply compound scale to test hit against
     Vector3 compScale = getCompoundScale();
@@ -365,7 +365,7 @@ void ScreenEntity::setRotation(Number rotation) {
 	setRoll(rotation);
 }
 
-Vector2 ScreenEntity::getPosition2D() {
+Vector2 ScreenEntity::getPosition2D() const {
 	return Vector2(position.x, position.y);
 }