mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-16 16:11:06 +01:00
Remove the label size thing (too breaking change)
This commit is contained in:
parent
c2032fe4de
commit
e093c69328
4 changed files with 336 additions and 251 deletions
|
@ -1,25 +1,21 @@
|
||||||
# MineClone2 Formspec Guide
|
# 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.
|
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.
|
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`
|
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
|
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
|
Labels should have 0.375 space above if there is no other stuff above and 0.45 between content
|
||||||
+ 0.375 under
|
|
||||||
|
- 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)
|
According to minetest modding book, table.concat is faster than string concatenation, so this method should be prefered (the code is also more clear)
|
|
@ -1,16 +1,12 @@
|
||||||
local string = string
|
|
||||||
local table = table
|
|
||||||
|
|
||||||
local sf = string.format
|
|
||||||
|
|
||||||
mcl_formspec = {}
|
mcl_formspec = {}
|
||||||
|
|
||||||
mcl_formspec.label_color = "#313131"
|
mcl_formspec.label_color = "#313131"
|
||||||
|
|
||||||
mcl_formspec.label_size = tonumber(minetest.settings:get("mcl_label_font_size")) or 24
|
---@param x number
|
||||||
|
---@param y number
|
||||||
mcl_formspec.apply_label_size = sf("style_type[label;font_size=%s]", mcl_formspec.label_size)
|
---@param w number
|
||||||
|
---@param h number
|
||||||
|
---@return string
|
||||||
function mcl_formspec.get_itemslot_bg(x, y, w, h)
|
function mcl_formspec.get_itemslot_bg(x, y, w, h)
|
||||||
local out = ""
|
local out = ""
|
||||||
for i = 0, w - 1, 1 do
|
for i = 0, w - 1, 1 do
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -192,11 +192,6 @@ animated_chests (Animated chests) bool true
|
||||||
# The maximum number of boss bars to simultaniously display on the screen
|
# The maximum number of boss bars to simultaniously display on the screen
|
||||||
max_bossbars (Maximum Boss bars) int 5
|
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)
|
# Default intensity of shadows (default: 0.33)
|
||||||
mcl_default_shadow_intensity (Default shadow intensity) float 0.33 0.0 1.0
|
mcl_default_shadow_intensity (Default shadow intensity) float 0.33 0.0 1.0
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue