From 369499af39ba6fbe0d80814110595cbef170f07e Mon Sep 17 00:00:00 2001 From: SysL Date: Sat, 15 Jul 2023 14:32:30 -0600 Subject: [PATCH] Updates to library for changing character width See example 10! --- example/library/slog-text.lua | 2 +- example/main.lua | 4 ++-- readme.md | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/example/library/slog-text.lua b/example/library/slog-text.lua index f3ea8e0..539462a 100644 --- a/example/library/slog-text.lua +++ b/example/library/slog-text.lua @@ -1,7 +1,7 @@ local m = { debug = false, _NAME = 'SYSL-Text', - _VERSION = '1.9', + _VERSION = '2.0', _DESCRIPTION = 'Fancy Text System', _URL = 'https://github.com/SystemLogoff', _LICENSE = [[ diff --git a/example/main.lua b/example/main.lua index f9cebf5..d6693ac 100644 --- a/example/main.lua +++ b/example/main.lua @@ -179,7 +179,7 @@ example8box:send("[function=example.bop=true]Did you hear about the [color=#FF00 example9box = Text.new("left", { color = {0.9,0.9,0.9,0.95}, shadow_color = {0.5,0.5,1,0.4}, font = Fonts.comic_neue_small, character_sound = true, print_speed = 0.04, sound_every = 2, sound_number = 4}) example9box:send("Hello! Welcome to the world of Pocket Creatures![waitforinput][scroll][newline]My name is Professor Tree![newline][waitforinput][scroll][scroll]And you are?", 150, false) example10box = Text.new("left", { color = {0.9,0.9,0.9,0.95}, shadow_color = {0.5,0.5,1,0.4}, font = Fonts.monogram_extended_custom, character_sound = false, keep_space_on_line_break=true, modify_character_width_table = {["j"] = -1, }}) -example10box:send("Special Sheep Polution Test, Bahhh:\n\nij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij\n\na a a a a a a a a a a a a a a a a a a a a a a a a\n\nI've dropped so many letters oh no!", 540, true) +example10box:send("Special Sheep Polution Test, Bahhh:\n\nij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij\n\na a a a a a a a a a a a a a a a a a a a a a a a a\n\nI've dropped so many letters oh no!\nOjan Pjan Ajan Testj Characterj oj mh wj ikj applej orangej colaj Martijn..", 540, true) end --[[-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------]]-- @@ -305,7 +305,7 @@ if example.display_mode == 10 then love.graphics.draw(images.bg) Screen.stop() love.graphics.setColor(0,0,0,1) - love.graphics.rectangle("fill",0,0,540, 300) + love.graphics.rectangle("fill",0,0,540, 540) love.graphics.setColor(1,1,1,1) example10box:draw(0,0) end diff --git a/readme.md b/readme.md index f50b4ae..24915f4 100644 --- a/readme.md +++ b/readme.md @@ -4,6 +4,8 @@ ![Quick Demo of Examples](/screenshots/ex.gif?raw=true "Quick Demo of Examples") # Update Notes +* New: You can now pass a table to modify character widths, in case your font does something like move the j or q in one pixel. (See example 10) +* New: You can now pass tables to the Audio/Font/Image/Etc commands if you don't keep resources global * New ```[scroll]``` command, will scroll the text up by line-height or a set value. Works well with ```love.graphics.setScissor```. * You have access to the basic calculated width, height and linecount for each textbox. Access is under the ```get``` table. - ```my_cool_textbox.get.width, my_cool_textbox.get.height, my_cool_textbox.get.lines ```