shadowed text
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
function Item.use()
|
||||
print("Used item: " .. Context.dialog.active_entity.name)
|
||||
Print.text("Used item: " .. Context.dialog.active_entity.name)
|
||||
GameWindow.set_state(WINDOW_INVENTORY)
|
||||
end
|
||||
function Item.look_at()
|
||||
|
||||
@@ -7,6 +7,7 @@ local InventoryWindow = {}
|
||||
local ConfigurationWindow = {}
|
||||
|
||||
local UI = {}
|
||||
local Print = {}
|
||||
local Input = {}
|
||||
local NPC = {}
|
||||
local Item = {}
|
||||
|
||||
8
inc/system/system.print.lua
Normal file
8
inc/system/system.print.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
function Print.text(text, x, y, color, fixed, scale)
|
||||
local shadow_color = Config.colors.black
|
||||
if color == shadow_color then shadow_color = Config.colors.light_grey end
|
||||
scale = scale or 1
|
||||
print(text, x + 1, y + 1, shadow_color, fixed, scale)
|
||||
print(text, x, y, color, fixed, scale)
|
||||
end
|
||||
@@ -1,6 +1,6 @@
|
||||
function UI.draw_top_bar(title)
|
||||
rect(0, 0, Config.screen.width, 10, Config.colors.dark_grey)
|
||||
print(title, 3, 2, Config.colors.green)
|
||||
Print.text(title, 3, 2, Config.colors.green)
|
||||
end
|
||||
|
||||
function UI.draw_dialog()
|
||||
@@ -11,9 +11,9 @@ function UI.draw_menu(items, selected_item, x, y)
|
||||
for i, item in ipairs(items) do
|
||||
local current_y = y + (i-1)*10
|
||||
if i == selected_item then
|
||||
print(">", x - 8, current_y, Config.colors.green)
|
||||
Print.text(">", x - 8, current_y, Config.colors.green)
|
||||
end
|
||||
print(item.label, x, current_y, Config.colors.green)
|
||||
Print.text(item.label, x, current_y, Config.colors.green)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -50,28 +50,28 @@ function ConfigurationWindow.draw()
|
||||
|
||||
if i == ConfigurationWindow.selected_control then
|
||||
color = Config.colors.item
|
||||
print("<", x_start -8, current_y, color)
|
||||
print(label_text, x_start, current_y, color) -- Shift label due to '<'
|
||||
print(value_text, value_x, current_y, color)
|
||||
print(">", x_value_right_align + 4, current_y, color) -- Print '>' after value
|
||||
Print.text("<", x_start -8, current_y, color)
|
||||
Print.text(label_text, x_start, current_y, color) -- Shift label due to '<'
|
||||
Print.text(value_text, value_x, current_y, color)
|
||||
Print.text(">", x_value_right_align + 4, current_y, color) -- Print '>' after value
|
||||
else
|
||||
print(label_text, x_start, current_y, color)
|
||||
print(value_text, value_x, current_y, color)
|
||||
Print.text(label_text, x_start, current_y, color)
|
||||
Print.text(value_text, value_x, current_y, color)
|
||||
end
|
||||
elseif control.type == "action_item" then
|
||||
local label_text = control.label
|
||||
if i == ConfigurationWindow.selected_control then
|
||||
color = Config.colors.item
|
||||
print("<", x_start -8, current_y, color)
|
||||
print(label_text, x_start, current_y, color)
|
||||
print(">", x_start + 8 + (#label_text * char_width) + 4, current_y, color)
|
||||
Print.text("<", x_start -8, current_y, color)
|
||||
Print.text(label_text, x_start, current_y, color)
|
||||
Print.text(">", x_start + 8 + (#label_text * char_width) + 4, current_y, color)
|
||||
else
|
||||
print(label_text, x_start, current_y, color)
|
||||
Print.text(label_text, x_start, current_y, color)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
print("Press B to go back", x_start, 120, Config.colors.light_grey)
|
||||
Print.text("Press B to go back", x_start, 120, Config.colors.light_grey)
|
||||
end
|
||||
|
||||
function ConfigurationWindow.update()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
function IntroWindow.draw()
|
||||
local x = (Config.screen.width - 132) / 2 -- Centered text
|
||||
print(Context.intro.text, x, Context.intro.y, Config.colors.green)
|
||||
Print.text(Context.intro.text, x, Context.intro.y, Config.colors.green)
|
||||
end
|
||||
|
||||
function IntroWindow.update()
|
||||
|
||||
@@ -2,15 +2,15 @@ function InventoryWindow.draw()
|
||||
UI.draw_top_bar("Inventory")
|
||||
|
||||
if #Context.inventory == 0 then
|
||||
print("Inventory is empty.", 70, 70, Config.colors.light_grey)
|
||||
Print.text("Inventory is empty.", 70, 70, Config.colors.light_grey)
|
||||
else
|
||||
for i, item in ipairs(Context.inventory) do
|
||||
local color = Config.colors.light_grey
|
||||
if i == Context.selected_inventory_item then
|
||||
color = Config.colors.green
|
||||
print(">", 60, 20 + i * 10, color)
|
||||
Print.text(">", 60, 20 + i * 10, color)
|
||||
end
|
||||
print(item.name, 70, 20 + i * 10, color)
|
||||
Print.text(item.name, 70, 20 + i * 10, color)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -82,14 +82,14 @@ function PopupWindow.draw()
|
||||
|
||||
-- Display the entity's name as the dialog title
|
||||
if Context.dialog.active_entity and Context.dialog.active_entity.name then
|
||||
print(Context.dialog.active_entity.name, 120 - #Context.dialog.active_entity.name * 2, 45, Config.colors.green)
|
||||
Print.text(Context.dialog.active_entity.name, 120 - #Context.dialog.active_entity.name * 2, 45, Config.colors.green)
|
||||
end
|
||||
|
||||
-- Display the dialog content (description for "look at", or initial name/dialog for others)
|
||||
local wrapped_lines = UI.word_wrap(Context.dialog.text, 25) -- Max 25 chars per line
|
||||
local current_y = 55 -- Starting Y position for the first line of content
|
||||
for _, line in ipairs(wrapped_lines) do
|
||||
print(line, 50, current_y, Config.colors.light_grey)
|
||||
Print.text(line, 50, current_y, Config.colors.light_grey)
|
||||
current_y = current_y + 8 -- Move to the next line (8 pixels for default font height + padding)
|
||||
end
|
||||
|
||||
@@ -97,6 +97,6 @@ function PopupWindow.draw()
|
||||
if not Context.dialog.showing_description then
|
||||
UI.draw_menu(Context.dialog.menu_items, Context.dialog.selected_menu_item, 50, current_y + 2)
|
||||
else
|
||||
print("[A] Go Back", 50, current_y + 10, Config.colors.green)
|
||||
Print.text("[A] Go Back", 50, current_y + 10, Config.colors.green)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
function SplashWindow.draw()
|
||||
print("Mr. Anderson's", 78, 60, Config.colors.green)
|
||||
print("Addventure", 90, 70, Config.colors.green)
|
||||
Print.text("Mr. Anderson's", 78, 60, Config.colors.green)
|
||||
Print.text("Addventure", 90, 70, Config.colors.green)
|
||||
end
|
||||
|
||||
function SplashWindow.update()
|
||||
|
||||
Reference in New Issue
Block a user