/*! * \param f frame number */ void AnimatedSprite::setFrame(int f) { lock(); RANGERS_D(AnimatedSprite); d->currentFrame = f; unlock(); }
void Label::setFont(boost::shared_ptr<Font> font) { lock(); RANGERS_D(Label); d->font = font; markToUpdate(); unlock(); }
void Label::setWordWrap(bool wordWrap) { lock(); RANGERS_D(Label); d->wordWrap = wordWrap; markToUpdate(); unlock(); }
void Label::setText(const std::string& text) { lock(); RANGERS_D(Label); d->text = text; markToUpdate(); unlock(); }
void AnimatedSprite::reset() { lock(); RANGERS_D(AnimatedSprite); d->animationStarted = false; d->currentFrame = 0; d->animationTime = 0; unlock(); }
void Node::processLogic(int dt) { RANGERS_D(Node); lock(); std::list<Object*> children = d->children; unlock(); for (std::list<Object*>::const_iterator i = children.begin(); i != children.end(); i++) (*i)->processLogic(dt); }
Label::Label(const std::string& text, boost::shared_ptr<Font> font): Sprite(*(new LabelPrivate())) { RANGERS_D(Label); if (!font) d->font = Engine::instance().coreFont(); else d->font = font; setText(text); }
void Label::setFixedHeight(float h) { RANGERS_D(Label); d->fixedHeight = true; if (h > 0) d->height = h; else d->fixedHeight = false; markToUpdate(); }
void Label::setFixedWidth(float w) { RANGERS_D(Label); d->fixedWidth = true; if (w > 0) d->width = w; else d->fixedWidth = false; markToUpdate(); }
/*! * \param texture texture * \param parent object parent */ AnimatedSprite::AnimatedSprite(boost::shared_ptr<AnimatedTexture> texture): Sprite(*(new AnimatedSpritePrivate())) { RANGERS_D(AnimatedSprite); d->region = TextureRegion(texture); if (texture) { d->width = texture->width(); d->height = texture->height(); start(); } }
/*! * \param animation animation resource name * \param parent object parent */ AnimatedSprite::AnimatedSprite(const std::string& animation): Sprite(*(new AnimatedSpritePrivate())) { RANGERS_D(AnimatedSprite); boost::shared_ptr<AnimatedTexture> animTexture = ResourceManager::instance().loadAnimation(animation); d->region = TextureRegion(animTexture); if (animTexture) { d->width = animTexture->width(); d->height = animTexture->height(); start(); } markToUpdate(); }
void Label::setFixedSize(float width, float height) { lock(); RANGERS_D(Label); if ((width > 0) && (height > 0)) { d->width = width; d->height = height; d->fixedHeight = true; d->fixedWidth = true; } else { d->fixedHeight = false; d->fixedWidth = false; } markToUpdate(); unlock(); }
void Label::processMain() { RANGERS_D(Label); if (!d->font) return; lock(); if (!d->wordWrap) d->region = TextureRegion(d->font->renderText(fromUTF8(d->text.c_str()))); else d->region = TextureRegion(d->font->renderText(fromUTF8(d->text.c_str()), d->width)); if (!d->fixedWidth) d->width = d->region.texture->width(); if (!d->fixedHeight) d->height = d->region.texture->height(); unlock(); Sprite::processMain(); }
void TiledBeizerCurve::calcCurve() { RANGERS_D(TiledBeizerCurve); std::list<Vector> points; Vector dir; Vector p0 = d->calcBezierPoint(0.0f, dir); Vector p1 = d->calcBezierPoint(1.0f, dir); points.push_back(p0); points.push_back(p1); std::list<Vector>::iterator i = points.begin(); ++i; d->findPoints(0.0f, 1.0f, points, i); d->points = std::vector<Vector>(points.size()); std::copy(points.begin(), points.end(), d->points.begin()); markToUpdate(); }
void TiledBeizerCurve::setCurve(const BeizerCurve& curve) { RANGERS_D(TiledBeizerCurve); d->curve = curve; calcCurve(); }
TiledBeizerCurve::TiledBeizerCurve(const std::string& texture): TiledPolyline(*(new TiledBeizerCurvePrivate())) { RANGERS_D(TiledBeizerCurve); d->texture = ResourceManager::instance().loadTexture(texture); }
TiledBeizerCurve::TiledBeizerCurve(boost::shared_ptr<Texture> texture): TiledPolyline(*(new TiledBeizerCurvePrivate())) { RANGERS_D(TiledBeizerCurve); d->texture = texture; }