MCPcopy Create free account
hub / github.com/atraczyk/2d-engine / R_drawWorldDebug

Function R_drawWorldDebug

engine/src/game.cpp:1507–1640  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1505}
1506
1507void R_drawWorldDebug()
1508{
1509 camera.setOrthoMatrix();
1510 glUseProgramObjectARB(NULL);
1511 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1512 glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
1513
1514 glDisable(GL_TEXTURE_2D);
1515 float posx, posy, pw, ph, padl, padb, padr, padt;
1516 if (bdebugcollisions)
1517 {
1518 for (int i = 0; i < player.collidableTiles.tileObjects.size(); i++)
1519 {
1520 posx = player.collidableTiles.tileObjects[i].position.x;
1521 posy = player.collidableTiles.tileObjects[i].position.y;
1522 pw = player.collidableTiles.tileObjects[i].size.x;
1523 ph = player.collidableTiles.tileObjects[i].size.x;
1524 glColor4f(0.75f, 0.2f, 0.1f, 1.0f);
1525 glLineWidth(2.0f);
1526 glBegin(GL_LINE_STRIP);
1527 {
1528 glVertex2f(posx, posy);
1529 glVertex2f(posx + pw, posy);
1530 glVertex2f(posx + pw, posy + ph);
1531 glVertex2f(posx, posy + ph);
1532 glVertex2f(posx, posy);
1533 }
1534 glEnd();
1535 }
1536 if (world.enemies.size())
1537 {
1538 for (int e = 0; e < world.enemies.size(); e++)
1539 {
1540 for (int i = 0;
1541 i < world.enemies[e].collidableTiles.tileObjects.size();
1542 i++)
1543 {
1544 posx = world.enemies[e]
1545 .collidableTiles.tileObjects[i]
1546 .position.x;
1547 posy = world.enemies[e]
1548 .collidableTiles.tileObjects[i]
1549 .position.y;
1550 pw = world.enemies[e].collidableTiles.tileObjects[i].size.x;
1551 ph = world.enemies[e].collidableTiles.tileObjects[i].size.x;
1552 glColor4f(0.75f, 0.2f * e, 0.1f * e, 1.0f);
1553 glLineWidth(2.0f);
1554 glBegin(GL_LINE_STRIP);
1555 {
1556 glVertex2f(posx, posy);
1557 glVertex2f(posx + pw, posy);
1558 glVertex2f(posx + pw, posy + ph);
1559 glVertex2f(posx, posy + ph);
1560 glVertex2f(posx, posy);
1561 }
1562 glEnd();
1563 }
1564 if (bdrawhitboxes)

Callers 1

R_renderFunction · 0.85

Calls 1

setOrthoMatrixMethod · 0.80

Tested by

no test coverage detected