From a65dcddbc7b6c12d36a30adbe901e61d5c678dd9 Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Wed, 17 Apr 2024 08:09:37 +0200 Subject: [PATCH] bugfix: clear before next gen --- main.go | 3 ++- types.go | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 5d20287..bbe9ee9 100644 --- a/main.go +++ b/main.go @@ -11,7 +11,8 @@ import ( func output(client *resty.Client, url string, width, height int, arr [][]Cell) { goterm.MoveCursor(1, 4) // Prepare instructions for matrix - instructions := make([]interface{}, 0) + instructions := make([]interface{}, 1) + instructions[0] = Clear{Endpoint: CLEAR} // Append all live cells as pixel instructions for j := 0; j < height; j++ { for i := 0; i < width; i++ { diff --git a/types.go b/types.go index 762ec5c..a5299e3 100644 --- a/types.go +++ b/types.go @@ -11,6 +11,7 @@ const ( UPDATE Endpoint = "update" PIXEL Endpoint = "pixel" COLOR Endpoint = "color" + CLEAR Endpoint = "clear" ) type Rectangle struct { @@ -21,6 +22,10 @@ type Rectangle struct { Endpoint Endpoint `json:"endpoint"` } +type Clear struct { + Endpoint Endpoint `json:"endpoint"` +} + type Update struct { Endpoint Endpoint `json:"endpoint"` }