scale the "how to chat" formspec for other screen-sizes than mine

This commit is contained in:
tour 2024-02-13 14:44:13 +01:00
parent fa193d02c9
commit 7faa35f219
2 changed files with 39 additions and 30 deletions

View File

@ -33,9 +33,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
local context = chat_formspec.get_context(name)
local sendername = context.sender
if fields.chat_help then
chat_formspec.show_misc(name, "chat_help")
elseif fields.replant_help then
chat_formspec.show_misc(name, "replant_help")
chat_formspec.show_misc(name, "platform_select")
elseif minetest.get_player_by_name(sendername) then
local answer = fields.answer or ""
minetest.chat_send_player(sendername, minetest.colorize("orange",
@ -95,6 +93,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
minetest.show_formspec(name, "chat_formspec:target_fs", context.fs)
end
end)
elseif fields.PC then
chat_formspec.show_misc(name, "chat_PC")
elseif fields.touch then
chat_formspec.show_misc(name, "chat_touch")
else
minetest.show_formspec(name, "chat_formspec:target_fs", context.fs)
end

View File

@ -67,15 +67,23 @@ function chat_formspec.create_target_fs(context)
end
chat_formspec.misc_fs = {}
chat_formspec.misc_fs.chat_help = [[
formspec_version[2]
size[15,10]
label[6,0.8;How to chat?]
label[6,0.8;___________]
label[0.3,1.5;On a computer:]
label[0.3,1.6;____________]
chat_formspec.misc_fs.platform_select = [[
formspec_version[2]
size[9,4]
textarea[3,1.35;15,4;;;1) close all pop-ups inside minetest by pressing 'ESC'
label[2.3,1;Do you play on Touchscreen or on PC]
button[1,2;3,0.8;PC;PC]
button[5,2;3,0.8;touch;Touchscreen]
]]
chat_formspec.misc_fs.chat_PC = [[
formspec_version[2]
size[12,9.5]
label[4.5,0.8;How to chat on PC?]
label[4.5,0.8;________________]
textarea[0.5,1.35;11,6;;;1) close all pop-ups inside minetest by pressing 'ESC'
2) Press your 'T' or 'F10' key
3) Write the text you want to send to the public chat
in case you do not want everyone to see you text, add a '/m playername' in front of you text.
@ -84,28 +92,27 @@ textarea[3,1.35;15,4;;;1) close all pop-ups inside minetest by pressing 'ESC'
In case you can't see the chat, try pressing 'F2' to show / hide the chat]
label[0.3,4.5;On mobile / tablet:]
label[0.3,4.6;______________]
button[4.5,8;3,0.8;ok;OK]
]]
textarea[3,4.345;15,7;;;1) Close all pop-ups inside Minetest by tapping outside of them
2) Press the following buttons:
chat_formspec.misc_fs.chat_touch = [[
formspec_version[2]
size[12,9.5]
style_type[*;noclip=true]
=>
label[4.5,0.8;How to chat on mobile?]
label[4.5,0.8;___________________]
4) Write the text you want to send to the public chat
in case you do not want everyone to see you text, add a '/m playername' in front of you text.
only the player with the name you specified will see your text then
5) send your Text by pressing 'Enter'
label[0.5,1.35;1) Close all pop-ups inside Minetest by tapping outside of them]
label[0.5,1.85;2) Press the following buttons:]
image[0.5,2.35;0.75,1;rare_controls.png]
image[3,2.35;1,1;chat_btn.png]
label[0.5,3.85;3) Write the text you want to send in the public Chat]
label[0.5,4.35;4) Confirm by pressing 'Enter']
In case you can't see chat, try pressing the following buttons
label[0.5,5;In case you can't see the chat, try pressing the following buttons:]
image[0.5,5.5;1,1;gear_icon.png]
image[3,5.5;1,1;chat_show_btn.png]
=>]
image[3,5.05;0.5,0.75;rare_controls.png]
image[4,5;1,1;chat_btn.png]
image[3,8.05;1,1;gear_icon.png]
image[4.5,8.05;1,1;chat_show_btn.png]
button[6,9;3,0.8;ok;OK]
button[4.5,8;3,0.8;ok;OK]
]]