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

Method Draw

gui.go:3308–3346  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3306func (image *GUIImage) Update() {}
3307
3308func (image *GUIImage) Draw() {
3309
3310 if !image.Visible {
3311 return
3312 }
3313
3314 if image.TintByFontColor {
3315 color := getThemeColor(GUIFontColor)
3316 image.Texture.SetColorMod(color.RGB())
3317 image.Texture.SetAlphaMod(color[3])
3318 } else {
3319 image.Texture.SetColorMod(255, 255, 255)
3320 image.Texture.SetAlphaMod(255)
3321 }
3322
3323 rect := image.Rect
3324
3325 if image.WorldSpace {
3326 rect = globals.Project.Camera.TranslateRect(rect)
3327 }
3328
3329 globals.Renderer.RenderTexture(image.Texture, image.SrcRect, rect)
3330
3331 if image.Border {
3332 globals.Renderer.SetDrawColor(getThemeColor(GUIFontColor).RGBA())
3333 globals.Renderer.RenderRect(rect)
3334 }
3335
3336 if globals.DebugMode == DebugModeUI {
3337 dst := &sdl.FRect{image.Rect.X, image.Rect.Y, image.Rect.W, image.Rect.H}
3338 if image.WorldSpace {
3339 dst = globals.Project.Camera.TranslateRect(dst)
3340 }
3341
3342 globals.Renderer.SetDrawColor(255, 0, 255, 255)
3343 globals.Renderer.RenderFillRect(dst)
3344 }
3345
3346}
3347func (image *GUIImage) Rectangle() *sdl.FRect {
3348 return &sdl.FRect{image.Rect.X, image.Rect.Y, image.Rect.W, image.Rect.H}
3349}

Callers

nothing calls this directly

Calls 4

getThemeColorFunction · 0.85
RGBMethod · 0.80
TranslateRectMethod · 0.80
RGBAMethod · 0.80

Tested by

no test coverage detected