diff --git a/graphics/graphics.go b/graphics/graphics.go index 9173c76..22c40aa 100644 --- a/graphics/graphics.go +++ b/graphics/graphics.go @@ -6,7 +6,7 @@ import ( "github.com/veandco/go-sdl2/sdl" "math" "os" - "strconv" + //"strconv" ) type Graphics struct { @@ -55,7 +55,9 @@ func (g *Graphics) Render(env *core.Environment, turtles []*core.Turtle) { amount := math.Min(float64(env.Sniff(name, x, y)), 255) if amount > 0 { - g.renderer.SetDrawColor(color[0]*uint8(amount), color[1]*uint8(amount), color[2]*uint8(amount), uint8(255)) + // TODO explictly define this scale + scaledamount := uint8(float64(color[0]) * (amount/2)) + g.renderer.SetDrawColor(scaledamount,0,scaledamount, uint8(0xF0)) g.renderer.DrawPoint(int32(x), int32(y)) } } @@ -81,7 +83,7 @@ func (g *Graphics) Render(env *core.Environment, turtles []*core.Turtle) { g.renderer.Present() g.window.UpdateSurface() - surface, _ := g.window.GetSurface() - surface.SaveBMP("./images/" + strconv.Itoa(g.t) + ".bmp") +// surface, _ := g.window.GetSurface() +// surface.SaveBMP("./images/" + strconv.Itoa(g.t) + ".bmp") g.t++ } diff --git a/main.go b/main.go index 8439c43..014c6ce 100644 --- a/main.go +++ b/main.go @@ -89,6 +89,8 @@ func main() { for i := 0; i < *numTurtles; i++ { turtles[i] = core.NewTurtle(env, &actors.SlimeMold{SniffDistance: 20}) } + env.InitPheromone("trail") + g.ColorPheromone("trail", [4]uint8{0x81, 0, 0x81, 0x00}) } running := true