Ver Fonte

Make some ScreenEntity methods const

Nur Monson há 12 anos atrás
pai
commit
4ef25a5c2e

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

@@ -113,13 +113,13 @@ class _PolyExport ScreenEntity : public Entity {
 		void _onKeyDown(PolyKEY key, wchar_t charCode);	
 		void _onKeyUp(PolyKEY key, wchar_t charCode);	
 		
-		Matrix4 getScreenConcatenatedMatrix();
+		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);
-		bool hitTest(Vector2 v);
+		bool hitTest(Number x, Number y) const;
+		bool hitTest(Vector2 v) const;
 	
 		Matrix4 buildPositionMatrix();
 		void adjustMatrixForChildren();

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

@@ -272,7 +272,7 @@ bool isPointInsidePolygon2D(Polycode::Polygon *poly, const Vector2 &p) {
 }
 
 
-bool ScreenEntity::hitTest(const Number x, const Number y) {
+bool ScreenEntity::hitTest(const Number x, const Number y) const {
 
 	Vector3 v;	
 	Polygon testPoly;
@@ -307,7 +307,7 @@ bool ScreenEntity::hitTest(const Number x, const Number y) {
 	return isPointInsidePolygon2D(&testPoly, Vector2(x,y));
 }
 
-bool ScreenEntity::hitTest(Vector2 v)
+bool ScreenEntity::hitTest(Vector2 v) const
 {
 	return hitTest(v.x, v.y);
 }
@@ -369,7 +369,7 @@ bool ScreenEntity::isDragged() {
 	return dragged;
 }
 
-Matrix4 ScreenEntity::getScreenConcatenatedMatrix() {
+Matrix4 ScreenEntity::getScreenConcatenatedMatrix() const {
 	Matrix4 retMatrix = transformMatrix;
 	if(positionMode == POSITION_TOPLEFT) {
 		retMatrix.setPosition(position.x, position.y, position.z);