//static TBNode *TBNodeRefTree::FollowNodeRef(TBNode *node) { // Detect circular loops by letting this call get a unique id. // Update the id on each visited node and if it's already set, // there's a loop. This cost the storage of id in each TBNode, // and assumes the look up doesn't cause other lookups // recursively. // FIX: Switch to hare and teleporting tortouise? static uint32 s_cycle_id = 0; uint32 cycle_id = ++s_cycle_id; TBNode *start_node = node; while (node->GetValue().IsString()) { // If not a reference at all, we're done. const char *node_str = node->GetValue().GetString(); if (*node_str != '@') break; // If there's no tree name and request, we're done. It's probably a language string. const char *name_start = node_str + 1; const char *name_end = TBNode::GetNextNodeSeparator(name_start); if (*name_end == 0) break; // We have a "@treename>noderequest" string. Go ahead and look it up. if (TBNodeRefTree *rt = TBNodeRefTree::GetRefTree(name_start, name_end - name_start)) { TBNode *next_node = rt->m_node.GetNode(name_end + 1, TBNode::GET_MISS_POLICY_NULL); if (!next_node) { TBDebugPrint("TBNodeRefTree::ResolveNode - Node not found on request \"%s\"\n", node_str); break; } node = next_node; // Detect circular reference loop. if (node->m_cycle_id != cycle_id) node->m_cycle_id = cycle_id; else { TBDebugPrint("TBNodeRefTree::ResolveNode - Reference loop detected on request \"%s\" from node \"%s\"\n", node_str, node->GetValue().GetString()); return start_node; } } else { TBDebugPrint("TBNodeRefTree::ResolveNode - No tree found for request \"%s\" from node \"%s\"\n", node_str, node->GetValue().GetString()); break; } } return node; }
TBValue &TBNodeRefTree::GetValue(const char *request) { if (TBNode *node = m_node.GetNodeFollowRef(request)) return node->GetValue(); TBDebugPrint("TBNodeRefTree::GetValue - Request not found: %s\n", request); static TBValue nullval; return nullval; }
void TBRendererGL::EndPaint() { TBRendererBatcher::EndPaint(); #ifdef TB_RUNTIME_DEBUG_INFO if (TB_DEBUG_SETTING(RENDER_BATCHES)) TBDebugPrint("Frame caused %d bitmap validations.\n", dbg_bitmap_validations); #endif // TB_RUNTIME_DEBUG_INFO }
void TBRendererBatcher::EndPaint() { FlushAllInternal(); #ifdef TB_RUNTIME_DEBUG_INFO if (TB_DEBUG_SETTING(RENDER_BATCHES)) TBDebugPrint("Frame rendered using %d batches and a total of %d triangles.\n", batch.batch_id - dbg_begin_paint_batch_id, dbg_frame_triangle_count); #endif // TB_RUNTIME_DEBUG_INFO }
bool tb_core_init(TBRenderer *renderer, const char *lng_file) { TBDebugPrint("Initiating Turbo Badger - version %s\n", TB_VERSION_STR); g_renderer = renderer; g_tb_lng = new TBLanguage; g_tb_lng->Load(lng_file); g_font_manager = new TBFontManager(); g_tb_skin = new TBSkin(); g_widgets_reader = TBWidgetsReader::Create(); return TBInitAddons(); }
void UIRendererGL::EndPaint() { TBRendererBatcher::EndPaint(); _shader.deactivate(); glBindBuffer(GL_ARRAY_BUFFER, 0); #ifdef TB_RUNTIME_DEBUG_INFO if (TB_DEBUG_SETTING(RENDER_BATCHES)) TBDebugPrint("Frame caused %d bitmap validations.\n", dbg_bitmap_validations); #endif GL_checkError(); }