MCPcopy Create free account
hub / github.com/SolarLune/masterplan / Draw

Method Draw

gui.go:3845–3878  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3843}
3844
3845func (cw *ColorWheel) Draw() {
3846
3847 ThickRect(int32(cw.Rect.X), int32(cw.Rect.Y), int32(cw.Rect.W), int32(cw.Rect.H), 2, getThemeColor(GUIFontColor))
3848
3849 hueRect := *cw.Rect
3850 hueRect.H = float32(cw.HueStrip.H)
3851 globals.Renderer.RenderTexture(cw.HueTexture, nil, &hueRect)
3852
3853 valueRect := hueRect
3854 valueRect.Y = hueRect.Y + hueRect.H
3855 valueRect.H = float32(cw.ValueStrip.H)
3856 globals.Renderer.RenderTexture(cw.ValueTexture, nil, &valueRect)
3857
3858 guiTex := globals.GUITexture.Texture
3859 guiTex.SetAlphaMod(255)
3860 src := &sdl.FRect{0, 240, 8, 8}
3861 dst := &sdl.FRect{cw.Rect.X + float32(cw.SampledPosX) - 4, cw.Rect.Y + float32(cw.SampledPosY) - 4, 8, 8}
3862 globals.Renderer.RenderTexture(guiTex, src, dst)
3863
3864 ThickLine(Vector{cw.Rect.X + (cw.SampledValue * float32(cw.ValueStrip.W)), cw.Rect.Y + float32(cw.HueStrip.H)},
3865 Vector{cw.Rect.X + (cw.SampledValue * float32(cw.ValueStrip.W)), cw.Rect.Y + float32(cw.HueStrip.H) + float32(cw.ValueStrip.H)},
3866 4, ColorBlack,
3867 )
3868
3869 ThickLine(Vector{valueRect.X + (cw.SampledValue * valueRect.W), valueRect.Y},
3870 Vector{valueRect.X + (cw.SampledValue * valueRect.W), valueRect.Y + valueRect.H},
3871 2, ColorWhite,
3872 )
3873
3874 // Color preview
3875 globals.Renderer.SetDrawColor(cw.SampledColor.RGBA())
3876 globals.Renderer.RenderFillRect(&sdl.FRect{valueRect.X, valueRect.Y + valueRect.H, valueRect.W, 32})
3877
3878}
3879
3880func (cw *ColorWheel) SetRectangle(rect *sdl.FRect) {
3881 cw.Rect.X = rect.X

Callers

nothing calls this directly

Calls 4

ThickRectFunction · 0.85
getThemeColorFunction · 0.85
ThickLineFunction · 0.85
RGBAMethod · 0.80

Tested by

no test coverage detected