void BackgroundActor::UpdateUVs(float horizontal, float vertical) { Vector2 lowerLeft; Vector2 upperRight; GetUVs(lowerLeft, upperRight); lowerLeft.X += horizontal; lowerLeft.Y += vertical; upperRight.X += horizontal; upperRight.Y += vertical; SetUVs(lowerLeft, upperRight); }
Actor::Actor() { SetColor(1.0f, 1.0f, 1.0f); SetAlpha(1.0f); SetSize(1.0f); SetRotation(0.0f); SetPosition(0.0f, 0.0f); SetUVs(Vector2(0.f, 0.f), Vector2(1.f, 1.f)); SetTextureScales(1.0f, 1.0f); _name = ""; _spriteNumFrames = 0; _spriteCurrentFrame = 0; _spriteTextureReferences[0] = -1; _spriteFrameDelay = 0.0f; _displayListIndex = -1; _layer = 0; _drawShape = ADS_Square; }
Actor::Actor() { SetColor(1.0f, 1.0f, 1.0f); SetAlpha(1.0f); SetSize(1.0f); SetRotation(0.0f); SetPosition(0.0f, 0.0f); SetUVs(Vector2(0.f, 0.f), Vector2(1.f, 1.f)); SetName(""); _spriteNumFrames = 0; _spriteCurrentFrame = 0; _spriteTextureReferences[0] = -1; //to avoid accidentally reusing textures // (outside of VS, this value could be initialized as // non-negative which leads to textures getting used // where they shouldn't (see Render() ) ) _spriteFrameDelay = 0.0f; _layer = 0; _drawShape = ADS_Square; }
Actor::Actor() { if (!__inittedActorCirclePoints) { Actor::_circleVertices[0] = 0.0f; Actor::_circleVertices[1] = 0.0f; Actor::_circleTextureCoords[0] = 0.5f; Actor::_circleTextureCoords[1] = 0.5f; for (int i=1; i < CIRCLE_DRAW_SECTIONS+2; i++) { Actor::_circleVertices[i*2] = 0.5f * cos((float) MathUtil::TwoPi * i / CIRCLE_DRAW_SECTIONS); Actor::_circleVertices[(i*2)+1] = 0.5f * sin((float) MathUtil::TwoPi * i / CIRCLE_DRAW_SECTIONS); Actor::_circleTextureCoords[i*2] = Actor::_circleVertices[i*2] + 0.5f; Actor::_circleTextureCoords[(i*2)+1] = Actor::_circleVertices[(i*2)+1] + 0.5f; } __inittedActorCirclePoints = true; } SetColor(1.0f, 1.0f, 1.0f); SetAlpha(1.0f); SetSize(1.0f); SetRotation(0.0f); SetPosition(0.0f, 0.0f); SetUVs(Vector2(0.f, 0.f), Vector2(1.f, 1.f)); _name = ""; _spriteNumFrames = 0; _spriteCurrentFrame = 0; _spriteTextureReferences[0] = -1; _spriteFrameDelay = 0.0f; _displayListIndex = -1; _layer = 0; _drawShape = ADS_Square; }
void Shape::FlipRight() { SetUVs(Vector2(0.0f, 0.0f), Vector2(1.0f, 1.0f)); _facingRight = true; }
void Shape::FlipLeft() { SetUVs(Vector2(1.0f, 0.0f), Vector2(0.0f, 1.0f)); _facingRight = false; }