sdl2-life

Conway's Game of Life with go-sdl2
git clone https://www.brianlane.com/git/sdl2-life
Log | Files | Refs | README

commit a76aade7caea7c421ad859eba0b34265e56c7949
parent d8b33e33c58db1e7c6cb1c430fc8e2421765a1d6
Author: Brian C. Lane <bcl@brianlane.com>
Date:   Sun, 18 Dec 2022 09:20:54 -0800

Fix linear gradient limit check

The polylinear function calls it with 1 color, which is valid, it just
doesn't cover any range.

Diffstat:
Mmain.go | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/main.go b/main.go @@ -144,8 +144,8 @@ func (g *Gradient) Append(from Gradient, start int) { // // Only uses the first and last color passed in func NewLinearGradient(colors []RGBAColor, maxAge int) (Gradient, error) { - if len(colors) < 2 { - return Gradient{}, fmt.Errorf("Linear Gradient requires 2 colors") + if len(colors) < 1 { + return Gradient{}, fmt.Errorf("Linear Gradient requires at least 1 color") } // Use the first and last color in controls as start and end