//----Show void TBox::DrawBox() { if (m_pSprite != nullptr) { GfxSpriteSetPosition(m_pSprite, m_tCenter.x, m_tCenter.y); GfxSpriteSetAngle(m_pSprite, GfxMathDegToRad(-m_fAngle)); } //Line if (m_pLineSprite != nullptr) { if (m_pLineSprite != nullptr) GfxLineSpriteReset(m_pLineSprite); GfxLineSpriteSetDrawingColor(m_pLineSprite, GfxColor(150, 150, 150, 255)); TGfxVec2 tAxisX = TGfxVec2(m_fRay_W, 0).Rotate(GfxMathDegToRad(m_fAngle))*m_fScale; TGfxVec2 tAxisY = TGfxVec2(0, m_fRay_H).Rotate(GfxMathDegToRad(m_fAngle))*m_fScale; TGfxVec2 tUR = TGfxVec2(m_tCenter.x + tAxisX.x + tAxisY.x, m_tCenter.y + tAxisX.y + tAxisY.y); TGfxVec2 tUL = TGfxVec2(m_tCenter.x - tAxisX.x + tAxisY.x, m_tCenter.y - tAxisX.y + tAxisY.y); TGfxVec2 tDL = TGfxVec2(m_tCenter.x - tAxisX.x - tAxisY.x, m_tCenter.y - tAxisX.y - tAxisY.y); TGfxVec2 tDR = TGfxVec2(m_tCenter.x + tAxisX.x - tAxisY.x, m_tCenter.y + tAxisX.y - tAxisY.y); GfxLineSpriteJumpTo(m_pLineSprite, tUL.x, tUL.y); GfxLineSpriteLineTo(m_pLineSprite, tDL.x, tDL.y); GfxLineSpriteLineTo(m_pLineSprite, tDR.x, tDR.y); GfxLineSpriteLineTo(m_pLineSprite, tUR.x, tUR.y); GfxLineSpriteLineTo(m_pLineSprite, tUL.x, tUL.y); } if (m_pTextSprite != nullptr) { GfxSpriteSetPosition(m_pTextSprite, m_tCenter.x, m_tCenter.y); GfxSpriteSetAngle(m_pTextSprite,GfxMathDegToRad(-m_fAngle)); } }
void DrawCircle(TGfxSprite * pLines, const TGfxVec2 tCenter, const float fRadius, const unsigned int tColor, const bool tPlayer) { GfxSpriteSetPosition(pLines, g_TPlayerData.iPosX, g_TPlayerData.iPosY); const int NUM_LINES = 32; GfxLineSpriteJumpTo(pLines, tCenter.x + fRadius, tCenter.y); GfxLineSpriteSetDrawingColor(pLines, tColor); if (tPlayer == true) { ArcheoStuffs::DrawArrow(pLines, tCenter, TGfxVec2(tCenter.x + cos(GfxMathDegToRad((360.f / NUM_LINES) * (1))) * fRadius, tCenter.y + sin(GfxMathDegToRad((360.f / NUM_LINES) * (1))) * fRadius)); } for (int i = 0; i < NUM_LINES; ++i) { const float fAngle = GfxMathDegToRad((360.f / NUM_LINES) * (i + 1)); const float fPosX = tCenter.x + cos(fAngle) * fRadius; const float fPosY = tCenter.y + sin(fAngle) * fRadius; GfxLineSpriteLineTo(pLines, fPosX, fPosY); } }