()
| 280 | } |
| 281 | |
| 282 | func (project *Project) DrawGrid() { |
| 283 | drawGridPiece := func(x, y float32) { |
| 284 | globals.Renderer.RenderTexture(project.GridTexture.Texture, nil, &sdl.FRect{x, y, project.GridTexture.Size.X, project.GridTexture.Size.Y}) |
| 285 | } |
| 286 | |
| 287 | extent := float32(10) |
| 288 | for y := -extent; y < extent; y++ { |
| 289 | for x := -extent; x < extent; x++ { |
| 290 | translated := project.Camera.TranslateRect(&sdl.FRect{x * project.GridTexture.Size.X, y * project.GridTexture.Size.Y, 0, 0}) |
| 291 | drawGridPiece(translated.X, translated.Y) |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | // TODO: Draw pieces around the camera, rather than a solid 10 in every direction |
| 296 | |
| 297 | halfW := float32(project.Camera.ViewArea().W / 2) |
| 298 | halfH := float32(project.Camera.ViewArea().H / 2) |
| 299 | ThickLine(project.Camera.TranslatePoint(Vector{project.Camera.Position.X - halfW, 0}), project.Camera.TranslatePoint(Vector{project.Camera.Position.X + halfW, 0}), 2, getThemeColor(GUIGridColor)) |
| 300 | ThickLine(project.Camera.TranslatePoint(Vector{0, project.Camera.Position.Y - halfH}), project.Camera.TranslatePoint(Vector{0, project.Camera.Position.Y + halfH}), 2, getThemeColor(GUIGridColor)) |
| 301 | |
| 302 | if project.CurrentPage.UpwardPage != nil { |
| 303 | |
| 304 | gridColor := getThemeColor(GUIGridColor) |
| 305 | |
| 306 | text := project.CurrentPage.PointingSubpageCard.Properties.Get("description").AsString() |
| 307 | textSize := globals.TextRenderer.MeasureText([]rune(text), 1).CeilToGrid() |
| 308 | globals.Renderer.SetDrawColor(gridColor.RGBA()) |
| 309 | globals.Renderer.RenderFillRect(project.Camera.TranslateRect(&sdl.FRect{0, -globals.GridSize, textSize.X, textSize.Y})) |
| 310 | globals.TextRenderer.QuickRenderText(text, project.Camera.TranslatePoint(Vector{textSize.X / 2, -globals.GridSize}), 1, getThemeColor(GUIBGColor), nil, AlignCenter) |
| 311 | |
| 312 | // globals.Renderer.DrawRectF(project.Camera.TranslateRect(&sdl.FRect{0, 0, SubpageScreenshotSize.X, SubpageScreenshotSize.Y})) |
| 313 | |
| 314 | ssRect := project.Camera.TranslateRect(&sdl.FRect{0, 0, SubpageScreenshotSize.X / float32(SubpageScreenshotZoom), SubpageScreenshotSize.Y / float32(SubpageScreenshotZoom)}) // Screenshot zoom |
| 315 | ThickRect(int32(ssRect.X), int32(ssRect.Y), int32(ssRect.W), int32(ssRect.H), 2, gridColor) |
| 316 | guiTex := globals.Resources.Get(LocalRelativePath("assets/gui.png")).AsImage() |
| 317 | guiTex.Texture.SetColorMod(gridColor.RGB()) |
| 318 | guiTex.Texture.SetAlphaMod(gridColor[3]) |
| 319 | globals.Renderer.RenderTexture(guiTex.Texture, &sdl.FRect{80, 256, 32, 32}, &sdl.FRect{ssRect.X, ssRect.Y, 32, 32}) |
| 320 | |
| 321 | } |
| 322 | |
| 323 | } |
| 324 | |
| 325 | func (project *Project) Draw() { |
| 326 |
no test coverage detected