mirror of https://github.com/axmolengine/axmol.git
modify vec2
This commit is contained in:
parent
5d11c586e2
commit
84e9cd3a77
|
@ -41,56 +41,56 @@ Rect VisibleRect::getVisibleRect()
|
|||
return s_visibleRect;
|
||||
}
|
||||
|
||||
Vector2 VisibleRect::left()
|
||||
Vec2 VisibleRect::left()
|
||||
{
|
||||
lazyInit();
|
||||
return Vector2(s_visibleRect.origin.x, s_visibleRect.origin.y+s_visibleRect.size.height/2);
|
||||
return Vec2(s_visibleRect.origin.x, s_visibleRect.origin.y+s_visibleRect.size.height/2);
|
||||
}
|
||||
|
||||
Vector2 VisibleRect::right()
|
||||
Vec2 VisibleRect::right()
|
||||
{
|
||||
lazyInit();
|
||||
return Vector2(s_visibleRect.origin.x+s_visibleRect.size.width, s_visibleRect.origin.y+s_visibleRect.size.height/2);
|
||||
return Vec2(s_visibleRect.origin.x+s_visibleRect.size.width, s_visibleRect.origin.y+s_visibleRect.size.height/2);
|
||||
}
|
||||
|
||||
Vector2 VisibleRect::top()
|
||||
Vec2 VisibleRect::top()
|
||||
{
|
||||
lazyInit();
|
||||
return Vector2(s_visibleRect.origin.x+s_visibleRect.size.width/2, s_visibleRect.origin.y+s_visibleRect.size.height);
|
||||
return Vec2(s_visibleRect.origin.x+s_visibleRect.size.width/2, s_visibleRect.origin.y+s_visibleRect.size.height);
|
||||
}
|
||||
|
||||
Vector2 VisibleRect::bottom()
|
||||
Vec2 VisibleRect::bottom()
|
||||
{
|
||||
lazyInit();
|
||||
return Vector2(s_visibleRect.origin.x+s_visibleRect.size.width/2, s_visibleRect.origin.y);
|
||||
return Vec2(s_visibleRect.origin.x+s_visibleRect.size.width/2, s_visibleRect.origin.y);
|
||||
}
|
||||
|
||||
Vector2 VisibleRect::center()
|
||||
Vec2 VisibleRect::center()
|
||||
{
|
||||
lazyInit();
|
||||
return Vector2(s_visibleRect.origin.x+s_visibleRect.size.width/2, s_visibleRect.origin.y+s_visibleRect.size.height/2);
|
||||
return Vec2(s_visibleRect.origin.x+s_visibleRect.size.width/2, s_visibleRect.origin.y+s_visibleRect.size.height/2);
|
||||
}
|
||||
|
||||
Vector2 VisibleRect::leftTop()
|
||||
Vec2 VisibleRect::leftTop()
|
||||
{
|
||||
lazyInit();
|
||||
return Vector2(s_visibleRect.origin.x, s_visibleRect.origin.y+s_visibleRect.size.height);
|
||||
return Vec2(s_visibleRect.origin.x, s_visibleRect.origin.y+s_visibleRect.size.height);
|
||||
}
|
||||
|
||||
Vector2 VisibleRect::rightTop()
|
||||
Vec2 VisibleRect::rightTop()
|
||||
{
|
||||
lazyInit();
|
||||
return Vector2(s_visibleRect.origin.x+s_visibleRect.size.width, s_visibleRect.origin.y+s_visibleRect.size.height);
|
||||
return Vec2(s_visibleRect.origin.x+s_visibleRect.size.width, s_visibleRect.origin.y+s_visibleRect.size.height);
|
||||
}
|
||||
|
||||
Vector2 VisibleRect::leftBottom()
|
||||
Vec2 VisibleRect::leftBottom()
|
||||
{
|
||||
lazyInit();
|
||||
return s_visibleRect.origin;
|
||||
}
|
||||
|
||||
Vector2 VisibleRect::rightBottom()
|
||||
Vec2 VisibleRect::rightBottom()
|
||||
{
|
||||
lazyInit();
|
||||
return Vector2(s_visibleRect.origin.x+s_visibleRect.size.width, s_visibleRect.origin.y);
|
||||
return Vec2(s_visibleRect.origin.x+s_visibleRect.size.width, s_visibleRect.origin.y);
|
||||
}
|
||||
|
|
|
@ -8,15 +8,15 @@ class VisibleRect
|
|||
public:
|
||||
static cocos2d::Rect getVisibleRect();
|
||||
|
||||
static cocos2d::Vector2 left();
|
||||
static cocos2d::Vector2 right();
|
||||
static cocos2d::Vector2 top();
|
||||
static cocos2d::Vector2 bottom();
|
||||
static cocos2d::Vector2 center();
|
||||
static cocos2d::Vector2 leftTop();
|
||||
static cocos2d::Vector2 rightTop();
|
||||
static cocos2d::Vector2 leftBottom();
|
||||
static cocos2d::Vector2 rightBottom();
|
||||
static cocos2d::Vec2 left();
|
||||
static cocos2d::Vec2 right();
|
||||
static cocos2d::Vec2 top();
|
||||
static cocos2d::Vec2 bottom();
|
||||
static cocos2d::Vec2 center();
|
||||
static cocos2d::Vec2 leftTop();
|
||||
static cocos2d::Vec2 rightTop();
|
||||
static cocos2d::Vec2 leftBottom();
|
||||
static cocos2d::Vec2 rightBottom();
|
||||
private:
|
||||
static void lazyInit();
|
||||
static cocos2d::Rect s_visibleRect;
|
||||
|
|
Loading…
Reference in New Issue