本文整理汇总了C++中SpriteSheet::width方法的典型用法代码示例。如果您正苦于以下问题:C++ SpriteSheet::width方法的具体用法?C++ SpriteSheet::width怎么用?C++ SpriteSheet::width使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpriteSheet
的用法示例。
在下文中一共展示了SpriteSheet::width方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pointIn
bool SceneObject::pointIn(double _x, double _y)
{
// Return false if we do not live in the world
if (!hasComponent("Transform"))
return false;
double x = ((TransformComponent*)m_Components["Transform"])->getPositionX();
double y = ((TransformComponent*)m_Components["Transform"])->getPositionY();
double width, height;
// Are we visible?
if (hasComponent("Renderable")) {
Camera& cam = RenderManager::getCurrentContext()->camera();
int layer;
if (((RenderComponent*)m_Components["Renderable"])->hasSprite()) {
Sprite *spr = ((RenderComponent*)m_Components["Renderable"])->getSprite();
width = spr->width();
height = spr->height();
layer = spr->layer();
}
if (((RenderComponent*)m_Components["Renderable"])->hasSpriteSheet()) {
SpriteSheet *spr = ((RenderComponent*)m_Components["Renderable"])->getSpriteSheet();
width = spr->width();
height = spr->height();
layer = spr->layer();
}
CameraTransform ctrans = cam.screenToWorld(width, height, layer);
CameraTransform ctrans2 = cam.screenToWorld(0.0, 0.0, layer);
width = ctrans.x - ctrans2.x;
height = ctrans.y - ctrans2.y;
}else// If we aren't visible, do we have a shape?
if (hasComponent("Physics")) {
}else{
width = 0.5;
height = 0.5;
}
}