render world overlay on top

isolation_bkp/dynres
Dominik Madarász 2022-09-13 13:56:03 +00:00 committed by GitHub
parent 04621adcd3
commit 839fad077d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 50 additions and 36 deletions

View File

@ -23,13 +23,6 @@ void DEBUG_draw_ground(uint64_t key, entity_view * data) {
tex.texture.height *= (int32_t)scale; tex.texture.height *= (int32_t)scale;
DrawTextureRec(tex.texture, (Rectangle){0, 0, size, -size}, (Vector2){x, y}, ColorAlpha(WHITE, data->tran_time)); DrawTextureRec(tex.texture, (Rectangle){0, 0, size, -size}, (Vector2){x, y}, ColorAlpha(WHITE, data->tran_time));
if (zoom_overlay_tran > 0.02f) {
DrawRectangleEco(x, y, size-offset, size-offset, ColorAlpha(ColorFromHSV((float)data->color, 0.13f, 0.89f), data->tran_time*zoom_overlay_tran*0.75f));
DrawTextEco(TextFormat("%d %d", (int)data->x, (int)data->y), x+15.0f, y+15.0f, 200 , ColorAlpha(BLACK, data->tran_time*zoom_overlay_tran), 0.0);
}
for (size_t ty = 0; ty < view->chunk_size; ty++) { for (size_t ty = 0; ty < view->chunk_size; ty++) {
for (size_t tx = 0; tx < view->chunk_size; tx++) { for (size_t tx = 0; tx < view->chunk_size; tx++) {
block_id blk_id = data->outer_blocks[(ty*view->chunk_size)+tx]; block_id blk_id = data->outer_blocks[(ty*view->chunk_size)+tx];
@ -44,6 +37,26 @@ void DEBUG_draw_ground(uint64_t key, entity_view * data) {
} }
} }
void DEBUG_draw_overlay(uint64_t key, entity_view * data) {
switch (data->kind) {
case EKIND_CHUNK: {
world_view *view = game_world_view_get_active();
float size = (float)(view->chunk_size * WORLD_BLOCK_SIZE);
float offset = 0.0;
float x = data->x * size + offset;
float y = data->y * size + offset;
if (zoom_overlay_tran > 0.02f) {
DrawRectangleEco(x, y, size-offset, size-offset, ColorAlpha(ColorFromHSV((float)data->color, 0.13f, 0.89f), data->tran_time*zoom_overlay_tran*0.75f));
DrawTextEco(TextFormat("%d %d", (int)data->x, (int)data->y), x+15.0f, y+15.0f, 200 , ColorAlpha(BLACK, data->tran_time*zoom_overlay_tran), 0.0);
}
}break;
default:break;
}
}
extern bool inv_is_open; extern bool inv_is_open;
void DEBUG_draw_entities(uint64_t key, entity_view * data) { void DEBUG_draw_entities(uint64_t key, entity_view * data) {
@ -137,6 +150,7 @@ void renderer_draw_v0(void) {
game_world_view_active_entity_map(DEBUG_draw_ground); game_world_view_active_entity_map(DEBUG_draw_ground);
game_world_view_active_entity_map(DEBUG_draw_entities_low); game_world_view_active_entity_map(DEBUG_draw_entities_low);
game_world_view_active_entity_map(DEBUG_draw_entities); game_world_view_active_entity_map(DEBUG_draw_entities);
game_world_view_active_entity_map(DEBUG_draw_overlay);
EndMode2D(); EndMode2D();
} }