void BindToEnd(int released, void*pararms){ if (released) return; if (plCurrent){ while (plCurrent->next) plCurrent = plCurrent->next; PushBitmap(plCurrent->filename); } }
void BindToStart(int released, void*pararms){ if (released) return; if (plHead){ plCurrent = plHead; PushBitmap(plCurrent->filename); } }
internal rectangle2 DEBUGTextOp(debug_state *DebugState, debug_text_op Op, v2 P, char *String, v4 Color = V4(1, 1, 1, 1)) { rectangle2 Result = InvertedInfinityRectangle2(); if (DebugState && DebugState->DebugFont) { render_group *RenderGroup = DebugState->RenderGroup; loaded_font *Font = DebugState->DebugFont; hha_font *Info = DebugState->DebugFontInfo; u32 PrevCodePoint = 0; for (char *At = String; *At; ++At) { u32 CodePoint = *At; if (At[0] == '\\' && IsHex(At[1]) && IsHex(At[2]) && IsHex(At[3]) && IsHex(At[4])) { CodePoint = (GetHex(At[1]) << 12 | GetHex(At[2]) << 8 | GetHex(At[3]) << 4 | GetHex(At[4]) << 0); At += 4; } r32 AdvanceX = DebugState->FontScale * GetHorizontalAdvanceForPair(Info, Font, PrevCodePoint, CodePoint); P.x += AdvanceX; if (CodePoint != ' ') { bitmap_id BitmapID = GetBitmapForGlyph(RenderGroup->Assets, Info, Font, CodePoint); hha_bitmap *BitmapInfo = GetBitmapInfo(RenderGroup->Assets, BitmapID); r32 BitmapScale = DebugState->FontScale * (r32)BitmapInfo->Dim[1]; v3 BitmapOffset = V3(P.x, P.y, 0); if (Op == DEBUGTextOp_DrawText) { PushBitmap(RenderGroup, BitmapID, BitmapScale, BitmapOffset, Color); } else { Assert(Op == DEBUGTextOp_SizeText); loaded_bitmap *Bitmap = GetBitmap(RenderGroup->Assets, BitmapID, RenderGroup->GenerationID); if (Bitmap) { used_bitmap_dim Dim = GetBitmapDim(RenderGroup, Bitmap, BitmapScale, BitmapOffset, 1.0f); rectangle2 GlyphDim = RectMinDim(Dim.P.xy, Dim.Size); Result = Union(Result, GlyphDim); } } } PrevCodePoint = CodePoint; } } return Result; }