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

Method Draw

contents.go:5697–5758  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5695}
5696
5697func (w *InternetContents) Draw() {
5698
5699 w.HorizontalScrollbar.Rect.X = w.Card.DisplayRect.X
5700 w.HorizontalScrollbar.Rect.Y = w.Card.DisplayRect.Y + w.Card.DisplayRect.H - w.HorizontalScrollbar.Rect.H
5701 w.HorizontalScrollbar.Rect.W = w.Card.DisplayRect.W - 16
5702
5703 w.VerticalScrollbar.Rect.X = w.Card.DisplayRect.X + w.Card.DisplayRect.W - w.VerticalScrollbar.Rect.W
5704 w.VerticalScrollbar.Rect.Y = w.Card.DisplayRect.Y
5705 w.VerticalScrollbar.Rect.H = w.Card.DisplayRect.H - 16
5706
5707 camera := w.Card.Page.Project.Camera
5708
5709 if w.BrowserTab != nil {
5710
5711 w.BrowserTab.UpdateTexture()
5712
5713 if w.BrowserTab.ImageTexture != nil {
5714
5715 if w.BrowserTab.Valid() {
5716 dst := camera.TranslateRect(w.Card.DisplayRect)
5717 globals.Renderer.RenderTexture(w.BrowserTab.ImageTexture, nil, dst)
5718 }
5719
5720 if w.BrowserTab.LoadingWebpage.Load() {
5721 rect := &sdl.FRect{w.Card.DisplayRect.X + 32, w.Card.DisplayRect.Y, 32, 32}
5722 globals.Renderer.RenderTextureRotated(globals.GUITexture.Texture, &sdl.FRect{272, 256, 32, 32}, camera.TranslateRect(rect), globals.Time*360*4, &sdl.FPoint{16, 16}, sdl.FLIP_NONE)
5723 }
5724
5725 } else {
5726 w.DisableRecordInput()
5727 target := *w.Card.DisplayRect
5728 target.W = 32
5729 target.H = 32
5730 target.X += (w.Card.DisplayRect.W / 2) - (target.W / 2)
5731 target.Y += (w.Card.DisplayRect.H / 2) - (target.H / 2)
5732 dst := camera.TranslateRect(&target)
5733 globals.GUITexture.Texture.SetBlendMode(sdl.BLENDMODE_ADD)
5734 globals.Renderer.RenderTextureRotated(globals.GUITexture.Texture, &sdl.FRect{272, 256, 32, 32}, dst, globals.Time*360*4, &sdl.FPoint{16, 16}, sdl.FLIP_NONE)
5735 globals.GUITexture.Texture.SetBlendMode(sdl.BLENDMODE_BLEND)
5736 }
5737
5738 if w.RecordInput {
5739 rect := &sdl.FRect{w.Card.DisplayRect.X + 4, w.Card.DisplayRect.Y + 4, 32, 16}
5740 globals.Renderer.RenderTexture(globals.GUITexture.Texture, &sdl.FRect{480, 96, 32, 16}, camera.TranslateRect(rect))
5741 }
5742
5743 }
5744
5745 if w.Card.selected {
5746
5747 for _, b := range w.Buttons {
5748 b.Draw()
5749 }
5750
5751 }
5752
5753 if w.Card.selected {
5754 w.HorizontalScrollbar.Draw()

Callers

nothing calls this directly

Calls 6

DisableRecordInputMethod · 0.95
TranslateRectMethod · 0.80
LoadMethod · 0.80
DrawMethod · 0.65
UpdateTextureMethod · 0.45
ValidMethod · 0.45

Tested by

no test coverage detected