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

Function R_drawScreenDebug

engine/src/game.cpp:1403–1505  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1401}
1402
1403void R_drawScreenDebug()
1404{
1405 glUseProgramObjectARB(NULL);
1406 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1407
1408 int x = 10;
1409 int y = 10;
1410 int w = 340;
1411 int h = 200;
1412 Vector4 bgcolor(0.1f, 0.1f, 0.1f, 0.75f);
1413 R_drawBox(x, y, w, h, bgcolor);
1414
1415 SDL_DisplayMode nativeMode;
1416 SDL_GetCurrentDisplayMode(0, &nativeMode);
1417
1418 char buffer[128];
1419 Vector4 color;
1420
1421 int ty = y + 8;
1422 int dy = font.charsXYWH.h * font.scaleValue;
1423
1424 color = Vector4(1.0f, 1.0f, 1.0f, 1.0f);
1425
1426 sprintf(buffer, "shader version = %s",
1427 glGetString(GL_SHADING_LANGUAGE_VERSION));
1428 ty += dy;
1429 font.displayScreenText(x + 8, ty, color.x, color.y, color.z, buffer);
1430
1431 sprintf(buffer, "gametime.fps = %0.2f", gametime.fps);
1432 ty += dy;
1433 font.displayScreenText(x + 8, ty, color.x, color.y, color.z, buffer);
1434
1435 sprintf(buffer, "gametime.currentFrame = %d", gametime.currentFrame);
1436 ty += dy;
1437 font.displayScreenText(x + 8, ty, color.x, color.y, color.z, buffer);
1438
1439 sprintf(buffer, "ttime = %0.4f",
1440 (gametime.getCurrentMilliseconds() / 1000.0f) - gametime.startTime);
1441 ty += dy;
1442 font.displayScreenText(x + 8, ty, color.x, color.y, color.z, buffer);
1443
1444 sprintf(buffer, "gtime = %0.4f", gametime.gameTime);
1445 ty += dy;
1446 font.displayScreenText(x + 8, ty, color.x, color.y, color.z, buffer);
1447
1448 sprintf(buffer, "ptime = %0.4f", gametime.pauseTime);
1449 ty += dy;
1450 font.displayScreenText(x + 8, ty, color.x, color.y, color.z, buffer);
1451
1452 sprintf(buffer, "mstime = %0.4f", gametime.moveSizeTime);
1453 ty += dy;
1454 font.displayScreenText(x + 8, ty, color.x, color.y, color.z, buffer);
1455
1456 color = Vector4(1.0f, 0.25f, 0.0f, 1.0f);
1457
1458 sprintf(buffer, "mastervol = %0.2f", sound.masterVolume);
1459 ty += dy;
1460 font.displayScreenText(x + 8, ty, color.x, color.y, color.z, buffer);

Callers 1

R_renderFunction · 0.85

Calls 4

R_drawBoxFunction · 0.85
Vector4Class · 0.85
displayScreenTextMethod · 0.80

Tested by

no test coverage detected