Skip to content
Browse files

Add scroll_container formspec element (redo) (#9101)

New formspec elements:

 - `scroll_container[<X>,<Y>;<W>,<H>;<scrollbar name>;<orientation>;<scroll factor>]`
 - `scroll_container_end[]`

Other elements can be embedded in this element. Scrollbar must be placed manually.
  • Loading branch information
Desour committed Apr 13, 2020
1 parent 6cf15cf commit 0ac999ded725f8efcd26db284161683e37efeecf
@@ -194,6 +194,7 @@ LOCAL_SRC_FILES := \
jni/src/gui/guiPasswordChange.cpp \
jni/src/gui/guiPathSelectMenu.cpp \
jni/src/gui/guiScrollBar.cpp \
jni/src/gui/guiScrollContainer.cpp \
jni/src/gui/guiSkin.cpp \
jni/src/gui/guiTable.cpp \
jni/src/gui/guiVolumeChange.cpp \
@@ -2102,6 +2102,26 @@ Elements
* End of a container, following elements are no longer relative to this

### `scroll_container[<X>,<Y>;<W>,<H>;<scrollbar name>;<orientation>;<scroll factor>]`

* Start of a scroll_container block. All contained elements will ...
* take the scroll_container coordinate as position origin,
* be additionally moved by the current value of the scrollbar with the name
`scrollbar name` times `scroll factor` along the orientation `orientation` and
* be clipped to the rectangle defined by `X`, `Y`, `W` and `H`.
* `orientation`: possible values are `vertical` and `horizontal`.
* `scroll factor`: optional, defaults to `0.1`.
* Nesting is possible.
* Some elements might work a little different if they are in a scroll_container.
* Note: If you want the scroll_container to actually work, you also need to add a
scrollbar element with the specified name. Furthermore, it is highly recommended
to use a scrollbaroptions element on this scrollbar.

### `scroll_container_end[]`

* End of a scroll_container, following elements are no longer bound to this

### `list[<inventory location>;<list name>;<X>,<Y>;<W>,<H>;]`

* Show an inventory list if it has been sent to the client. Nothing will
@@ -1,5 +1,35 @@
local color = minetest.colorize

local hypertext = minetest.formspec_escape([[
<global halign=justify valign=center background=#CCF color=#444 actioncolor=darkblue margin=10>
<style color=black>Furnaces</style> are <action name="crafting">crafted</action> and used by the player for the purpose of cooking food and <action name="smelting">smelting</action> various items.
<item name=default:furnace float=right width=128 rotate=yes>
<style color=black>Type:</style> Solid block
<style color=black>Drops:</style> Itself
<style color=black>Physics:</style> No
<style color=black>Luminance:</style> Inactive:No Active:Yes (8)
<style color=black>Flammable:</style> No
<style color=black>Generated:</style> No
<style color=black>Renewable:</style> Yes
<style color=black>Stackable:</style> Yes (99)
<style color=black>Itemstring:</style> default:furnace default:furnace_active
The furnace menu can be accessed by <action name="using">using</action> the furnace.
The furnace has 3 <action name="inventory">inventories</action>: An input slot, a fuel slot and 4 output slots. The fire in the furnace will automatically start when there is a smeltable item in the input slot and a fuel in the fuel slot.
As long as the fire is on, the furnace will smelt any smeltable item in the input slot, one by one, until it is empty. When the fire goes off, it will smelt the next item until there are no smeltable items and no fuel items left.
The current stage of cooking can be seen by <action name="pointing">pointing</action> the furnace or by viewing the furnace menu. In the furnace menu, the flame symbol roughly shows the remaining burning time. The arrow symbol shows the progress of the current smelting process.
Furnaces can be crafted from e.g. <action name="default:cobblestone">cobblestone</action>, a renewable resource.
Sorry no way to display crafting yet in formspec pages.
See <action name="smelting">Smelting</action> for a list of furnace fuels.
See the <action name="smelting">Smelting</action> page.

local clip_fs = [[
@@ -188,13 +218,48 @@ Number]

"label[2,15;bla Bli\nfoo bar]"..
"hypertext[3,13;3,3;;" .. hypertext .. "]" ..
"scrollbaroptions[max=170]".. -- lowest seen pos is: 0.1*170+6=23 (factor*max+height)

local function show_test_formspec(pname, page_id)
page_id = page_id or 2

local fs = pages[page_id] .. "tabheader[0,0;6,0.65;maintabs;Real Coord,Styles,Noclip,MiscEle;" .. page_id .. ";false;false]"
local fs = pages[page_id] .. "tabheader[0,0;8,0.65;maintabs;Real Coord,Styles,Noclip,MiscEle,Scroll Container;" .. page_id .. ";false;false]"

minetest.show_formspec(pname, "test:formspec", fs)
@@ -16,6 +16,7 @@ set(gui_SRCS

0 comments on commit 0ac999d

Please sign in to comment.