mirror of
https://github.com/mt-mods/led_marquee.git
synced 2024-11-24 08:13:52 +01:00
Added a "cursor position" command byte
updated README
This commit is contained in:
parent
4bb68ec009
commit
b9a0656407
18
README.md
18
README.md
@ -16,9 +16,19 @@ The string will spread down the line until either a panel is found that faces th
|
||||
|
||||
Panels to the left of the connected one are ignored (unless they, too, have their own connections).
|
||||
|
||||
You can put multiple lines of panels end to end to form independent displays, so long as the panels that start each of the lines have unique channel names set.
|
||||
You can also stack up a wall of LED panels, of any horizontal and vertical amount. If you then set a channel on the upper left panel, leave the others un-set, and connect a LuaController to it via digilines, the whole wall of panels will be treated as a multi-line display.
|
||||
|
||||
The string is padded with spaces and then trimmed to 64 characters.
|
||||
Long strings sent to that channel will be displayed starting at the upper-left and working from left to right, top to bottom, wrapping from line to line as appropriate (similar to printing to a shell terminal).
|
||||
|
||||
As with a single line, printing continues from node to node until the program either finds a panel with a different non-empty channel than the first one, or if it finds a panel that's facing the wrong way.
|
||||
|
||||
If the program finds something other than a panel, it wraps to the next line. If it finds something other than a panel twice in a row, that signals that text has wrapped off of the last row, and printing is cut off.
|
||||
|
||||
Lines of panels don't need to be all the same length, the program will wrap as needed, with the left margin always being aligned with the panel the LuaController is connected to.
|
||||
|
||||
Strings are trimmed to 1 kB.
|
||||
|
||||
Panels are not erased between prints.
|
||||
|
||||
Any unrecognized symbol or character, whether part of a string or singularly is ignored, except as noted below.
|
||||
|
||||
@ -50,6 +60,10 @@ Colors 24 - 27 are white, light grey, medium grey, and dim grey.
|
||||
|
||||
The left-most/"master" panel will remember the last color used, and defaults to red.
|
||||
|
||||
A byte value of 28 will act as a line feed (I would have used 10, but that's a color code :-P )
|
||||
|
||||
A byte value of 29 signals a cursor position command. The next two byte values select a column and row, respectively. The next character after the row byte will be printed there, and the rest of the string then continues printing from that spot onwards.
|
||||
|
||||
You can use "get" and "getstr" to read the one character from the connected panel. These messages will not read the other panels in the lineup.
|
||||
|
||||
All panels emit a small amount of light when displaying something.
|
||||
|
8
init.lua
8
init.lua
@ -85,6 +85,14 @@ local display_string = function(pos, channel, string)
|
||||
pos2.z = pos.z
|
||||
i = i + 1
|
||||
wrapped = nil
|
||||
elseif asc == 29 then
|
||||
local c = string.byte(string, i+1, i+1) or 0
|
||||
local r = string.byte(string, i+2, i+2) or 0
|
||||
pos2.x = pos.x + (fdir_to_right[fdir+1][1])*c
|
||||
pos2.y = pos.y - r
|
||||
pos2.z = pos.z + (fdir_to_right[fdir+1][2])*c
|
||||
i = i + 3
|
||||
wrapped = nil
|
||||
elseif asc > 30 and asc < 256 then
|
||||
minetest.swap_node(pos2, { name = "led_marquee:char_"..asc, param2 = master_fdir + (last_color*8)})
|
||||
pos2.x = pos2.x + fdir_to_right[fdir+1][1]
|
||||
|
Loading…
Reference in New Issue
Block a user