void SakuraParticle::InitWithType(int type) { auto stgResources = STGResources::GetInstance(); SetTexture(stgResources->texEffBase); switch (type) { case 0: SetTexRect(Rect(0, 32, 224, 256)); break; case 1: SetTexRect(Rect(32, 64, 224, 256)); break; case 2: SetTexRect(Rect(192, 224, 224, 256)); break; } }
ButterFly::ButterFly() { auto STGResources = STGResources::GetInstance(); SetTexture(STGResources->texEnemy01); SetTexRect(Rect(0, 64, 384, 448)); hitRange = 8.0f; }
void ScoreNumber::Update() { Sprite::Update(); switch (number) { case 0: SetTexRect(Rect(96, 109, 8, 24)); break; case 1: SetTexRect(Rect(109, 122, 8, 24)); break; case 2: SetTexRect(Rect(122, 135, 8, 24)); break; case 3: SetTexRect(Rect(135, 148, 8, 24)); break; case 4: SetTexRect(Rect(148, 161, 8, 24)); break; case 5: SetTexRect(Rect(161, 174, 8, 24)); break; case 6: SetTexRect(Rect(174, 187, 8, 24)); break; case 7: SetTexRect(Rect(187, 200, 8, 24)); break; case 8: SetTexRect(Rect(200, 213, 8, 24)); break; case 9: SetTexRect(Rect(213, 226, 8, 24)); break; default: break; } }
void SelectTitle::SetType(SelectTitle::Type type) { this->type = type; switch (type) { case RANK_SELECT: SetTexRect(Rect(0, 256, 0, 96)); break; case PLAYER_SELECT: SetTexRect(Rect(0, 256, 96, 192)); break; case REPLAY: SetTexRect(Rect(0, 256, 192, 288)); break; case PLAYER_DATA: SetTexRect(Rect(0, 256, 288, 384)); break; case MUSIC_ROOM: SetTexRect(Rect(0, 256, 384, 480)); break; case SPELL_SELECT: SetTexRect(Rect(256, 512, 0, 96)); break; case SAVE_REPLAY: SetTexRect(Rect(256, 512, 96, 192)); break; case MANUAL: SetTexRect(Rect(256, 512, 192, 288)); break; case OPTION: SetTexRect(Rect(256, 512, 288, 384)); break; case STAGE_SELECT: SetTexRect(Rect(256, 512, 384, 480)); break; } }
void ButterFly::Update() { Enemy::Update(); int left; int period = frameForAnim / ANIM_INTERVAL; switch (motionState) { case STATIC: left = period * 64; SetTexRect(Rect(left, left + 64, 384, 448)); break; case STATIC_TO_LEFT: left = period * 64 + 256; SetTexRect(Rect(left, left + 64, 384, 448)); SetFlipX(true); break; case STATIC_TO_RIGHT: left = period * 64 + 256; SetTexRect(Rect(left, left + 64, 384, 448)); break; case LEFT_TO_STATIC: left = 448 - period * 64; SetTexRect(Rect(left, left + 64, 384, 448)); SetFlipX(true); break; case RIGHT_TO_STATIC: left = 448 - period * 64; SetTexRect(Rect(left, left + 64, 384, 448)); break; case LEFT: case RIGHT: if (period < 2) { left = 384 + 64 * period; SetTexRect(Rect(left, left + 64, 256, 320)); } else { left = 256 + 64 * period; SetTexRect(Rect(left, left + 64, 320, 384)); } if (motionState == LEFT) { SetFlipX(true); } default: break; } }
/* (0, 0) +--+--+--+--+--+--+--+--+ | + | +--+--+--+--+ | | | | | | +--+--+--+--+ | + | +--+--+--+--+--+--+--+--+ (1.f, 1.f) */ bool EEFont::AdaptivePos() { if (!m_isDynamic && m_isAdaptive) { if (GetFontTotalWidth() || GetFontTotalHeight()) { float beginX = ((GetFontTotalWidth() - GetWidth()) * m_adaptivePos.x) / GetFontTotalWidth(); float endX = beginX + GetWidth() / GetFontTotalWidth(); float beginY = ((GetFontTotalHeight() - GetHeight()) * m_adaptivePos.x) / GetFontTotalHeight(); float endY = beginY + GetHeight() / GetFontTotalHeight(); SetTexRect(Rect_Float(beginX, beginY, endX, endY)); return true; } } return false; }