From: Baptiste Assmann Date: Wed, 23 Apr 2025 08:36:37 +0000 (+0200) Subject: EXAMPLES: lua: avoid screen refresh effect in "trisdemo" X-Git-Tag: v3.2-dev17~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b437094853c15504dbde74e37c0bfcb20755eef4;p=thirdparty%2Fhaproxy.git EXAMPLES: lua: avoid screen refresh effect in "trisdemo" 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. --- diff --git a/examples/lua/trisdemo.lua b/examples/lua/trisdemo.lua index 7156df98d..4b60bb5ac 100644 --- a/examples/lua/trisdemo.lua +++ b/examples/lua/trisdemo.lua @@ -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()