From 9d5ce889264c2a3ef7d3a270501f61ce85f1dd55 Mon Sep 17 00:00:00 2001 From: Henri Vasserman Date: Sun, 11 Apr 2021 21:13:59 +0300 Subject: [PATCH] debugging stuff --- xormod.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/xormod.c b/xormod.c index 806b3d4..13d3eab 100644 --- a/xormod.c +++ b/xormod.c @@ -202,25 +202,27 @@ int main() { } Field_scroll(&f, rend); - Field_draw(&f, rend); - //char buf[72]; - //SDL_SetRenderDrawColor(rend, 0, 0, 0, 255); - //SDL_RenderFillRect(rend, &(SDL_Rect) { 0, 0, sizeof(buf)*font_w, 7*font_h }); + char buf[72]; + SDL_SetRenderDrawColor(rend, 0, 0, 0, 255); + SDL_RenderFillRect(rend, &(SDL_Rect) { + 0, 0, sizeof(buf)*font_w, 8*font_h + }); - //size_t len = snprintf(buf, sizeof(buf), "off.x: %d, off.y: %d", off.x, off.y); - //draw_text(rend, font, buf, len, RC(1, 1), 255, 255, 255); + draw_text(rend, font, ACCEL_PLATFORM_STR, sizeof(ACCEL_PLATFORM_STR), RC(1,1), 255, 255, 255); - //char *q[] = {"TL", "TR", "BL", "BR"}; - //for (int i = 0; i < 4; i++) { - // Picture *p = pictures[i]; - // len = snprintf(buf, sizeof(buf), "%s| x1: %05d, x2: %05d, y1: %05d, y2: %05d, p: %p", - // q[i], p->x1, p->x2, p->y1, p->y2, p); - // draw_text(rend, font, buf, len, RC(2+i, 1), 255, 255, 255); - //} - - //draw_text(rend, font, ACCEL_PLATFORM_STR, sizeof(ACCEL_PLATFORM_STR), RC(1,1), 255, 255, 255); + size_t len = snprintf(buf, sizeof(buf), + "off.x: %d, off.y: %d", f.offset.x, f.offset.y); + draw_text(rend, font, buf, len, RC(2, 1), 255, 255, 255); + + char *q[] = {"TL", "TR", "BL", "BR"}; + for (int i = 0; i < 4; i++) { + Picture *p = f.pics[i]; + len = snprintf(buf, sizeof(buf), "%s| x1: %05d, x2: %05d, y1: %05d, y2: %05d, p: %p", + q[i], p->x1, p->x2, p->y1, p->y2, p); + draw_text(rend, font, buf, len, RC(3+i, 1), 255, 255, 255); + } SDL_RenderPresent(rend); @@ -237,5 +239,4 @@ int main() { SDL_Quit(); return 0; - }