DrawLabel draws a small paper-like label of the specified text at the X and Y position specified.
(pos Vector, size float32, text string, menuColor Color)
| 878 | |
| 879 | // DrawLabel draws a small paper-like label of the specified text at the X and Y position specified. |
| 880 | func DrawLabel(pos Vector, size float32, text string, menuColor Color) { |
| 881 | |
| 882 | textSize := globals.TextRenderer.MeasureText([]rune(text), 0.5) |
| 883 | textSize.X += 16 |
| 884 | |
| 885 | if textSize.X < 16 { |
| 886 | textSize.X = 16 |
| 887 | } |
| 888 | |
| 889 | guiTexture := globals.GUITexture.Texture |
| 890 | |
| 891 | guiTexture.SetColorMod(menuColor.RGB()) |
| 892 | guiTexture.SetAlphaMod(menuColor[3]) |
| 893 | |
| 894 | src := &sdl.FRect{480, 48, 8, 24} |
| 895 | dst := &sdl.FRect{pos.X, pos.Y, float32(src.W) * size, float32(src.H) * size} |
| 896 | globals.Renderer.RenderTexture(guiTexture, src, dst) |
| 897 | |
| 898 | src.X += 8 |
| 899 | |
| 900 | dst.X += float32(src.W * size) |
| 901 | dst.W = (textSize.X - 16) * size |
| 902 | if dst.W > 0 { |
| 903 | globals.Renderer.RenderTexture(guiTexture, src, dst) |
| 904 | } |
| 905 | |
| 906 | src.X += 8 |
| 907 | src.W = 16 |
| 908 | |
| 909 | dst.X += dst.W |
| 910 | dst.W = float32(src.W) * size |
| 911 | globals.Renderer.RenderTexture(guiTexture, src, dst) |
| 912 | |
| 913 | globals.TextRenderer.QuickRenderText(text, Vector{pos.X + (textSize.X / 2 * size), pos.Y}, 0.5*size, getThemeColor(GUIFontColor), nil, AlignCenter) |
| 914 | |
| 915 | } |
| 916 | |
| 917 | // SortedSet represents a sorted set of elements. |
| 918 | type SortedSet[E comparable] []E |
no test coverage detected