]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
EXAMPLES: lua: avoid screen refresh effect in "trisdemo"
authorBaptiste Assmann <bassmann@haproxy.com>
Wed, 23 Apr 2025 08:36:37 +0000 (10:36 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 21 May 2025 10:00:53 +0000 (12:00 +0200)
In current version of the game, there is a "screen refresh" effect: the
screen is cleared before being re-drawn.
I moved the clear right after the connection is opened and removed it
from rendering time.

examples/lua/trisdemo.lua

index 7156df98d4b53a58edf064e5c8db96890c3e1b6d..4b60bb5ac218e1d12190d8b5874be08b9bb451a0 100644 (file)
@@ -112,7 +112,7 @@ local function rotate_piece(piece, piece_id, px, py, board)
 end
 
 function render(applet, board, piece, piece_id, px, py, score)
-    local output = clear_screen .. cursor_home
+    local output = cursor_home
     output = output .. game_name .. " - Lines: " .. score .. "\r\n"
     output = output .. "+" .. string.rep("-", board_width * 2) .. "+\r\n"
     for y = 1, board_height do
@@ -160,6 +160,7 @@ function handler(applet)
     end
 
     applet:send(cursor_hide)
+    applet:send(clear_screen)
 
     -- fall the piece by one line every delay
     local function fall_piece()