2020-05-10 08:57:13 +00:00
|
|
|
package tins2020
|
|
|
|
|
|
|
|
import (
|
2020-05-10 15:40:56 +00:00
|
|
|
"opslag.de/schobers/tins2020/img"
|
2020-05-10 08:57:13 +00:00
|
|
|
|
|
|
|
"github.com/veandco/go-sdl2/sdl"
|
|
|
|
)
|
|
|
|
|
2020-05-11 09:44:50 +00:00
|
|
|
var Black = sdl.Color{R: 0, G: 0, B: 0, A: 255}
|
|
|
|
var Transparent = sdl.Color{R: 0, G: 0, B: 0, A: 0}
|
|
|
|
var TransparentWhite = sdl.Color{R: 255, G: 255, B: 255, A: 31}
|
|
|
|
var White = sdl.Color{R: 255, G: 255, B: 255, A: 255}
|
|
|
|
|
2020-05-11 13:45:55 +00:00
|
|
|
func HexColor(s string) (sdl.Color, error) {
|
|
|
|
c, err := img.HexColor(s)
|
|
|
|
if err != nil {
|
|
|
|
return sdl.Color{}, err
|
|
|
|
}
|
|
|
|
return sdl.Color(c), nil
|
|
|
|
}
|
|
|
|
|
2020-05-10 15:40:56 +00:00
|
|
|
func MustHexColor(s string) sdl.Color { return sdl.Color(img.MustHexColor(s)) }
|
2020-05-11 09:44:50 +00:00
|
|
|
|
|
|
|
func SetDrawColor(renderer *sdl.Renderer, color sdl.Color) {
|
|
|
|
renderer.SetDrawColor(color.R, color.G, color.B, color.A)
|
|
|
|
}
|
|
|
|
|
|
|
|
func SetDrawColorHex(renderer *sdl.Renderer, s string) {
|
|
|
|
SetDrawColor(renderer, MustHexColor(s))
|
|
|
|
}
|