//----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 DrawArrow(TGfxSprite * pLines, const TGfxVec2 tCenter, TGfxVec2 tDest) { if (!(tDest == tCenter)) { TGfxVec2 pArrow = 15 * (tDest - tCenter).Normalize(); const float angle = GfxMathDegToRad(160); TGfxVec2 pArrow1 = pArrow.Rotate(angle); TGfxVec2 pArrow2 = pArrow.Rotate(-angle); GfxLineSpriteJumpTo(pLines, tCenter.x, tCenter.y); GfxLineSpriteLineTo(pLines, tDest.x, tDest.y); GfxLineSpriteLineTo(pLines, tDest.x + pArrow1.x, tDest.y + pArrow1.y); GfxLineSpriteJumpTo(pLines, tDest.x, tDest.y); GfxLineSpriteLineTo(pLines, tDest.x + pArrow2.x, tDest.y + pArrow2.y); } }
void Update() { g_bAllCaveSearched = true; for (int i = 0; i < g_iNbrCave; i++) { if (g_bCaveSearched[i] == false) { g_bAllCaveSearched = false; } } PlayerState_Update(); GfxSpriteSetPosition(g_pLines, g_TPlayerData.iPos.x, g_TPlayerData.iPos.y); GfxLineSpriteReset(g_pLines2); GfxLineSpriteJumpTo(g_pLines2, g_TPlayerData.iPos.x, g_TPlayerData.iPos.y); GfxLineSpriteLineTo(g_pLines2, g_pCave[g_iCurrentCaveTarget].iPosX, g_pCave[g_iCurrentCaveTarget].iPosY); }
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); } }