aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--graftest/graftest.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/graftest/graftest.c b/graftest/graftest.c
index b983aca..81997f2 100644
--- a/graftest/graftest.c
+++ b/graftest/graftest.c
@@ -171,6 +171,7 @@ void render_level(int levelnum) {
int leveldesc = LEVEL_BASE + LEVEL_SIZE * levelnum;
int mapaddr = dpeek(leveldesc + 22);
int levelname = LEVEL_NAMES + LEVEL_NAME_SIZE * levelnum;
+ Uint32 start = SDL_GetTicks();
color_regs[0] = 0;
color_regs[1] = peek(leveldesc + 47);
@@ -182,10 +183,12 @@ void render_level(int levelnum) {
fprintf(stderr, "leveldesc %04x, mapaddr %04x\n", leveldesc, mapaddr);
draw_map(mapaddr);
+ fprintf(stderr, "render_level(%d) took %dms\n", levelnum, SDL_GetTicks() - start);
}
int main(int argc, char **argv) {
int lev = 0, done = 0, fullscreen = 0;
+ Uint32 start, end, now;
SDL_Window *window;
SDL_Renderer *renderer;
SDL_Texture *texture;
@@ -207,12 +210,10 @@ int main(int argc, char **argv) {
render_level(lev);
while(!done) {
- Uint32 start, end, now;
-
start = SDL_GetTicks();
end = start + 167; // NTSC timing
- if(SDL_PollEvent(&event)) {
+ while(SDL_PollEvent(&event)) {
if(event.type == SDL_QUIT) {
break;
}
@@ -225,6 +226,12 @@ int main(int argc, char **argv) {
render_level(lev);
break;
+ case SDLK_BACKSPACE:
+ lev--;
+ if(lev < 0) lev = 11;
+ render_level(lev);
+ break;
+
case SDLK_ESCAPE:
done = 1;
break;