mirror of
https://github.com/wisplite/a-star-go.git
synced 2026-06-27 15:37:07 -05:00
cap the canvas size at 16000 to prevent GPU texture allocation issues (will replace with chunked textures in the multithreaded version)
This commit is contained in:
@@ -74,6 +74,7 @@ func main() {
|
|||||||
heightInputValue := "10"
|
heightInputValue := "10"
|
||||||
editModeWidth := false
|
editModeWidth := false
|
||||||
editModeHeight := false
|
editModeHeight := false
|
||||||
|
generateGridError := false
|
||||||
|
|
||||||
toolOptions := []string{"Wall", "Start", "End"}
|
toolOptions := []string{"Wall", "Start", "End"}
|
||||||
toolOptionsText := strings.Join(toolOptions, ";")
|
toolOptionsText := strings.Join(toolOptions, ";")
|
||||||
@@ -166,16 +167,25 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if generateGridError {
|
||||||
|
result := rg.MessageBox(rl.NewRectangle(screenWidth/2-(100*scale), screenHeight/2-(40*scale), (200*scale), (120*scale)), "Error", "Width and/or height must be\nless than 16000", "OK")
|
||||||
|
if result >= 0 {
|
||||||
|
generateGridError = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Generate Grid Button
|
// Generate Grid Button
|
||||||
if rg.Button(rl.NewRectangle(sidebarX+(10*scale), (40*scale), (180*scale), (30*scale)), "Generate Grid") {
|
if rg.Button(rl.NewRectangle(sidebarX+(10*scale), (40*scale), (180*scale), (30*scale)), "Generate Grid") {
|
||||||
width, _ = strconv.Atoi(widthInputValue)
|
width, _ = strconv.Atoi(widthInputValue)
|
||||||
height, _ = strconv.Atoi(heightInputValue)
|
height, _ = strconv.Atoi(heightInputValue)
|
||||||
rl.UnloadTexture(mapTexture)
|
if width > 16000 || height > 16000 {
|
||||||
rl.UnloadImage(mapImage)
|
generateGridError = true
|
||||||
mapImage = rl.GenImageColor(width, height, rl.NewColor(240, 240, 240, 255))
|
} else {
|
||||||
mapTexture = rl.LoadTextureFromImage(mapImage)
|
rl.UnloadTexture(mapTexture)
|
||||||
defer rl.UnloadTexture(mapTexture)
|
rl.UnloadImage(mapImage)
|
||||||
defer rl.UnloadImage(mapImage)
|
mapImage = rl.GenImageColor(width, height, rl.NewColor(240, 240, 240, 255))
|
||||||
|
mapTexture = rl.LoadTextureFromImage(mapImage)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tool Selector (text must be "opt1;opt2;..." — raygui splits on ';' and needs 2+ items)
|
// Tool Selector (text must be "opt1;opt2;..." — raygui splits on ';' and needs 2+ items)
|
||||||
|
|||||||
Reference in New Issue
Block a user