Skip to content

Commit

Permalink
- avoid calling tbui functions without any running context
Browse files Browse the repository at this point in the history
  • Loading branch information
kaffeewolf committed Dec 22, 2024
1 parent 6dd74b3 commit d604400
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions code/addons/tbui/tbuicontext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,11 @@ TBUIContext::Create()
// Render some glyphs in one go now since we know we are going to use them. It would work fine
// without this since glyphs are rendered when needed, but with some extra updating of the glyph bitmap.
if (font)
{
font->RenderGlyphs(
" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~•·åäöÅÄÖ"
);

}
tb::TBWidgetsAnimationManager::Init();

// setup state
Expand Down Expand Up @@ -354,6 +355,10 @@ TBUIContext::Discard()
void
TBUIContext::FrameUpdate(const Graphics::FrameContext& ctx)
{
if (views.IsEmpty())
{
return;
}
tb::TBMessageHandler::ProcessMessages();
tb::TBAnimationManager::Update();

Expand Down Expand Up @@ -417,12 +422,16 @@ bool
TBUIContext::ProcessInput(const Input::InputEvent& inputEvent)
{
if (views.IsEmpty())
{
return false;
}

TBUIView* view = views.Back();

if (!view)
{
return false;
}

tb::MODIFIER_KEYS modifiers = GetModifierKeys();

Expand Down Expand Up @@ -481,12 +490,12 @@ TBUIContext::ProcessInput(const Input::InputEvent& inputEvent)
/**
*/
void
TBUIContext::Render(
const CoreGraphics::CmdBufferId cmdBuf, const Math::rectangle<int>& viewport, const IndexT frame, const IndexT bufferIndex
)
TBUIContext::Render(const CoreGraphics::CmdBufferId cmdBuf, const Math::rectangle<int>& viewport, const IndexT frame, const IndexT bufferIndex)
{
if (views.IsEmpty())
{
return;
}

Util::Array<TBUIBatch> batches;

Expand Down

0 comments on commit d604400

Please sign in to comment.