30 lines
812 B
Go
30 lines
812 B
Go
|
package ui
|
||
|
|
||
|
import (
|
||
|
"opslag.de/schobers/galleg/allegro5"
|
||
|
)
|
||
|
|
||
|
var dropShadowPalette []allegro5.Color
|
||
|
|
||
|
func initDropShadowPalette() {
|
||
|
if nil != dropShadowPalette {
|
||
|
return
|
||
|
}
|
||
|
dropShadowPalette = []allegro5.Color{
|
||
|
allegro5.NewColorAlpha(0, 0, 0, 0x0f),
|
||
|
allegro5.NewColorAlpha(0, 0, 0, 0x07),
|
||
|
allegro5.NewColorAlpha(0, 0, 0, 0x03),
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func DropShadow(x1, y1, x2, y2 float32) {
|
||
|
initDropShadowPalette()
|
||
|
|
||
|
allegro5.DrawLine(x1, y2+1, x2+1, y2+1, dropShadowPalette[0], 1)
|
||
|
allegro5.DrawLine(x2+1, y1, x2+1, y2, dropShadowPalette[0], 1)
|
||
|
allegro5.DrawLine(x1, y2+2, x2+2, y2+2, dropShadowPalette[1], 1)
|
||
|
allegro5.DrawLine(x2+2, y1, x2+2, y2+1, dropShadowPalette[1], 1)
|
||
|
allegro5.DrawLine(x1+1, y2+3, x2+2, y2+3, dropShadowPalette[2], 1)
|
||
|
allegro5.DrawLine(x2+3, y1+1, x2+3, y2+2, dropShadowPalette[2], 1)
|
||
|
}
|