MCPcopy Create free account
hub / github.com/9chu/LuaSTGPlus / DrawGroupCollider

Method DrawGroupCollider

LuaSTGPlus/GameObjectPool.cpp:1402–1446  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1400}
1401
1402void GameObjectPool::DrawGroupCollider(f2dGraphics2D* graph, f2dGeometryRenderer* grender, int groupId, fcyColor fillColor)
1403{
1404 GameObject* p = m_pCollisionListHeader[groupId].pCollisionNext;
1405 GameObject* pTail = &m_pCollisionListTail[groupId];
1406 while (p && p != pTail)
1407 {
1408 if (p->colli)
1409 {
1410 if (p->rect)
1411 {
1412 fcyVec2 tHalfSize((float)p->a, (float)p->b);
1413
1414 // ��������ε�4������
1415 f2dGraphics2DVertex tFinalPos[4] =
1416 {
1417 { -tHalfSize.x, -tHalfSize.y, 0.5f, fillColor.argb, 0.0f, 0.0f },
1418 { tHalfSize.x, -tHalfSize.y, 0.5f, fillColor.argb, 0.0f, 1.0f },
1419 { tHalfSize.x, tHalfSize.y, 0.5f, fillColor.argb, 1.0f, 1.0f },
1420 { -tHalfSize.x, tHalfSize.y, 0.5f, fillColor.argb, 1.0f, 0.0f }
1421 };
1422
1423 // float tSin = sin(Angle), tCos = cos(Angle);
1424 float tSin, tCos;
1425 SinCos((float)p->rot, tSin, tCos);
1426
1427 // �任
1428 for (int i = 0; i < 4; i++)
1429 {
1430 fFloat tx = tFinalPos[i].x * tCos - tFinalPos[i].y * tSin,
1431 ty = tFinalPos[i].x * tSin + tFinalPos[i].y * tCos;
1432 tFinalPos[i].x = tx + (float)p->x; tFinalPos[i].y = ty + (float)p->y;
1433 }
1434
1435 graph->DrawQuad(nullptr, tFinalPos);
1436 }
1437 else
1438 {
1439 grender->FillCircle(graph, fcyVec2((float)p->x, (float)p->y), (float)p->col_r, fillColor, fillColor,
1440 p->col_r < 10 ? 3 : (p->col_r < 20 ? 6 : 8));
1441 }
1442 }
1443
1444 p = p->pCollisionNext;
1445 }
1446}

Callers 1

OnRenderMethod · 0.80

Calls 1

SinCosFunction · 0.85

Tested by

no test coverage detected