()
| 2102 | } |
| 2103 | |
| 2104 | func (tc *TimerContents) Draw() { |
| 2105 | |
| 2106 | p := float32(0) |
| 2107 | |
| 2108 | // Numbered mode |
| 2109 | |
| 2110 | modeGroup := int(tc.Card.Properties.Get("mode group").AsFloat()) |
| 2111 | |
| 2112 | if modeGroup == 1 && tc.CountdownTime > 0 { |
| 2113 | |
| 2114 | if tc.TimerValue > 0 { |
| 2115 | p = float32(tc.TimerValue) / float32(tc.CountdownTime) |
| 2116 | } |
| 2117 | |
| 2118 | } else if tc.ClockBecameInPhase { |
| 2119 | p = 1 |
| 2120 | } |
| 2121 | tc.PercentageComplete += (p - tc.PercentageComplete) * 6 * globals.DeltaTime |
| 2122 | |
| 2123 | if tc.PercentageComplete < 0 { |
| 2124 | tc.PercentageComplete = 0 |
| 2125 | } else if tc.PercentageComplete > 1 { |
| 2126 | tc.PercentageComplete = 1 |
| 2127 | } |
| 2128 | |
| 2129 | src := &sdl.FRect{0, 0, tc.Card.Rect.W * tc.PercentageComplete, tc.Card.Rect.H} |
| 2130 | dst := &sdl.FRect{0, 0, float32(src.W), float32(src.H)} |
| 2131 | dst.X = tc.Card.DisplayRect.X |
| 2132 | dst.Y = tc.Card.DisplayRect.Y |
| 2133 | dst = tc.Card.Page.Project.Camera.TranslateRect(dst) |
| 2134 | |
| 2135 | barColor := getThemeColor(GUITimerColor) |
| 2136 | if tc.Card.CustomColor != nil { |
| 2137 | barColor = tc.Card.CustomColor |
| 2138 | } |
| 2139 | tc.Card.Result.Texture.SetColorMod(barColor.RGB()) |
| 2140 | |
| 2141 | tc.Card.Result.Texture.SetAlphaMod(255) |
| 2142 | globals.Renderer.RenderTexture(tc.Card.Result.Texture, src, dst) |
| 2143 | |
| 2144 | tc.DefaultContents.Draw() |
| 2145 | |
| 2146 | if modeGroup == 2 && !tc.TargetTimeLabel.Editing { |
| 2147 | txt := tc.TargetTimeLabel.TextAsString() |
| 2148 | color := getThemeColor(GUIMenuColor) |
| 2149 | x := float32(0) |
| 2150 | |
| 2151 | if tc.CheckboxOn { |
| 2152 | if tc.ClockInPhase() { |
| 2153 | txt = "Active: " + txt |
| 2154 | color = getThemeColor(GUICompletedColor) |
| 2155 | } else { |
| 2156 | color = getThemeColor(GUICheckboxColor) |
| 2157 | } |
| 2158 | // x += 46 |
| 2159 | } |
| 2160 | |
| 2161 | textSize := globals.TextRenderer.MeasureText([]rune(txt), 0.5) |
nothing calls this directly
no test coverage detected