put event handling to the front
parent
2cf491aa1f
commit
073453e89a
60
xormod.c
60
xormod.c
|
@ -61,36 +61,6 @@ int main() {
|
||||||
f.offset.y += 16;
|
f.offset.y += 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_SetRenderDrawColor(rend, 0, 0, 0, 255);
|
|
||||||
SDL_RenderFillRect(rend, &(SDL_FRect) { 0, 0, w, h});
|
|
||||||
|
|
||||||
Field_scroll(&f);
|
|
||||||
Field_draw(&f, rend);
|
|
||||||
|
|
||||||
if (debug) {
|
|
||||||
char buf[72];
|
|
||||||
SDL_SetRenderDrawColor(rend, 0, 0, 0, 255);
|
|
||||||
SDL_RenderFillRect(rend, &(SDL_FRect) {
|
|
||||||
0, 0, sizeof(buf)*font_w, 8*font_h
|
|
||||||
});
|
|
||||||
|
|
||||||
draw_text(rend, 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, \xEBT: %02" PRIu64, f.offset.x, f.offset.y, delta);
|
|
||||||
draw_text(rend, 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 \xB3 x: %05d, y: %05d, w: %d, h: %d, p: %p",
|
|
||||||
q[i], p->x, p->y, p->w, p->h, p);
|
|
||||||
draw_text(rend, buf, len, RC(3+i, 1), 255, 255, 255);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_RenderPresent(rend);
|
|
||||||
|
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
|
@ -126,6 +96,36 @@ int main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SDL_SetRenderDrawColor(rend, 0, 0, 0, 255);
|
||||||
|
SDL_RenderFillRect(rend, &(SDL_FRect) { 0, 0, w, h});
|
||||||
|
|
||||||
|
Field_scroll(&f);
|
||||||
|
Field_draw(&f, rend);
|
||||||
|
|
||||||
|
if (debug) {
|
||||||
|
char buf[72];
|
||||||
|
SDL_SetRenderDrawColor(rend, 0, 0, 0, 255);
|
||||||
|
SDL_RenderFillRect(rend, &(SDL_FRect) {
|
||||||
|
0, 0, sizeof(buf)*font_w, 8*font_h
|
||||||
|
});
|
||||||
|
|
||||||
|
draw_text(rend, 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, \xEBT: %02" PRIu64, f.offset.x, f.offset.y, delta);
|
||||||
|
draw_text(rend, 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 \xB3 x: %05d, y: %05d, w: %d, h: %d, p: %p",
|
||||||
|
q[i], p->x, p->y, p->w, p->h, p);
|
||||||
|
draw_text(rend, buf, len, RC(3+i, 1), 255, 255, 255);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_RenderPresent(rend);
|
||||||
|
|
||||||
if (delta < 16) {
|
if (delta < 16) {
|
||||||
SDL_Delay(16 - delta);
|
SDL_Delay(16 - delta);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue