Commit Graph

371 Commits

Author SHA1 Message Date
DS dad87a360b
Use utf-8 for the Irrlicht clipboard (#11538) 2021-08-23 14:09:50 +02:00
DS 1ab29f1716
Fix GUIEditBoxWithScrollBar using a smaller steps than intlGUIEditBox (#11519) 2021-08-08 18:59:45 +02:00
Pevernow c6eddb0bae
Gettext support on Android (#11435)
Co-authored-by: sfan5 <sfan5@live.de>
Co-authored-by: =?UTF-8?q?Olivier=20Samyn=20=F0=9F=8E=BB?= <code@oleastre.be>
2021-08-08 18:59:07 +02:00
hecks 850293bae6
Remove unused header includes 2021-07-21 22:07:13 +02:00
Wuzzy 51bf4a6e26
Perform some quality assurance for translation strings (#11375) 2021-06-23 17:35:50 +01:00
pecksin 1805775f3d
Make chat web links clickable (#11092)
If enabled in minetest.conf, provides colored, clickable (middle-mouse or ctrl-left-mouse) weblinks in chat output, to open the OS' default web browser.
2021-06-20 17:20:24 +02:00
sfan5 758e3aa1ca Fix background color of formspec text fields 2021-05-30 11:40:14 +02:00
SmallJoker 93f43c890b GUIEditBox: Allow selecting and copying read-only texts 2021-05-22 14:39:41 +02:00
Loic Blot 48d5abd5be refacto: remove get_gui_env & draw_load_screen from RenderingEngine singleton 2021-05-03 19:49:19 +02:00
Loic Blot 5a02c376ea refacto: RenderingEngine::get_scene_manager() is now not callable from singleton
This permits to make evidence that we have some bad object passing on various code parts. I fixed majority of them to reduce the scope of passed objects

Unfortunately, for some edge cases i should have to expose ISceneManager from client, this should be fixed in the future when our POO will be cleaner client side (we have a mix of rendering and processing in majority of the client objects, it works but it's not clean)
2021-05-03 19:49:19 +02:00
Loic Blot 258101a910 refacto: RenderingEngine is now better hidden
* No more access to the singleton instance from everywhere (RenderingEngine::get_instance dropped)
* RenderingEngine::get_timer_time is now non static
* RenderingEngine::draw_menu_scene is now non static
* RenderingEngine::draw_scene is now non static
* RenderingEngine::{initialize,finalize} are now non static
* RenderingEngine::run is now non static
* RenderingEngine::getWindowSize now have a static helper. It was mandatory to hide the global get_instance access
2021-05-03 19:49:19 +02:00
Seth Traverse 16e5b39e1d
Add a key to toggle map block bounds (#11172)
It's often useful to know where the map block boundaries are for doing server admin work and the like.
Adds three modes: single mapblock, range of 5, and disabled.
2021-04-20 19:23:31 +02:00
yw05 85163b531f
Make edit boxes respond to string input (IME) (#11156)
Make edit boxes respond to string input events (introduced in minetest/irrlicht#23) that are usually triggered by entering text with an IME.
2021-04-05 15:56:29 +02:00
sfan5 f0bad0e2ba
Reserve vectors before pushing and other code quality changes (#11161) 2021-04-05 13:38:31 +02:00
sfan5 024d47e0d3
CGUITTFont optimizations (#11136) 2021-04-02 00:20:16 +02:00
Jean-Patrick Guerrero c9eba8440d
Fix segfault for model[] without animation speed 2021-03-21 23:23:30 +01:00
sfan5 96d4df995c
Drop old text input workarounds (#11089)
* Drop unused intlGUIEditBox

* Drop unnecessary Linux text input workarounds
2021-03-19 18:44:32 +01:00
Jean-Patrick Guerrero 285ba74723
GUIScene: Clear depth buffer + replace deprecated clearZBuffer calls 2021-03-16 23:28:16 +01:00
sfan5 3579dd2186 Restore Irrlicht 1.9 support 2021-03-09 21:53:17 +01:00
Wuzzy 827224635b
Use "Aux1" key name consistently everywhere 2021-02-24 11:45:30 +01:00
Jean-Patrick Guerrero 6591597430 Fix animation_image support in scroll containers 2021-02-08 00:04:38 +00:00
Vitaliy 4caf156be5
Rewrite touch event conversion (#10636) 2021-02-07 11:48:30 +01:00
k.h.lai 2072afb72b
Fix memory leak detected by address sanitizer (#10896) 2021-02-02 20:56:24 +01:00
Vincent Robinson f227e40180
Fix list spacing and size (again) (#10869) 2021-02-02 20:55:13 +01:00
sfan5 c834d2ab25 Drop wide/narrow conversion functions
The only valid usecase for these is interfacing with OS APIs
that want a locale/OS-specific multibyte encoding.
But they weren't used for that anywhere, instead UTF-8 is pretty
much assumed when it comes to that.
Since these are only a potential source of bugs and do not fulfil
their purpose at all, drop them entirely.
2021-02-02 20:46:08 +01:00
SmallJoker 37a05ec8d6 Settings: Proper priority hierarchy
Remove old defaults system
Introduce priority-based fallback list
Use new functions for map_meta special functions
Change groups to use end tags

Unittest changes:
 * Adapt unittest to the new code
 * Compare Settings objects
2021-01-29 17:32:35 +01:00
Vitaliy ed0882fd58
Include irrlichttypes.h first to work around Irrlicht#433 (#10872)
Fixes the PcgRandom::PcgRandom linker issue, caused by inconsistent data type definition.
2021-01-28 21:25:13 +01:00
Vincent Robinson ad9adcb884
Fix formspec list spacing (#10861) 2021-01-23 14:49:13 -08:00
Vincent Robinson 6a55c03dab
Make hypertext and textarea have proper scroll event propagation. (#10860) 2021-01-23 14:48:57 -08:00
Vincent Robinson 009e39e73b
FormSpec: Add list spacing, slot size, and noclip (#10083)
* Add list spacing, slot size, and noclip

* Simplify StyleSpec

* Add test cases

Co-authored-by: rubenwardy <rw@rubenwardy.com>
2021-01-23 12:46:19 -08:00
rubenwardy 4c76239818
Remove dead code (#10845) 2021-01-22 15:09:26 +00:00
Loïc Blot 4b01282821
Factorize more guiEditBoxes code (#10789)
* Factorize more guiEditBoxes code
2021-01-13 09:05:09 +01:00
Loïc Blot 5fcc78a1fe
Refactor/gui editbox (#10787) 2021-01-07 13:21:12 +01:00
Loïc Blot 58a709096e
refacto: factorize multiple code parts from guiEditbox childs (#10782) 2021-01-04 20:19:20 +01:00
Jean-Patrick Guerrero ff921f6989 Formspecs: Fix broken texture escaping with model[] 2021-01-01 17:03:34 +01:00
Lars Mueller 09d7fbd645 Fix item tooltip background color not working 2020-12-28 13:57:45 +01:00
sfan5 74762470b2 Fix some minor code issues all over the place 2020-12-24 13:44:54 +01:00
Thomas--S d0a38f694d
Formspec: Allow to specify frame loop for model[] (#10679)
Add the ability to specify an animation frame loop range for the model[] formspec element.
2020-12-15 19:06:36 +01:00
SmallJoker f2c8c6bf51 Revert "GUIFormSpecMenu: Shift+Click listring workaround for MacOS"
The commit caused Shift-Clicking issues on Linux due to another Irrlicht bug where
KeyInput.Shift released keys do not trigger OnEvent()

MacOS users should build using a recent Irrlicht 1.8 development version.
See also: https://sourceforge.net/p/irrlicht/patches/321/
2020-12-14 11:05:24 -08:00
SmallJoker e18b6c5a21 GUIFormSpecMenu: Shift+Click listring workaround for MacOS
event.MouseInput.Shift is not implemented for MacOS
2020-12-12 20:55:06 +01:00
sfan5 9bb381ebd3 Change typedef to normal definitions in GUI code 2020-11-26 22:42:19 +01:00
Pierre-Yves Rollo 78273027bf Add sound to press event of some formspecs elements (#10402) 2020-11-23 21:28:25 +01:00
red-001 8eb2cbac61
Fix warnings about an unused variables and implicit conversion (#10586) 2020-11-12 21:05:47 +01:00
SmallJoker 3356da0151
Add model[] formspec element (#10320)
Formspec element to display models, written by @kilbith, rebased and tweaked.

Co-authored-by: Jean-Patrick Guerrero <jeanpatrick.guerrero@gmail.com>
Co-authored-by: sfan5 <sfan5@live.de>
2020-11-04 21:46:18 +01:00
DS b2f3f66385
Fix box[]es not being clipped (#10473)
Fixes a regression of #8676.
2020-10-08 19:44:47 +02:00
SmallJoker f46509d5e2
Remove unused functions reported by cppcheck (#10463)
Run unused functions reported by cppcheck

This change removes a few (but not all) unused functions.
Some unused helper functions were not removed due to their complexity and potential of future use.
2020-10-05 09:07:33 +02:00
random-geek 0750047919
Fix scroll bar overlapping text (again) (#9058) 2020-10-03 17:34:34 +01:00
HybridDog 9dc29a75b4
Reduce the FPS when the window is unfocused (#8837) 2020-10-03 17:33:51 +01:00
Hugues Ross 9976f36b18
Make bgcolor tint button background images (#9818) 2020-08-29 16:41:19 +01:00
Kezi 3e5bce2251
darken tabheader background color (#10299) 2020-08-23 22:50:45 +02:00
EvidenceB 287f3fb2e3
Avoid drawing clipped out formspec elements (#10095) 2020-08-23 22:50:14 +02:00
adrido 3c2890692b
Fix MSVC compiler warnings (#10197) 2020-08-23 15:41:04 +02:00
Pierre-Yves Rollo 71287894ad
Fix missing translation call in hypertext (#10296) 2020-08-20 12:25:02 +02:00
v-rob 83d0c360cc
Add gradients and borders to FormSpec boxes (#8676) 2020-08-19 18:14:47 -07:00
v-rob 471497fa91
Optimize formspec form size (#10144) 2020-08-19 16:13:29 -07:00
v-rob cd0e213a36
Add font styling options to tables and textlists (#10203) 2020-08-11 20:07:17 +02:00
Maksim 76afde861d
Android: Fix ConfirmRegistration and PasswordChange input and scale size (#10182) 2020-07-21 13:16:25 +01:00
Zughy cfaef5b1cf
Formspecs: volume and key settings windows can now be closed by doubleclicking/tapping (#10128)
Co-authored-by: Xx_Crazyminer_xX <carlo.digioia@hotmail.it>
Co-authored-by: Marco <4279489-marco_a@users.noreply.gitlab.com>
2020-07-14 22:37:28 +02:00
v-rob 2bec83eec0
Add FormSpec font styling options (#9763)
* Add FormSpec font styling options

* Change multiplication to stof

* Remove extraneous check
2020-07-12 09:48:50 +02:00
v-rob e0499731a8
Allow FormSpec elements to be focused with `set_focus` (#9353)
This allows you to specify a FormSpec element to set the focus of with "set_focus[<name>;<always set>]".
2020-07-12 09:47:05 +02:00
v-rob b1ff04e06d
Formspec: Make dropdowns optionally return event based on index, not value (#9496) 2020-07-10 12:11:26 +02:00
v-rob da71313e1d
Don't stop style parsing on unknown property (#10143) 2020-07-03 18:33:23 +02:00
Pierre-Yves Rollo ee6c499ff8
Fix wrong use of guiScalingImageButton in formspecs buttons (#10094) 2020-06-24 11:35:06 +02:00
rubenwardy 8ebeed53ad
Android: Fix only right strafe working (#10046) 2020-06-18 01:43:43 +01:00
MoNTE48 b9f618746c TouchScreenGUI: fix some bugs, cleanup 2020-06-09 19:35:25 +02:00
MoNTE48 0d8e5bf587 TouchScreen Control: fix some bugs, cleanup 2020-06-09 19:35:25 +02:00
Maksim 756dc89ede Fix real keyboard movements on touchscreen devices 2020-06-09 19:35:25 +02:00
MoNTE48 3cee55f2b4 Hide tooltip after ETIE_LEFT_UP (for touch control) 2020-06-09 19:35:25 +02:00
SmallJoker a9b74f4c39
Add chat_font_size setting (#9736)
Default font sizes are used when the setting value is 0 or below (clamped by Settings).
2020-05-24 14:24:13 +02:00
Awkor 037422fdba
Modernize include guards and add missing ones (#9898) 2020-05-23 13:23:05 +02:00
Paul Ouellette b6242498aa
Always use same default tabheader height (#9319)
Previously the default tabheader height was different when using
real coordinates. This resulted in the height of tabs changing when
switching tabs in sfinv if some tabs used real coordinates.
2020-05-09 17:14:29 +02:00
v-rob 664800b2ad
FormSpec: Add universal style selector `*` (#9718) 2020-05-06 19:36:02 +02:00
Loïc Blot f1a05d0f71
Fix broken client if openal cannot be opened (#9804) 2020-05-05 08:38:18 +02:00
Hugues Ross cb9a44ef89
Add 'content_offset' and 'padding' style properties for buttons (#9661)
* Add padding and content_offset style properties to buttons
2020-05-02 13:32:02 +02:00
v-rob bc60e44d80
Add `animated_image` to clickthrough elements (#9724) 2020-04-25 16:55:21 +02:00
Pierre-Yves Rollo 6cc5c7cbb4
Simplify how parseElement splits element string (#9726) 2020-04-25 07:48:04 +02:00
DS 4fb6b6afa7
Formspec: allow lists to change size and existence while the formspec is open (#9700)
Fixes #9640.
2020-04-18 17:21:10 +02:00
DS 241bf44260
Apply a scrollbar's default value to scroll containers (#9699)
Fixes #9691.
2020-04-18 17:20:20 +02:00
Maksim 57038b3cb4
Android: fix formspec input for AArch64 devices (#9685) 2020-04-16 19:19:47 +02:00
DS 0ac999ded7
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.
2020-04-13 10:50:07 +02:00
SmallJoker 6cf15cf872
GUIFormSpecMenu: Add basic element highlighing debug feature (#9423)
Activated using F5
2020-04-12 12:02:32 +02:00
Hugues Ross f780bae05c
Formspecs: Add state-selection to style elements (#9378) 2020-04-11 21:39:30 +01:00
SmallJoker 01b3f26c7b Formspec: No spec ID for static text labels
Fixes #9634
2020-04-11 15:31:02 +02:00
Pierre-Yves Rollo 0eb3072819
Hypertext: Fix hovercolor not working in global tag (#9582) 2020-04-05 15:04:41 +02:00
Pierre-Yves Rollo 86a0e991ef
Fix cursor still visible after closing formspec while on HyperText (#9583) 2020-04-04 16:17:15 +02:00
DS d7825bca1b
Fix GUI element click-through by changing visibility (#9534)
This adds a vector that holds pointers to elements that should only be visible while being drawn.

In the guifsmenu's draw func, all elements in this vector are made visible and invisible again. Apart from there, they are always invisible. (Well they are still visible before the first drawn, does this matter? If yes, it could be fixed easily with some lines of code everywhere.)
2020-03-31 18:34:42 +01:00
Pierre-Yves Rollo 49a558574f
Hypertext: Fix alignment tags adding unwanted newlines (#9548) 2020-03-26 19:56:35 +01:00
Wuzzy 625b100593
Add comments for translators (#9510)
* Add translator comments for "special" strings

* Add translator comments for some "tricky" strings
2020-03-20 09:41:07 +01:00
sfan5 5a31d56c9f Fix mouse events sent to wrong GUI elements when dragging 2020-03-16 22:57:10 +01:00
v-rob 13ad8e2a09
Formspecs: Add starting frame to `animated_image` (#9411) 2020-03-16 22:56:48 +01:00
SmallJoker 766d160ffb guiHyperText: Fix blinky cursor on link hover (#9392)
Change legacy size/position calculations to 'textarea'
2020-03-11 19:09:50 +01:00
DS b42493fb4c
Fix memory leak in GUIHyperText (#9489) 2020-03-10 20:32:38 +01:00
SmallJoker 7da4f9ef20
GUIFormSpecMenu: Remove field_close_on_enter warning (#9501) 2020-03-10 20:30:55 +01:00
Jean-Patrick Guerrero 0e88176db8
GUIHyperText: Fix bug with UTF8 chars in action name + simplify UTF8 stringw conversion (#9437)
Co-authored-by: Pierre-Yves Rollo <dev@pyrollo.com>
2020-03-07 14:01:11 +01:00
v-rob 7dffd08c1a
Add multiple element selection to `style` and `style_type` (#9380) 2020-03-01 14:39:57 +00:00
DS 0c08f948d7
GUIInventoryList: fix dropping items when clicking outside of formspec window (#9422) 2020-02-26 12:18:05 +01:00
sfan5 c657fb343f Refactor Script API's log_deprecated 2020-02-23 22:24:12 +01:00
Hugues Ross 7ce21788f8
Add animated_image[] formspec element (#9258) 2020-02-15 15:33:18 +00:00
SmallJoker ee7d357602
Key settings: Clear with escape (#8282)
Key ESCAPE -> Cancel change
Key DELETE -> Remove entry
2020-02-14 20:36:58 +01:00
DS 1116918dbb
Formspec: Create a new class for inventorylists (#9287) 2020-02-01 13:55:13 +01:00
Hugues Ross 60544ac56f Add 9-slice background support to button formspec elements (#9290) 2020-01-26 19:35:26 +00:00
SmallJoker 1892ff3c0d
StaticText/EnrichedString: Styling support (#9187)
* StaticText/EnrichedString: Styling support

* Fix tooltip fg/bgcolor

* Fix default color for substr(), add unittests
2020-01-22 19:09:11 +01:00
Hugues Ross 3dfb6ecbb2 Formspec: Don't start a button click when the pointer isn't on top (#9332) 2020-01-22 10:18:09 +01:00
ANAND e8fd1ce623 Replace stray tab with whitespace in guiFormSpecMenu.cpp (#9317) 2020-01-18 16:50:57 +00:00
Hugues Ross 680aaa1bd5 Make clipping of formspec elements more consistent (#9262) 2020-01-16 18:41:07 +00:00
DS 4c8af5492b Formspec: change the appeareance of the cursor on fields and co. (#8665) 2020-01-11 20:17:11 +01:00
DS 7c0e0c34ec Formspec: Fix clicking on tooltip-obstructed elements (#9266) 2020-01-04 15:45:22 +01:00
Hugues Ross b50dc43f67 Don't override the FGIMG style property if the image parameter is null 2019-12-16 19:26:57 +01:00
Hugues Ross e42faae8d9 Remove the dependency on FGIMG/BGIMG from the hovered/pressed variants
- Make guiButtonImage support null images properly
2019-12-16 19:26:57 +01:00
Hugues Ross bd4b8d40b3 StyleSpec: 0-initialize the property_set array 2019-12-16 19:26:57 +01:00
SmallJoker c3d0aab0bc GUIFormSpecMenu: Fix legacy sorting using std::stable_sort 2019-12-14 21:28:07 +01:00
rubenwardy 8e63d22d64 Fix spaces breaking formspec_version[] tag 2019-12-09 21:05:07 +00:00
Hugues Ross 9284313d17 Refactor to centralize GUIButton styling/rendering code (#9090) 2019-12-09 20:06:51 +00:00
SmallJoker a462181e5f guiConfirmRegistration: Fix hidden error message 2019-12-09 20:01:16 +01:00
DS 8f73ec6c6c Formspec: make bgcolor element less confusing and allow setting fullscreen color (#8996) 2019-12-08 18:59:30 +01:00
rubenwardy 51f230895c Fix failing build due to code style error 2019-12-06 23:00:54 +00:00
v-rob 4f45bfd08b Add scrollbaroptions FormSpec element (#8530) 2019-12-06 20:51:10 +00:00
SmallJoker b50a166bb0
Formspec: Fix priorities for version < 3 (#9121)
* Formspec: Fix priorities for version < 3

1) Introduce 'priority' to 'FieldSpec'
2) Sort elements based on 'priority'
3) Assign 'name' to the Item Image Button's image to show tooltips again
2019-11-20 19:39:10 +01:00
DS 5506e97ed8 Formspec: draw order and clipping for all elements (#8740) 2019-11-07 20:11:01 +01:00
SmallJoker 2907c0f3a2 Android: Fix broken double-tap after 49 days uptime 2019-11-03 12:59:12 +01:00
SmallJoker 388ea737f5 Clean up font caching, fix bitmap fonts 2019-11-03 11:45:33 +01:00
Pierre-Yves Rollo 72416a6a1f Formspec: add hypertext element 2019-11-03 11:45:33 +01:00
random-geek 53ebd803c6 Change some rough/inappropriate language in comments (#9061) 2019-10-24 01:17:00 +01:00
SmallJoker a978278bfb Formspecs: Reset version number on rebuild 2019-10-20 12:44:52 +02:00
Hugues Ross 69a2099c04 Add more visual feedback for button states (#8916)
- Add style properties for overriding the the hovered/pressed state
  - By default, hovered buttons are a lighter version of the base color
  - By default, pressed buttons are a darker version of the base color
- Add hovered bg image support for image buttons (style property)
2019-10-12 18:44:23 +02:00
SmallJoker dee22104b7
Revert "Fix the bgcolor formspec element (#8716)" (#9018)
This reverts commit 1db3d252cf.
Temporary solution until a compatible solution is found to define both - formspec and fullscreen backgrounds.
2019-10-06 14:50:45 +02:00
sfan5 dde0628976 Fix warnings in guiButton.h 2019-10-05 18:15:26 +02:00
SmallJoker c2458d3d3a label[]: Fix broken colors since 2c9edef 2019-09-29 14:52:41 +02:00
rubenwardy 07bdd6049b Fix error message caused by adding new parameter to background (#8922)
Adds background9[] element to keep backwards compatibility in formspec prepends.
2019-09-29 13:40:59 +02:00
SmallJoker 26b39f1eae
Fix some reference counters (memleak) (#8981)
Fix some reference counters (memleak)
Map::dispatchEvent: Allocation safety using references
2019-09-24 19:05:28 +02:00
DS 1db3d252cf Fix the bgcolor formspec element (#8716) 2019-09-15 17:14:31 +01:00
rubenwardy 1ea9bfc6f7 Fix formspec version backup in prepends losing data 2019-09-15 16:56:11 +01:00
SmallJoker 9acd36bf99 Formspecs: Introduce formspec_version to mods 2019-09-14 19:43:08 +02:00
SmallJoker 2c9edefde3 label[]: Fix cut-off translated text 2019-09-07 11:15:12 +02:00
sfan5 ea9b241c13 Fix Irrlicht 1.9 support 2019-09-06 18:29:29 +02:00
Paul Ouellette 008b80fe1c Add ItemStack:get_description() to get tooltip (#8847) 2019-08-24 18:38:02 +02:00
rubenwardy 91114b562f Add support for set_formspec_prepend in main menu (#8611) 2019-08-12 19:16:35 +02:00
ANAND cc610c74a7 guiVolumeChange: Fix child not being removed 2019-08-08 18:03:35 +02:00
ANAND 003af74213 guiConfirmRegistration: Set focus to text field (#8761) 2019-08-07 19:15:46 +02:00
SmallJoker 233cb86e86
Clean up and fix freetype=false crashes (#8641)
A IGUIFont of type bitmap/vector cannot be converted to CGUITTFont
Fixes various segfaults in gameplay
Shorter font cache code, cleaned up (?)
2019-08-06 21:33:13 +02:00
sfan5 ca363d3ef8 Unify OpenGL ES support 2019-08-04 16:12:52 +02:00
rubenwardy 4f7fa8d417 Add formspec testing to test mod in minimal 2019-08-03 19:36:30 +01:00
rubenwardy 9541165752 Add styles to most elements 2019-08-03 19:36:30 +01:00
rubenwardy ec3795a55c Add style[] tag with button support 2019-08-03 19:36:30 +01:00
rubenwardy d1a1c5cbf0 Add custom colorable GUIButton implementation 2019-08-03 19:36:30 +01:00
rubenwardy 41ad0f4f20 Fix negative offsets not being supported by container[] 2019-08-03 16:20:15 +01:00
DS-Minetest 115ef6c09c Rename guiScrollBar to GUIScrollBar 2019-07-29 21:45:39 +02:00
DS-Minetest 705630e7d0 guiScrollBar: move directly to clicked pos if clicked into tray 2019-07-28 21:43:07 +02:00
v-rob 5e7004e7af Add compatible, consistent coordinate system to FormSpecs. (#8524) 2019-06-27 13:40:49 +01:00
rubenwardy 429a989648 Add support for 9-sliced backgrounds (#8600)
9-slice textures are commonly used in GUIs to allow scaling them to match any resolution without distortion.

https://en.wikipedia.org/wiki/9-slice_scaling
2019-06-22 16:03:54 +02:00
SmallJoker e2f8f4da83
Formspecs: Close on metadata removal (#8348)
Formspecs will now close as soon the formspec string in the node metadata turns invalid.
2019-06-10 13:01:07 +02:00
SmallJoker 627a96cd99 Do not drag-place stack into 'craftpreview' slot (#8514) 2019-05-25 17:41:35 +02:00
stujones11 b917ea4723 Add IGUIScrollbar implementation with variable bar sizes (#8507) 2019-05-24 16:42:05 +01:00
Jozef Behran eb2bda7d0b Optimize string (mis)handling (#8128)
* Optimize statbar drawing

The texture name of the statbar is a string passed by value.
That slows down the client and creates litter in the heap
as the content of the string is allocated there. Convert the
offending parameter to a const reference to avoid the
performance hit.

* Optimize texture cache

There is an unnecessary temporary created when the texture
path is being generated. This slows down the cache each time
a new texture is encountered and it needs to be loaded into
the cache. Additionally, the heap litter created by this
unnecessary temporary is particularly troublesome here as
the following code then piles another string (the resulting
full path of the texture) on top of it, followed by the
texture itself, which both are quite long term objects as
they are subsequently inserted into the cache where they can
remain for quite a while (especially if the texture turns
out to be a common one like dirt, grass or stone).

Use std::string.append to get rid of the temporary which
solves both issues (speed and heap fragmentation).

* Optimize animations in client

Each time an animated node is updated, an unnecessary copy of
the texture name is created, littering the heap with lots of
fragments. This can be specifically troublesome when looking
at oceans or large lava lakes as both of these nodes are
usually animated (the lava animation is pretty visible).
Convert the parameter of GenericCAO::updateTextures to a
const reference to get rid of the unnecessary copy.

There is a comment stating "std::string copy is mandatory as
mod can be a class member and there is a swap on those class
members ... do NOT pass by reference", reinforcing the
belief that the unnecessary copy is in fact necessary.
However one of the first things the code of the method does
is to assign the parameter to its class member, creating
another copy. By rearranging the code a little bit this
"another copy" can then be used by the subsequent code,
getting rid of the need to pass the parameter by value and
thus saving that copying effort.

* Optimize chat console history handling

The GUIChatConsole::replaceAndAddToHistory was getting the
line to work on by value which turns out to be unnecessary.
Get rid of that unnecessary copy by converting the parameter
to a const reference.

* Optimize gui texture setting

The code used to set the texture for GUI components was
getting the name of the texture by value, creating
unnecessary performance bottleneck for mods/games with
heavily textured GUIs. Get rid of the bottleneck by passing
the texture name as a const reference.

* Optimize sound playing code in GUIEngine

The GUIEngine's code receives the specification of the sound
to be played by value, which turns out to be most likely a
mistake as the underlying sound manager interface receives
the same thing by reference. Convert the offending parameter
to a const reference to get rid of the rather bulky copying
effort and the associated performance hit.

* Silence CLANG TIDY warnings for unit tests

Change "std::string" to "const std::string &" to avoid an
unnecessary local value copy, silencing the CLANG TIDY
process.

* Optimize formspec handling

The "formspec prepend" parameter was passed to the formspec
handling code by value, creating unnecessary copy of
std::string and slowing down the game if mods add things like
textured backgrounds for the player inventory and/or other
forms. Get rid of that performance bottleneck by converting
the parameter to a const reference.

* Optimize hotbar image handling

The code that sets the background images for the hotbar is
getting the name of the image by value, creating an
unnecessary std::string copying effort. Fix that by
converting the relevant parameters to const references.

* Optimize inventory deserialization

The inventory manager deserialization code gets the
serialized version of the inventory by value, slowing the
server and the client down when there are inventory updates.
This can get particularly troublesome with pipeworks which
adds nodes that can mess around with inventories
automatically or with mods that have mobs with inventories
that actively use them.

* Optimize texture scaling cache

There is an io::path parameter passed by value in the
procedure used to add images converted from textures,
leading to slowdown when the image is not yet created and
the conversion is thus needed. The performance hit is
quite significant as io::path is similar to std::string
so convert the parameter to a const reference to get rid of
it.

* Optimize translation file loader

Use "std::string::append" when calculating the final index
for the translation table to avoid unnecessary temporary
strings. This speeds the translation file loader up
significantly as std::string uses heap allocation which
tends to be rather slow. Additionally, the heap is no
longer being littered by these unnecessary string
temporaries, increasing performance of code that gets
executed after the translation file loader finishes.

* Optimize server map saving

When the directory structure for the world data is created
during server map saving, an unnecessary value passing of
the directory name slows things down. Remove that overhead
by converting the offending parameter to a const reference.
2019-05-18 17:19:13 +02:00
SmallJoker f409f44765 Correct the checkbox selection box position (#8246)
Remove m_btn_height dependency, replace with the text and checkbox size.
2019-04-27 00:56:31 +01:00
rubenwardy 4f7674d448 Change pitch fly binding to 'P', add to change keys menu (#8314) 2019-04-03 21:37:30 +01:00
Wuzzy 9f1b98b997 Add newline before itemstring in item tooltip (#8213) 2019-03-17 13:55:02 +01:00
Loïc Blot 02a23892f9 LINT fixes since recent tooling update 2019-03-14 12:30:13 +01:00
Loïc Blot e22a69d61a Drop GUIConfirmRegistration::m_address unused field 2019-03-12 16:53:21 +01:00
Paramat 0b492f82f7
Confirm registration GUI: Remove positional strings to fix Windows bug (#8258)
Positional strings don't work on some Windows builds.
Remove server address string, leave player name string present.
2019-03-10 01:49:03 +00:00
Benjamin Lindley e19565c170 Replace for loop with call to standard library function (#8194)
This loop makes multiple passes over m_stack (type std::list) in order to remove all elements with a specified value. Replacing the loop with a call to std::list::remove does the same job, but in only one pass.
2019-03-05 08:13:15 +01:00
random-geek 2153163cbd Fix coloured fog in main menu (#8181)
Fixes #4727. The issue was due to the video driver fog colour never getting reset after closing the game.
2019-02-15 20:44:21 +01:00
Wuzzy f5bdc04ab5 Don't append itemname to itemname in tooltip (#8176) 2019-02-09 15:46:02 +01:00
random-geek fc566e2e10 Fix cloud color in loading screen and main menu (#8174) 2019-02-04 19:11:02 +00:00
random-geek 2ae794ac45 Update color of main menu clouds (#8172) 2019-02-04 00:12:15 +01:00
rubenwardy 9a071d66a5 Fix core.download_file() creating empty files on HTTP error 2019-02-03 17:31:28 +00:00
Leonid Bobrov 339341ba4e DragonFly BSD is somewhat identical to FreeBSD (#8159) 2019-02-03 09:53:54 +01:00
rubenwardy 0990ddb3bb Android: Fix memory leak when displaying images in the mainmenu (#8011) 2018-12-22 08:46:41 +01:00
stujones11 ba07a8b872 Android: Move touchscreen rare controls inline with settings icon (#8006) 2018-12-20 21:11:57 +00:00
Juozas 94f2d99142 Fix Android build errors (caused by 5f1cd55)
After commit 5f1cd55 touchscreengui.* files were pointing to old file locations
2018-12-03 19:31:20 +01:00
Quentin Bazin 5f1cd555cd Move client-specific files to 'src/client' (#7902)
Update Android.mk
Remove 'src/client' from include_directories
2018-11-28 20:01:49 +01:00
stujones11 9519d57017 Make non-formspec modal menus respect gui scale (#7850) 2018-11-26 22:55:24 +01:00
Ben Deutsch 93bccb3490 Client-side autojump. Remove Android-only stepheight autojump (#7228)
Works by detecting a collision while moving forward and then
simulating a jump. If the simulated jump is more successful,
an artificial jump key press is injected in the client.

Includes setting and key change GUI element for enabling and
disabling this feature.
2018-11-22 21:47:15 +00:00
stujones11 3b11288989 Android: Improve UI scaling on smaller high-density displays (#7834)
* Android: Improve UI scaling on smaller high-density displays
2018-11-18 11:31:19 +01:00
number Zero b78698240c Minor changes for IrrLicht 1.9 support 2018-11-11 18:08:15 +01:00
number Zero d90e3ea88d Drop .NET-specific workaround: _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX 2018-11-11 18:08:15 +01:00
random-geek 3a992ce76d Formspecs: Fix text clipped by scrollbars (#7816) 2018-11-06 22:28:34 +00:00
stujones11 88ba1c70d3 Remove un-needed header inclusion 2018-10-29 15:37:44 +01:00
stujones11 323c860045 Move touchscreen input handling to base GUIModalMenu class 2018-10-29 15:37:44 +01:00
Paramat e369eb1a9b
Android buttons: Inset 'rare controls', inset and resize 'gear icon' (#7792)
Previously these were both inconsistently close to the screen edge.
'gear icon' has been enlarged to match the width of 'zoom' and 'aux'
buttons.
2018-10-19 04:52:47 +01:00
rubenwardy 5a26e46aaa
Formspecs: Fix invalid background warning
Clipped backgrounds are still valid with no size[] tag, as they will apply themselves correctly to any size

Fixes #7197
2018-08-20 13:56:16 +01:00
rubenwardy 28a3c4963e
Formspecs: Fix missing trim() when checking for no_prepend[] 2018-08-15 20:06:09 +01:00
rubenwardy 88efebdf86
Formspecs: Add tooltip element for area 2018-08-05 15:50:02 +01:00
SmallJoker 3b9d49b3c7
guiFormspecMenu: Allow fraction values for container[] (#7497)
Switch spacing and pos_offset to v2f32 for percision, add helper function
2018-08-04 18:55:54 +02:00
Rob Blanckaert 2b83af783b Allow enter to select items from combobox's list (#7351) 2018-07-28 12:58:16 +02:00
nOOb3167 9537cfd3f8 Add a MSVC / Windows compatible snprintf function (#7353)
Use sizeof where applicable for mt_snprintf
2018-07-22 21:56:06 +02:00
Muhammad Rifqi Priyo Susanto 7ebc229b0d Android: Add 'aux' button (#7477)
Add 'aux' button.
Use joystick to trigger 'aux' button when forward and out of main circle, by enabling
'virtual_joystick_triggers_aux' setting.
2018-07-10 23:33:40 +01:00
HybridDog 53dd781927 Fix memory leak in guiConfirmRegistration 2018-07-06 11:13:18 +02:00
Muhammad Rifqi Priyo Susanto ad3d1d20d1 Android: Resize jump and sneak buttons' touch target (#7498) 2018-06-30 22:33:14 +01:00
Loïc Blot a78659ed05 Fix more GCC 8.1 warnings   1   master
Fix 3 warnings reported by GCC 8.1 of the following type

```src/client/gameui.cpp:191:43: warning: « void* memset(void*, int, size_t) » effacement d'un objet du type non trivial « struct GameUI::Flags »; use assignment or value-initialization instead [-Wclass-memaccess]
  memset(&m_flags, 0, sizeof(GameUI::Flags));
```
2018-05-28 15:39:04 +02:00
Muhammad Rifqi Priyo Susanto 2f34797c5c Don't show Android edit dialog when tapping read-only field (#7337)
* Don't show Android edit dialog when tapping read-only field

From Lua API, "If the name is empty the textarea is readonly."
2018-05-15 16:13:30 +02:00
Vincent Glize a292d19fd0 Fix crash guiConfirmRegistration quit menu (#7313) 2018-05-10 13:50:06 +02:00
Thomas--S 9577a4396a Formspecs: Allow setting alpha value for the box[] element 2018-04-23 18:50:50 +01:00
Muhammad Rifqi Priyo Susanto b1e58c9c35 Android: Modify touch screen GUI's buttons (#7240)
* Android: Add zoom, minimap, and toggle chat button
Zoom button is put above jump button.
Minimap and toggle chat button are put in settings bar.
* Jump button is rotated down button
* Move three buttons on the right screen higher
2018-04-18 20:55:42 +02:00
Muhammad Rifqi Priyo Susanto 326eeca306 Android: Replace movement buttons with joystick (#7126)
* Android: Replace movement buttons with joystick

Replace movement control buttons (arrows at bottom left screen) with virtual joystick.
Joystick has 8 directions (same as keyboard). Basically, just map it to keyboard input.
Joystick applies only on left 1/3 of screen.
Joystick's position can be fixed by enabling fixed_virtual_joystick setting.
Three new images:
(1) placeholder joystick,
(2) joystick container (background), and
(3) joystick cursor.
Remove unused images: movement control buttons (*_arrow.png).
New data type: touch_gui_joystick_move_id

Joystick's fixed position is spaced one button size from bottom and from left of screen.
Remove unused variable: m_joystick_downlocation
2018-04-10 22:55:17 +02:00
SmallJoker baca933b6b
Selected ItemStack: Reduce black magic (#6520)
* Selected ItemStack: Reduce black magic
Better button variable value naming
2018-04-03 11:15:58 +02:00
you 12edb200eb Formspecs: Use mouse wheel to pick up and deposit single items 2018-04-02 15:52:07 +01:00
Loïc Blot d88c4e1822
LINT: add clang-tidy step (#6295)
* Implement new travis clang-tidy build step

* This step enable some rules and enforce one rule as error
* This permits to have some C++ quality rules based on clang & clang contributor guidelines

* Fix clang-tidy reported problems on push_back -> emplace_back
2018-04-01 23:57:55 +02:00
Andrew Ward 2323842dd3
Add formspec theming using prepended strings 2018-03-28 16:04:41 +01:00
nOOb3167 b0fef16a27 Guard sound manager initialization with "enable_sound" (#7167) 2018-03-26 17:44:40 +02:00