/* init Dlg */ void ExcDlgPowerTotal::InitDlg(void) { int i = 0; //unsigned char str[1] = { 'L' }; unsigned char buff[32] = {0}; ClearAll(); SetMemAera(16, 0, GPS_16X32_8BIT, DISPLAY, false); SetRectangle(0, 18, 160, 2, false); SetRectangle(0, 142, 160, 2, false); SetRectangle(138, 147, 16, 8, false); SetRectangle(136, 149, 2, 4, false); //DISPLAY_8x16_SR(64, 2, false); DISPLAY_16x16_DIANNENGLIANG(55, 25, false); DISPLAY_ZHENGXIANGYOUGONG(0, 45, false); DISPLAY_ZHENGXIANGWUGONG(0, 63, false); DISPLAY_FANXIANGYOUGONG(0, 81, false); DISPLAY_FANXIANGWUGONG(0, 99, false); DISPLAY_8x16_KWH(120, 45, false); DISPLAY_8x16_KVARH(120, 63, false); DISPLAY_8x16_KWH(120, 81, false); DISPLAY_8x16_KVARH(120, 99, false); DISPLAY_8x16_000000000210(0, 144, false); DisplayTime(120, 2); return; }
/* init Dlg */ void ExcDlgWelcome::InitDlg(void) { int i = 0; //unsigned char str[1] = { 'L' }; unsigned char buff[32] = {0}; ClearAll(); //logo //SetMemAera(144, 0, LOONGSON_LOGO16X16_8BIT, DISPLAY, false); SetMemAera(10, 40, LOONGSON_LOGO32X32_8BIT, DISPLAY, false); SetMemAera(16, 0, GPS_16X32_8BIT, DISPLAY, false); SetRectangle(0, 18, 160, 2, false); SetRectangle(0, 142, 160, 2, false); SetRectangle(138, 147, 16, 8, false); SetRectangle(136, 149, 2, 4, false); //DISPLAY_8x16_SR(64, 2, false); #if 0 // title m_AmrDisplay.ZKDisplayConvert((char *)"L" , ASCII12, buff); SetZIFUAera(50, 10, ASCII12, buff, DISPLAY, false); #else DISPLAY_16x16_BEIJINGSHENZHOULONGXIN(50, 40, false); DISPLAY_8x16_000000000210(0, 144, false); DISPLAY_16x16_DIANLIZHUANBIANXITONG(25, 76, false); DisplayTime(120, 2); #endif return; }
HPTRect &ProjectileNinjaStar::GetWeaponBounds() { if(proj_params.timeDelay <= 0) SetRectangle(hptrectBounds, 8, 8, -4, -4); else SetRectangle(hptrectBounds, 0, 0, 0, 0); return hptrectBounds; }
HPTRect &EnemyWolfGawain::GetWeaponWorldLoc() { if(!HIT) SetRectangle(rectWeaponWorldLoc, 15, 15, -nxOffSet, 15); else SetRectangle(rectWeaponWorldLoc, 0, 0, 0, 0); return rectWeaponWorldLoc; }
HPTRect &EnemyElectricField::GetWeaponWorldLoc() { if(bOrientation) SetRectangle(rectWeaponWorldLoc, 16, 96, -8, -48); else SetRectangle(rectWeaponWorldLoc, 96, 16, -48, -8); return rectWeaponWorldLoc; }
HPTRect &EnemyGMonsterFire::GetWeaponWorldLoc() { if((player_spr->GetFrameSet() == ENEMY_FIRE_MONSTER_ATTACK) && (player_spr->GetFrame() == 8)) SetRectangle(rectWeaponWorldLoc, 60, 45, -10 + nxOffSet, -25); // SetRectangle(rectWeaponWorldLoc, 60, 60, 0, 0); else SetRectangle(rectWeaponWorldLoc, 0, 0, 0, 0); return rectWeaponWorldLoc; }
HPTRect &ProjectileJunkbotLarge::GetWeaponBounds() { if(proj_params.timeDelay <= 0) SetRectangle(hptrectBounds, 36, 72, -18, -36); else SetRectangle(hptrectBounds, 0, 0, 0, 0); return hptrectBounds; }
HPTRect &EnemyPunk::GetWeaponWorldLoc() { if(player_spr->GetFrameSet() == ENEMY_PUNK_ANIM_JUMP) { SetRectangle(rectWeaponWorldLoc, 15, 15, 5, -5); } else SetRectangle(rectWeaponWorldLoc, 0, 0, 0, 0); return rectWeaponWorldLoc; }
HPTRect &ProjectilePrisonerRock::GetWeaponBounds() { if(proj_params.timeDelay <= 0) SetRectangle(hptrectBounds, 12, 12, -6, -6); else SetRectangle(hptrectBounds, 0, 0, 0, 0); return hptrectBounds; }
void PBodyTabContrl::_construct() { VITabCtrl::EnableWindow(true); VITabCtrl::EnableAutomation(); VITabCtrl::ShowWindow(SW_SHOW); AFX_MANAGE_STATE(AfxGetStaticModuleState()); m_tabCurrent=0; //m_tabPages[0]->Create(IDD_PBCOMMON, this); //m_tabPages[1]->Create(IDD_PBCOMMON, this); //m_tabPages[0]->ShowWindow(SW_SHOW); //m_tabPages[1]->ShowWindow(SW_SHOW); //m_tabPages[1]->ShowWindow(SW_SHOW); //m_tabPages[2]->ShowWindow(SW_HIDE); m_nNumberOfPages = 1; SetRectangle(); }
LRESULT CTabCtrlEx::OnSize(UINT state, CSize Size) { //DefWindowProc(); SetRectangle(); SetMsgHandled(FALSE); return 0; }
HPTRect &EnemyDockWorkerWrench::GetWeaponWorldLoc() { if((player_spr->GetFrameSet() == ENEMY_DOCK_WORKER_ANIM_ATTACK) && (player_spr->GetFrame() == 4)) { SetWeaponDamage(10); SetRectangle(rectWeaponWorldLoc, 25, 10, 0, 10); } else if((player_spr->GetFrameSet() == ENEMY_DOCK_WORKER_ANIM_ATTACK) && (player_spr->GetFrame() == 5)) { SetWeaponDamage(10); SetRectangle(rectWeaponWorldLoc, 50, 10, 0, 10); } else SetRectangle(rectWeaponWorldLoc, 0, 0, 0, 0); return rectWeaponWorldLoc; }
ImageThresholder::ImageThresholder() : pix_(NULL), image_data_(NULL), image_width_(0), image_height_(0), image_bytespp_(0), image_bytespl_(0), scale_(1), yres_(300), estimated_res_(300) { SetRectangle(0, 0, 0, 0); }
HPTRect &EnemyGreenNinja::GetWeaponWorldLoc() { if((player_spr->GetFrameSet() == ENEMY_GREEN_NINJA_ANIM_ATTACK) && (player_spr->GetFrame() == 4)) { SetWeaponDamage(2); SetRectangle(rectWeaponWorldLoc, 25, 4, nxOffSet, 2); } else if((player_spr->GetFrameSet() == ENEMY_GREEN_NINJA_ANIM_ATTACK) && (player_spr->GetFrame() == 5)) { SetWeaponDamage(2); SetRectangle(rectWeaponWorldLoc, 25, 4, nxOffSet, -2); } else SetRectangle(rectWeaponWorldLoc, 0, 0, 0, 0); return rectWeaponWorldLoc; }
void Scrollbar::SetPositionAndSize() { switch (orientation) { case ScrollbarSlider::Orientation::Horizontal: { SetRectangle(Math::Rectangle(panel.GetRectangle().x, panel.GetRectangle().y + panel.GetRectangle().height, panel.GetRectangle().width, GetRectangle().height)); break; } case ScrollbarSlider::Orientation::Vertical: { SetRectangle(Math::Rectangle(panel.GetRectangle().x + panel.GetRectangle().width, panel.GetRectangle().y, GetRectangle().width, panel.GetRectangle().height)); break; } default: break; } }
void UIDraggableBox::HandleMouseMove(const STPoint2& position) { MouseState state = CurrentMouseState(); if (state == OVER || state == DOWN) { STVector2 diff = GetRectangle().pMax - GetRectangle().pMin; STPoint2 lowerLeft = position - mRelativeMousePosition; SetRectangle(UIRectangle(lowerLeft, lowerLeft + diff)); } }
void CDialogTabCtrl::Init() { iTabCurrent = 0; //m_tabPages[0]->Create(IDD_MAIN_DIALOG,this); m_pParityDlg->Create(IDD_PARITY_CHECK,this); //m_pMainTabDlg->Create(IDD_MAIN_DIALOG,this); //m_pSpeedTestHddDlg->Create(IDD_SPEED_HDD,this); SetRectangle(); }
void CPopup::Init(Abathur::TAbathurFont *font) { mTextureBG = Abathur::loadTexture("data/textures/popup_bg.tga"); ASSERT(mTextureBG); mFont = font; mOffsetText.Set(0.069f, 0.215f); mLineEnter = 0.05f; MathUtils::MatrixOrthoOffCenterTpl(&mtx_ortho, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f); SetRectangle(0.4f, 0.2f, 0.28f, 0.5f, 0xffffffff); mFontColor = 0xff000000; }
void CTabContain::Init() { m_tabCurrent=0; m_tabPages[0]->Create(IDD_TAB_HP, this); m_tabPages[1]->Create(IDD_TAB_PK, this); m_tabPages[0]->ShowWindow(SW_SHOW); m_tabPages[1]->ShowWindow(SW_HIDE); SetRectangle(); }
bool Sprite2D::Load(Deserializer& source) { SharedPtr<Texture2D> texture(new Texture2D(context_)); if (!texture->Load(source)) return false; SetTexture(texture); if (texture) SetRectangle(IntRect(0, 0, texture->GetWidth(), texture->GetHeight())); return true; }
void PierrobotGear::Spawn(jvis::AnimatedSprite& player) { Enemy::Spawn(player); _direction = (player.GetPosition().x - m_SpawnPos.x <= 0) ? Mega::Direction::LEFT : Mega::Direction::RIGHT; SetNumColumns(1); SetNumFrames(2); SetDelay(160); SetSize(jmath::vec2(32)); SetRectangle(jmath::vec4(72, 68, 32, 32)); GetRigidBody()->SetCollisionType(jphys::BOX_REACTIVE); GetRigidBody()->SetVelocity(0); }
HPTRect &EnemyZombiePrisoner::GetWeaponWorldLoc() { /* Center (0,0), offset by Render Offset */ SetRectangle(rectWeaponWorldLoc, 15, 45, -nxOffSet, -15); // if(ipFlags.S_ATTACK) // { // SetRectangle(rectWeaponWorldLoc, 60, 60, -30, -30); // } // else // SetRectangle(rectWeaponWorldLoc, 0, 0, 0, 0); return rectWeaponWorldLoc; }
void CMyTabCtrl::Init() { m_tabCurrent=0; m_tabPages[0]->Create(IDD_BASIC, this); m_tabPages[1]->Create(IDD_ADVANCED, this); m_tabPages[2]->Create(IDD_TRANSPARENT, this); m_tabPages[3]->Create(IDD_SHADED, this); m_tabPages[4]->Create(IDD_ABOUT, this); m_tabPages[0]->ShowWindow(SW_SHOW); m_tabPages[1]->ShowWindow(SW_HIDE); m_tabPages[2]->ShowWindow(SW_HIDE); m_tabPages[3]->ShowWindow(SW_HIDE); m_tabPages[4]->ShowWindow(SW_HIDE); SetRectangle(); }
void CMyTabCtrl::Init() { m_tabCurrent=0; ((CDlgBasic *)m_tabPages[0])->Create(*this); ((CDlgAdvanced *)m_tabPages[1])->Create(*this); ((CDlgTransparent *)m_tabPages[2])->Create(*this); ((CDlgShadeButtonST *)m_tabPages[3])->Create(*this); ((CDlgAbout *)m_tabPages[4])->Create(*this); m_tabPages[0]->ShowWindow(SW_SHOW); m_tabPages[1]->ShowWindow(SW_HIDE); m_tabPages[2]->ShowWindow(SW_HIDE); m_tabPages[3]->ShowWindow(SW_HIDE); m_tabPages[4]->ShowWindow(SW_HIDE); SetRectangle(); }
bool Sprite2D::EndLoad() { // Finish loading of the texture in the main thread bool success = false; if (loadTexture_ && loadTexture_->EndLoad()) { success = true; SetTexture(loadTexture_); if (texture_) SetRectangle(IntRect(0, 0, texture_->GetWidth(), texture_->GetHeight())); } else { // Reload failed if (loadTexture_ == texture_) texture_.Reset(); } loadTexture_.Reset(); return success; }
CCollisionRectangle::CCollisionRectangle() { OffsetX = 0; OffsetY = 0; SetRectangle(0,0,0,0); }
CCollisionRectangle::CCollisionRectangle(int x, int y, int w, int h) { OffsetX = x; OffsetY = y; SetRectangle(0,0,w,h); }
// Animation that plays on death - twelve circles with oscillating radiuses that move away from the player void Player::HandleDeath(const jutil::GameTime& timespan) { // If we've just entered, put all the sprites in place if (m_TimerDeath.ElapsedMilliseconds() == 0) { for (int i = 0; i < m_DeathSprites.size(); ++i) m_DeathSprites[i].SetPosition(GetPosition()); } else // Otherwise, we're under way - animate { // Oscillate the radius if (m_DeathSpriteFlickerCounter > 4) m_DeathSpriteFlicker = false; else if (m_DeathSpriteFlickerCounter < 1) m_DeathSpriteFlicker = true; if (m_DeathSpriteFlicker) m_DeathSpriteFlickerCounter++; else m_DeathSpriteFlickerCounter--; for (int i = 0; i < m_DeathSprites.size(); ++i) m_DeathSprites[i].SetCurrentFrame(m_DeathSpriteFlickerCounter); // Move all the circles outwards in the right directions float d = timespan.GetDeltaTime(); for (int i = 0; i < 2; i++, d = -d) m_DeathSprites[i].Move(jmath::vec2(d, d)); for (int i = 2; i < 4; i++, d = -d) m_DeathSprites[i].Move(jmath::vec2(-d, d)); for (int i = 4; i < 6; ++i, d = -d) m_DeathSprites[i].MoveX(d*1.6f); for (int i = 6; i < 8; ++i, d = -d) m_DeathSprites[i].MoveY(d*1.6f); for (int i = 8; i < 10; ++i, d = -d) m_DeathSprites[i].MoveX(d*0.4f); for (int i = 10; i < 12; ++i, d = -d) m_DeathSprites[i].MoveY(d*0.4f); } m_TimerDeath += timespan; m_TimerInvincibility.SetTime(JTime::Milliseconds(INVINCIBILITY_TIME)); // If we're done dying, reset everything if (m_TimerDeath.ElapsedMilliseconds() > 5850) // 5300 { m_TimerDeath.SetTime(0); m_Health = 28; } // If we're done dying, get ready to spawn back in else if (m_TimerDeath.ElapsedMilliseconds() > 5400) { float n = jmath::Normalise(5400.f, 5800.f, (float)m_TimerDeath.ElapsedMilliseconds()); if (n > 0.9f) { if (GetCurrentFrame() == 1) SetCurrentFrame(2); else SetCurrentFrame(3); } else SetRectangle(jmath::vec4(120, 8, 24, 32)); SetAnimationFrame(); if (n > 1.f) n = 1.f; jmath::vec2 r = m_RespawnPos; r.y = jmath::Lerp(m_RespawnPos.y - 240, m_RespawnPos.y - 5, n); SetPosition(r); } // If we've played the animation, set player to spawn pos else if (m_Health != INT_MIN && m_TimerDeath.ElapsedMilliseconds() > 2300) { jmath::vec2 r = m_RespawnPos; m_Health = INT_MIN; r.y -= 240; SetPosition(r); SetAnimationFrame(); } }
// Set the relevant animation depending on the state of the player following the update loop void Player::SetAnimationFrame() { PlayerState state; AnimationState newState; if (p_Window->GetKey(Mega::Keys::MOVE_LEFT) == JKEY_HOLD) SetDrawFlags(jvis::Sprite::DrawFlags::FlipHorizontal); else if (p_Window->GetKey(Mega::Keys::MOVE_RIGHT) == JKEY_HOLD) RemoveDrawFlags(jvis::Sprite::DrawFlags::FlipHorizontal); if (m_TimerDeath.ElapsedMilliseconds() > 0) newState = AnimationState::SPAWNING; // Been hit else if (m_TimerInvincibility.ElapsedMilliseconds() < INVINCIBILITY_TIME / 2.5f) newState = AnimationState::INVINCIBLE; else if (m_HasCollidedBelow) { if (m_TimerBulletAnimationDelay.ElapsedMilliseconds() < FIRING_ANIMATION_DELAY) { // Running and gunning if (p_Window->GetKey(Mega::Keys::MOVE_LEFT) == JKEY_HOLD || p_Window->GetKey(Mega::Keys::MOVE_RIGHT) == JKEY_HOLD) newState = AnimationState::SHOOTRUN; else // Still firing newState = AnimationState::SHOOTSTILL; } else { // Running if (p_Window->GetKey(Mega::Keys::MOVE_LEFT) == JKEY_HOLD || p_Window->GetKey(Mega::Keys::MOVE_RIGHT) == JKEY_HOLD) newState = AnimationState::RUN; else // standing still newState = AnimationState::STILL; } } else { // Firing and jumping if (m_TimerBulletAnimationDelay.ElapsedMilliseconds() < FIRING_ANIMATION_DELAY) newState = AnimationState::SHOOTJUMP; else // Just jumping newState = AnimationState::JUMP; } if (newState != m_AnimationState) { m_AnimationState = newState; SetDelay(120); SetNumColumns(3); SetCurrentFrame(1); switch (m_AnimationState) { case INVINCIBLE: SetRectangle(jmath::vec4(0, 146, 32, 30)); SetNumFrames(2); SetDelay(20); break; case STILL: SetRectangle(jmath::vec4(0, 38, 32, 30)); SetNumFrames(1); break; case RUN: SetRectangle(jmath::vec4(0, 6, 32, 30)); SetNumFrames(3); break; case JUMP: SetRectangle(jmath::vec4(0, 106, 32, 30)); SetNumFrames(1); break; case SHOOTSTILL: SetRectangle(jmath::vec4(64, 38, 32, 30)); SetNumFrames(1); break; case SHOOTRUN: SetRectangle(jmath::vec4(0, 70, 32, 30)); SetNumFrames(3); break; case SHOOTJUMP: SetRectangle(jmath::vec4(32, 102, 32, 30)); SetNumFrames(1); break; case SPAWNING: SetNumFrames(3); SetNumColumns(1); SetCurrentFrame(1); SetDelay(10000); break; } } }
// Common initialization shared between SetImage methods. void ImageThresholder::Init() { SetRectangle(0, 0, image_width_, image_height_); }