1
0
Fork 0

Remove the label size thing (too breaking change)

This commit is contained in:
AFCMS 2022-09-09 20:42:28 +02:00
parent c2032fe4de
commit e093c69328
Signed by untrusted user: AFCMS
GPG Key ID: 8720389A25B652E3
4 changed files with 336 additions and 251 deletions

View File

@ -1,25 +1,21 @@
# MineClone2 Formspec Guide
***This guide will learn you rules about creation of formspecs for the MineClone2 game.***
**_This guide will learn you rules about creation of formspecs for the MineClone2 game._**
Formspecs are an important part of game and mod development.
First of all, MineClone2 aims to support ONLY last formspec version. Many utility functions will not work with formspec v1 or v2.
Label font size should be 25 to be minecraft like. We arent modifying formspec prepend in order to not break existing mods.
Just add this code to apply it to your formspec:
```lua
mcl_formspec.apply_label_size
```
The typical width of an 9 slots width inventory formspec is `0.375 + 9 + ((9-1) * 0.25) + 0.375 = 11.75`
Margins is 0.375
Margins is 0.375.
The labels color is `mcl_formspec.label_color`
Space between 1st inventory line and the rest of inventory is 0.45
Labels should have 0.375 space above if there is no other stuff above and 0.45 between content
+ 0.375 under
According to minetest modding book, table.concat is faster than string concatenation, so this method should be prefered (the code is also more clear)
- 0.375 under
According to minetest modding book, table.concat is faster than string concatenation, so this method should be prefered (the code is also more clear)

View File

@ -1,16 +1,12 @@
local string = string
local table = table
local sf = string.format
mcl_formspec = {}
mcl_formspec.label_color = "#313131"
mcl_formspec.label_size = tonumber(minetest.settings:get("mcl_label_font_size")) or 24
mcl_formspec.apply_label_size = sf("style_type[label;font_size=%s]", mcl_formspec.label_size)
---@param x number
---@param y number
---@param w number
---@param h number
---@return string
function mcl_formspec.get_itemslot_bg(x, y, w, h)
local out = ""
for i = 0, w - 1, 1 do

File diff suppressed because it is too large Load Diff

View File

@ -192,11 +192,6 @@ animated_chests (Animated chests) bool true
# The maximum number of boss bars to simultaniously display on the screen
max_bossbars (Maximum Boss bars) int 5
# Define how wide font will be displayed in mineclone2 formspecs
# This allow MineClone2 to have a label size similar to minecraft, but allowing at least singleplayer to use his own font with custom size
# (some fonts may be bigger than the default one and break formspecs)
mcl_label_font_size (Label Font Size) int 24
# Default intensity of shadows (default: 0.33)
mcl_default_shadow_intensity (Default shadow intensity) float 0.33 0.0 1.0