|
|
|
@ -6,42 +6,42 @@ import (
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var hints map[int]string
|
|
|
|
|
var hints []string
|
|
|
|
|
var tries int
|
|
|
|
|
var solution string
|
|
|
|
|
var helpText string
|
|
|
|
|
var smallFont *ttf.Font
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
|
hints = map[int]string{}
|
|
|
|
|
hints = []string{}
|
|
|
|
|
ttf.Init()
|
|
|
|
|
smallFont, _ = ttf.OpenFont("./assets/josefin-sans/JosefinSans-Regular.ttf", 70)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func helpFunc(solution bool) {
|
|
|
|
|
if !solution {
|
|
|
|
|
func helpFunc(shoudSolution bool) {
|
|
|
|
|
if tries < 0 {
|
|
|
|
|
helpText = ""
|
|
|
|
|
tries++
|
|
|
|
|
} else if tries < len(hints){
|
|
|
|
|
helpText = hints[tries]
|
|
|
|
|
tries++
|
|
|
|
|
} else {
|
|
|
|
|
tries = 0
|
|
|
|
|
}
|
|
|
|
|
if shoudSolution {
|
|
|
|
|
helpText = solution
|
|
|
|
|
tries = -1
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func BlitHelp() {
|
|
|
|
|
var helpIndex int
|
|
|
|
|
var found bool
|
|
|
|
|
var helpText string
|
|
|
|
|
|
|
|
|
|
for helpIndex = tries; helpIndex != 0 && !found; helpIndex-- {
|
|
|
|
|
helpText, found = hints[helpIndex]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if found {
|
|
|
|
|
width, height, _ := smallFont.SizeUTF8(helpText)
|
|
|
|
|
func BlitHelp(renderer *sdl.Renderer) {
|
|
|
|
|
width, height, _ := smallFont.SizeUTF8(helpText)
|
|
|
|
|
|
|
|
|
|
textSurf, _ := smallFont.RenderUTF8Blended(helpText, sdl.Color{20, 20, 0, 255})
|
|
|
|
|
defer textSurf.Free()
|
|
|
|
|
textSurf, _ := smallFont.RenderUTF8Blended(helpText, sdl.Color{20, 20, 0, 255})
|
|
|
|
|
defer textSurf.Free()
|
|
|
|
|
|
|
|
|
|
textText, _ := renderer.CreateTextureFromSurface(textSurf)
|
|
|
|
|
defer textText.Destroy()
|
|
|
|
|
textText, _ := renderer.CreateTextureFromSurface(textSurf)
|
|
|
|
|
defer textText.Destroy()
|
|
|
|
|
|
|
|
|
|
renderer.Copy(textText, nil, &sdl.Rect{200, 200, int32(width), int32(height)})
|
|
|
|
|
}
|
|
|
|
|
renderer.Copy(textText, nil, &sdl.Rect{200, 200, int32(width), int32(height)})
|
|
|
|
|
}
|
|
|
|
|