MCPcopy Create free account
hub / github.com/Wassimulator/CactusViewer / UI_end_frame

Function UI_end_frame

include/ui/ui_core.cpp:1101–1138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1099}
1100
1101void UI_end_frame(UI_Context *ctx) {
1102 UI_assert(ctx != nullptr && "UI context *ctx is a null pointer!");
1103 UI_assert(ctx->initialized && "UI context wasn't initialized!");
1104 UI_apply_layout(ctx);
1105 //ctx->parents.pop_back();
1106 ctx->blocks_hit_test.reset_count();
1107 auto buffer = UI_get_current_frame_buffer(ctx);
1108 for (int i = 0; i < buffer->count; i++) {
1109 UI_Block* block = &buffer->data[i];
1110 if (block->hash == 0) continue;
1111 if (!(block->flags & UI_Block_Flags_hit_test)) continue;
1112 bool in_block = UI_point_in_rect(block->position, block->position + block->size, UI_get_mouse());
1113 UI_Hit_Test_Item item;
1114 item.hash = block->hash;
1115 item.depth_level = block->depth_level;
1116 if (in_block) {
1117 ctx->blocks_hit_test.push_back(item);
1118 }
1119 }
1120 u32 max_depth = 0;
1121 UI_Hit_Test_Item foremost = { 0 };
1122 ctx->hit_test_result = foremost;
1123 for (int i = 0; i < ctx->blocks_hit_test.count; i++) {
1124 UI_Hit_Test_Item *current = &ctx->blocks_hit_test[i];
1125 if (current->depth_level > max_depth) {
1126 max_depth = current->depth_level;
1127 foremost = *current;
1128 }
1129 }
1130 ctx->hit_test_result = foremost;
1131
1132
1133 UI_assert(ctx->parents.count == 0 && "UI parent stack must be empty at the end of the frame!");
1134 UI_assert(ctx->hashes.count == 0 && "UI ID stack must be empty at the end of the frame!");
1135 if (ctx->want_capture_keyboard)
1136 UI_release_char_keys();
1137 ctx->string_storage_size = 0;
1138}
1139
1140void UI_render(UI_Context *ctx) {
1141 UI_assert(ctx != nullptr && "UI context *ctx is a null pointer!");

Callers 1

renderFunction · 0.85

Calls 7

UI_apply_layoutFunction · 0.85
UI_point_in_rectFunction · 0.85
UI_get_mouseFunction · 0.85
UI_release_char_keysFunction · 0.85
reset_countMethod · 0.80
push_backMethod · 0.80

Tested by

no test coverage detected