forked from LizzyFleckenstein03/Memeclone
Tweak sign text position
This commit is contained in:
parent
3987b6a4fa
commit
3dd3f0b3e2
|
@ -19,7 +19,6 @@ end
|
||||||
|
|
||||||
-- CONSTANTS
|
-- CONSTANTS
|
||||||
local SIGN_WIDTH = 115
|
local SIGN_WIDTH = 115
|
||||||
local SIGN_PADDING = 14
|
|
||||||
|
|
||||||
local LINE_LENGTH = 15
|
local LINE_LENGTH = 15
|
||||||
local NUMBER_OF_LINES = 4
|
local NUMBER_OF_LINES = 4
|
||||||
|
@ -73,6 +72,7 @@ local generate_line = function(s, ypos)
|
||||||
local parsed = {}
|
local parsed = {}
|
||||||
local width = 0
|
local width = 0
|
||||||
local chars = 0
|
local chars = 0
|
||||||
|
local printed_char_width = CHAR_WIDTH + 1
|
||||||
while chars <= LINE_LENGTH and i <= #s do
|
while chars <= LINE_LENGTH and i <= #s do
|
||||||
local file = nil
|
local file = nil
|
||||||
if charmap[s:sub(i, i)] ~= nil then
|
if charmap[s:sub(i, i)] ~= nil then
|
||||||
|
@ -86,7 +86,7 @@ local generate_line = function(s, ypos)
|
||||||
i = i + 1
|
i = i + 1
|
||||||
end
|
end
|
||||||
if file ~= nil then
|
if file ~= nil then
|
||||||
width = width + CHAR_WIDTH
|
width = width + printed_char_width
|
||||||
table.insert(parsed, file)
|
table.insert(parsed, file)
|
||||||
chars = chars + 1
|
chars = chars + 1
|
||||||
end
|
end
|
||||||
|
@ -94,10 +94,10 @@ local generate_line = function(s, ypos)
|
||||||
width = width - 1
|
width = width - 1
|
||||||
|
|
||||||
local texture = ""
|
local texture = ""
|
||||||
local xpos = math.floor((SIGN_WIDTH - SIGN_PADDING - width) / 2)
|
local xpos = math.floor((SIGN_WIDTH - width) / 2)
|
||||||
for i = 1, #parsed do
|
for i = 1, #parsed do
|
||||||
texture = texture..":"..xpos..","..ypos.."="..parsed[i]..".png"
|
texture = texture..":"..xpos..","..ypos.."="..parsed[i]..".png"
|
||||||
xpos = xpos + CHAR_WIDTH + 1
|
xpos = xpos + printed_char_width
|
||||||
end
|
end
|
||||||
return texture
|
return texture
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue