static void render(GContext *ctx) { #ifdef BENCHMARK uint16_t start = time_ms(NULL, NULL); #endif pge_isometric_begin(ctx); // Tiles for(int z = 0; z < GRID_DEPTH; z++) { for(int y = 0; y < GRID_HEIGHT; y++) { for(int x = 0; x < GRID_WIDTH; x++) { block_render(s_block_array[vec2i(Vec3(x, y, z))]); } } } for(int i = 0; i < MAX_CLOUDS; i++) { cloud_render(s_cloud_array[i]); } // Selection switch(s_input_mode) { case MODE_X: pge_isometric_draw_rect(Vec3(0, s_cursor.y * BLOCK_SIZE, (s_cursor.z + 1) * BLOCK_SIZE), GSize(GRID_WIDTH * BLOCK_SIZE, BLOCK_SIZE), GColorWhite); break; case MODE_Y: pge_isometric_draw_rect(Vec3(s_cursor.x * BLOCK_SIZE, 0, (s_cursor.z + 1) * BLOCK_SIZE), GSize(BLOCK_SIZE, GRID_HEIGHT * BLOCK_SIZE), GColorWhite); break; case MODE_Z: pge_isometric_draw_box(Vec3(s_cursor.x * BLOCK_SIZE, s_cursor.y * BLOCK_SIZE, BLOCK_SIZE), GSize(BLOCK_SIZE, BLOCK_SIZE), (GRID_DEPTH - 1) * BLOCK_SIZE, GColorWhite); break; } pge_isometric_draw_box(Vec3(s_cursor.x * BLOCK_SIZE, s_cursor.y * BLOCK_SIZE, s_cursor.z * BLOCK_SIZE), GSize(BLOCK_SIZE, BLOCK_SIZE), BLOCK_SIZE, GColorRed); // Box pge_isometric_draw_box(Vec3(0, 0, 0), GSize(BLOCK_SIZE * GRID_WIDTH, BLOCK_SIZE * GRID_HEIGHT), SKY_HEIGHT, GColorLightGray); pge_isometric_finish(ctx); #ifdef BENCHMARK uint16_t finish = time_ms(NULL, NULL); APP_LOG(APP_LOG_LEVEL_INFO, "Frame time: %d ms", (int)finish - start); #endif }
static void pge_render(GContext *ctx) { #ifdef BENCHMARK uint16_t start = time_ms(NULL, NULL); #endif pge_isometric_begin(ctx); for(int i = 0; i < 4; i++) { digit_render(s_digits[i]); } pge_isometric_finish(ctx); if(!digits_are_animating()) { pge_pause(); if(!s_initd) { // Any further interruptions will cause fast-forwarding s_initd = true; } } #ifdef BENCHMARK uint16_t finish = time_ms(NULL, NULL); APP_LOG(APP_LOG_LEVEL_INFO, "Frame time: %d", (int)finish - start); #endif }