Port over code from old collision dev PR

master
Noah 2019-04-09 19:17:56 -07:00
rodič 31e01987e5
revize 2ae77a8c82
2 změnil soubory, kde provedl 19 přidání a 24 odebrání

Zobrazit soubor

@ -156,15 +156,15 @@ func (c *Color) UnmarshalJSON(b []byte) error {
}
// Add a relative color value to the color.
func (c Color) Add(r, g, b, a int32) Color {
func (c Color) Add(r, g, b, a int) Color {
var (
R = int32(c.Red) + r
G = int32(c.Green) + g
B = int32(c.Blue) + b
A = int32(c.Alpha) + a
R = int(c.Red) + r
G = int(c.Green) + g
B = int(c.Blue) + b
A = int(c.Alpha) + a
)
cap8 := func(v int32) uint8 {
cap8 := func(v int) uint8 {
if v > 255 {
v = 255
} else if v < 0 {
@ -182,11 +182,22 @@ func (c Color) Add(r, g, b, a int32) Color {
}
// Lighten a color value.
func (c Color) Lighten(v int32) Color {
func (c Color) Lighten(v int) Color {
return c.Add(v, v, v, 0)
}
// Darken a color value.
func (c Color) Darken(v int32) Color {
func (c Color) Darken(v int) Color {
return c.Add(-v, -v, -v, 0)
}
// Transparentize adjusts the alpha value.
func (c Color) Transparentize(v int) Color {
return c.Add(0, 0, 0, v)
}
// SetAlpha sets the alpha value to a specific setting.
func (c Color) SetAlpha(v uint8) Color {
c.Alpha = v
return c
}

Zobrazit soubor

@ -1,16 +0,0 @@
package sdl
// Frames to cache for FPS calculation.
const (
maxSamples = 100
TargetFPS = 1000 / 60
)
var (
fpsCurrentTicks uint32 // current time we get sdl.GetTicks()
fpsLastTime uint32 // last time we printed the fpsCurrentTicks
fpsCurrent int
fpsFrames int
fpsSkipped uint32
fpsInterval uint32 = 1000
)