Move physics debug draw function

This commit is contained in:
Miloslav Ciz 2025-01-14 13:50:13 +01:00
parent 2dfad249ad
commit 4d5594a834
2 changed files with 21 additions and 15 deletions

15
game.h
View file

@ -257,6 +257,19 @@ void LCR_drawPixelXYUnsafe(unsigned int x, unsigned int y,
#endif
}
void _LCR_physicdDebugDrawPixel(uint16_t x, uint16_t y, uint8_t color)
{
if (x > 1 && x < LCR_EFFECTIVE_RESOLUTION_X - 2 &&
y > 1 && y < LCR_EFFECTIVE_RESOLUTION_Y - 2)
{
uint16_t c = 0x8101 | (0x8f1f << (2 * color));
for (int j = -1; j <= 2; ++j)
for (int i = -1; i <= 2; ++i)
LCR_drawPixelXYUnsafe(x + i,y + j,c);
}
}
static inline void LCR_drawPixelXYSafe(unsigned int x, unsigned int y,
uint_fast16_t color)
{
@ -577,7 +590,7 @@ void LCR_gameDraw3DView(void)
#if LCR_SETTING_DEBUG_PHYSICS_DRAW
LCR_GameUnit camTr[7];
LCR_rendererGetCameraTransform(camTr,camTr + 3,camTr + 6);
LCR_physicsDebugDraw(camTr,camTr + 3,camTr[6]);
LCR_physicsDebugDraw(camTr,camTr + 3,camTr[6],_LCR_physicdDebugDrawPixel);
#endif
// GUI/HUD: