()
| 3044 | } |
| 3045 | |
| 3046 | func (mc *MapContents) Draw() { |
| 3047 | |
| 3048 | if mc.Card.IsSelected() { |
| 3049 | |
| 3050 | for index, button := range mc.Buttons { |
| 3051 | srcX := float32(368) |
| 3052 | if mc.Tool == index { |
| 3053 | srcX += 32 |
| 3054 | } |
| 3055 | button.IconSrc.X = srcX |
| 3056 | |
| 3057 | button.Draw() |
| 3058 | } |
| 3059 | |
| 3060 | } |
| 3061 | |
| 3062 | if mc.RenderTexture != nil { |
| 3063 | |
| 3064 | alpha := uint8(150) |
| 3065 | |
| 3066 | dst := globals.Project.Camera.TranslateRect(&sdl.FRect{mc.Card.DisplayRect.X, mc.Card.DisplayRect.Y, mc.Card.Rect.W, mc.Card.Rect.H}) |
| 3067 | |
| 3068 | mc.RenderTexture.Texture.SetAlphaMod(alpha) |
| 3069 | globals.Renderer.RenderTexture(mc.RenderTexture.Texture, nil, dst) |
| 3070 | |
| 3071 | if mc.UsingLineTool() && (mc.LineStart.X >= 0 || mc.LineStart.Y >= 0) { |
| 3072 | |
| 3073 | gp := mc.GridCursorPosition() |
| 3074 | start := mc.LineStart |
| 3075 | dir := gp.Sub(start).Normalized() |
| 3076 | |
| 3077 | horizontal := true |
| 3078 | |
| 3079 | if start != gp { |
| 3080 | |
| 3081 | for i := 0; i < 100000; i++ { |
| 3082 | |
| 3083 | s := start |
| 3084 | s.X = float32(math.Round(float64(s.X)))*globals.GridSize + mc.Card.Rect.X |
| 3085 | s.Y = float32(math.Round(float64(s.Y)))*globals.GridSize + mc.Card.Rect.Y |
| 3086 | |
| 3087 | mp := globals.Project.Camera.UntranslatePoint(s) |
| 3088 | ThickRect(int32(mp.X), int32(mp.Y), 32, 32, 2, NewColor(200, 220, 240, 255)) |
| 3089 | |
| 3090 | if start.Rounded().Equals(gp.Rounded()) { |
| 3091 | break |
| 3092 | } |
| 3093 | |
| 3094 | if horizontal { |
| 3095 | start.X += dir.X / 2 |
| 3096 | } else { |
| 3097 | start.Y += dir.Y / 2 |
| 3098 | } |
| 3099 | |
| 3100 | horizontal = !horizontal |
| 3101 | |
| 3102 | // Draw square |
| 3103 |
nothing calls this directly
no test coverage detected