Commit Graph

153 Commits

Author SHA1 Message Date
sfan5 6ca214fefc
Introduce `std::string_view` into wider use (#14368) 2024-02-17 15:35:33 +01:00
sfan5 1ba26d67bd Remove excessive includes from porting.h 2024-01-14 13:17:53 +01:00
Muhammad Rifqi Priyo Susanto 171f911237
Android: Add selection dialog (drop down/combo box) (#13814)
- The handling of IGUIComboBox uses the new setAndSendSelected() method.
- getDialogState() is now getInputDialogState() and returns the state of the input dialog.
- getLastDialogType() is added and returns current/last shown dialog's type.
- getInputDialogState() now returns an enum instead of int.
- getAndroidUIInput() now returns void instead of bool.
- New data types (enum) are added:
  (1) GameActivity.DialogType (Java) and porting::AndroidDialogType (C++)
  (2) GameActivity.DialogState (Java) and porting::AndroidDialogState (C++)
- When showing a text input dialog, there is no custom accept button text any more.
- showDialog()/showDialogUI() for text input is now showTextInputDialog()/showTextInputDialogUI().
- showInputDialog()/showDialogUI() for text input is now showTextInputDialog()/showTextInputDialogUI().
- getDialogValue()/getInputDialogValue() is now getDialogMessage()/getInputDialogMessage().


Co-authored-by: Gregor Parzefall <82708541+grorp@users.noreply.github.com>
2024-01-07 19:00:04 +07:00
grorp 32e492837c
Support both mouse and touch input in GUIs in a single binary (#14146) 2023-12-27 22:37:36 +01:00
SmallJoker 321bcf5c44
GUIFormspecMenu: Fix race condition between quit event and cleanup in Game (#14010)
To not instantly free GUIFormSpec upon close/quit, Game periodically
cleans up the remaining instance on the next frame.

When a new formspec is received and processed after closing the previous formspec
but before the cleanup in Game, the formspec would be closed regardless.
This now re-creates the formspec when the old one is already pending for removal.
2023-12-10 19:09:51 +01:00
Muhammad Rifqi Priyo Susanto 047520d91e
Inventory: Add remaining items into the source slot directly (#14021)
Remaining items are added into the source slot directly when left-dragging over the source slot.
2023-12-03 15:00:07 +07:00
Muhammad Rifqi Priyo Susanto 53886dcdb5
Formspec: Pass the second-touch event as is (#13872)
The second-touch event is passed to the GUIFormSpecMenu::OnEvent() function as a touch event.
There are two types of event for inventory formspec: (1) mouse event and (2) touch event.
The touch event is just a modifier of the mouse event.


Co-authored-by: Gregor Parzefall <82708541+grorp@users.noreply.github.com>
2023-11-28 07:00:07 +07:00
grorp 771da80bbb
Make it possible again to see item tooltips on Android (#14029)
This change is a quick fix so that item tooltips show again on Android.
2023-11-25 17:07:07 +01:00
grorp 4255ac3022
Mainmenu: Avoid the header being displayed behind the formspec (#13924)
This change keeps the current header placement code, but adds additional code to make sure the header doesn't end up behind the formspec.
2023-11-25 17:04:33 +01:00
DS 3c41195986
Inventory: Fix picking up items via drop and pickup doubleclick (#13891) 2023-10-16 20:46:57 +02:00
Gregor Parzefall 56965bc814
Android: Add `field_enter_after_edit[]` formspec element (#13836) 2023-10-01 11:20:50 +02:00
SmallJoker bf9f831cb2 Inventory: skip redundant stack movement
The list of dragged stacks includes the source stack, which
however does not need to be moved onto itself.
This is an optimization.
2023-08-27 20:12:10 +02:00
Desour f47b00426a Revert "Get rid of guiroot"
This reverts commit 45e7a80057.
2023-08-24 22:14:44 +02:00
gamefreq0 d0ee63c766
Enable shift-click crafting (#13729) 2023-08-24 12:00:54 +07:00
Desour 45e7a80057 Get rid of guiroot
The guienvironment already provides a root gui element, we don't need to add another one.
(For CGUIEnvironment, the env itself is the root element.)
2023-08-14 18:13:47 +02:00
Desour 91c0439922 Use our GUIButton in our GUIScrollBar
Note that GUIScrollBar needs an ISimpleTextureSource now due to button styling.
2023-08-14 18:13:47 +02:00
rubenwardy 137e4ce866
Fix hypertext in the mainmenu (#13731) 2023-08-13 13:28:33 +01:00
DS edcbfa31c9
Sound refactor and improvements (#12764) 2023-06-16 20:15:21 +02:00
Desour c549e84abb Silence a -Wsign-compare warning for invlist indices 2023-06-15 13:55:20 +02:00
Desour e700182f44 Replace Optional with std::optional 2023-06-15 10:38:44 +02:00
OgelGames 252c79d53a
Inventory mouse shortcut improvements (#13146)
Co-authored-by: Muhammad Rifqi Priyo Susanto <muhammadrifqipriyosusanto@gmail.com>
2023-06-05 12:00:32 +02:00
DS ae7271b725
Fix background[] pos-offset lower-right-corner being at least (1,1) (#13320)
IGUIElement has a MinSize for the RelativeRect, which is at least (1,1).
This means a pos offset of (0,0) will cause a seemingly off-by-1 error at the
lower right corner, and (0.1,0.1) for example will just not work on the lower
right corner.
Ergo, we can't use the AbsoluteRect for storing the pos offset.
2023-04-14 21:05:09 +02:00
rubenwardy 2fc7eb3ea2
Remove formspec_default_bg_color/opacity settings (#13419)
These settings are unnecessary. They only apply when formspecs don't have a background/bgcolor set. In practice, most games do theme their GUIs. Removing low value settings simplifies code and improves UX by decluttering the settings menu

Split out from #12140
2023-04-11 19:57:36 +01:00
Desour 67068cfaf4 Get rid of wgettext 2023-04-08 20:17:50 +02:00
Loïc Blot 322c8cf270
Reduce exposure of various internals (#12885)
* refactoring(StaticObjectList): don't expose m_active and m_stored anymore

This prevents our old crap code where anyone can access to StaticObjectList. use proper modifiers. It also permits to do a short cleanup on MapBlock using a helper

* refactoring(MapBlock): reduce a bit exposed m_active_blocks variable

* refactoring: MapBlock::m_node_timers is now private

We already had various helpers to perform this privatization, just use it. Also factorize the MapBlock stepping code for timers using already existing code and importing them from ServerEnvironment to MapBlock.

It's currently done pretty straight forward without any inheritance as MapBlock is just used everywhere, maybe in a future we'll have ServerMapBlock over MapBlock. Currently for a simple function let's just use proper objects and add a comment warning

* refactoring(Server): fix duplicated function for add/remove node

* refactoring(guiFormSpecMenu): add removeAll function to prevent duplicated code

* refactoring(ShadowRenderer) + perf: code quality  + increase performance

* All callers are already using the point and we should never test a function with nullptr node, it's a bug. Removed workaround which was hacky and fix the bug
* Drop clientmap lookup from shadowrendered, just use directly its
  pointer and forbid to push it in the generic list
* Reduce memory pressure on the renderShadowObject by preventing
  deallocating and reallocating multiple vectors on each node

* refactoring(MapBlock): reduce exposure of MapBlock::m_static_objects

It's not complete as some parts of the code are pretty nested, but it's better than before :)

* fix: better working on new functions & drop unwanted 2 lines

Co-authored-by: Jude Melton-Houghton <jwmhjwmh@gmail.com>

Co-authored-by: Jude Melton-Houghton <jwmhjwmh@gmail.com>
2022-11-03 17:35:31 +01:00
Jean-Patrick Guerrero 16266397ed
GUIInventoryList: Keep item size while moving (#12896) 2022-10-24 13:58:56 +02:00
DS 7153cb8a0b
Fix formspec focus (#12795) 2022-10-21 17:11:41 +02:00
DS f3f3b752f2
Fix tooltips for dropdown, scrollbar and more (#12747) 2022-09-13 12:48:28 +01:00
Herman Semenov 038da00e79
Code optimizations / refactor (#12704)
Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
Co-authored-by: sfan5 <sfan5@live.de>
2022-09-06 11:21:09 +01:00
SmallJoker a81259d19a
Run Minetest update checker on startup (#7629)
This feature is enabled by default for non-Android release builds. Package
maintainers may use -DENABLE_UPDATE_CHECKER=0 to disable it.

Co-authored-by: rubenwardy <rw@rubenwardy.com>
Co-authored-by: sfan5 <sfan5@live.de>
2022-08-02 21:34:17 +02:00
x2048 839600ed70
Use legacy image implementation (no NNAA filter) when not using 9-slice image (#12608) 2022-07-31 21:57:13 +02:00
SmallJoker f4c6ed863d
GUIFormSpecMenu: Fix label multiline translation (#12527) 2022-07-14 20:51:01 +02:00
SmallJoker 8724fe6e3f GUIFormSpecMenu: Fix parameter order
Fixes a regression caused by e51f47461 because C++ implicitly converts boolean to float. no matter what.
2022-07-10 15:34:53 +02:00
SmallJoker e51f474613
Sounds: Various little improvements (#12486)
Use SimpleSoundSpec where reasonable (OpenAL)
Ensure the sound IDs do not underflow or get overwritten -> loop in u16
Proper use of an enum.
2022-07-09 22:32:24 +02:00
SmallJoker 051181fa6e
Enforce limits of settings that could cause buggy behaviour (#12450)
Enforces the setting value bounds that are currently only limited by the GUI (settingtypes.txt).
2022-07-09 22:32:08 +02:00
Vincent Robinson f7bcf7fa46
FormSpec: 9-slice images, animated_images, and fgimg_middle (#12453)
* FormSpec: 9-slice images and animated_images

* Add fgimg_middle; clean up code

* Address issues, add tests

* Fix stupid error; bump formspec version

* Re-add image[] elements without a size
2022-07-03 08:52:26 -04:00
paradust7 9f338f5a56
Replace all uses of core::list with std::list (#12313) 2022-05-22 00:11:59 +02:00
DS 633e23bd65
FormspecMenu: make drawing of backgrounds less hacky (#9517) 2022-02-22 19:17:53 +01:00
SmallJoker 8fab406c28 Formspec: Fix bgcolor and set_focus checks 2022-01-09 18:47:12 +01:00
Vincent Robinson e39b159845 Base formspec coordinate size on padded screensize 2022-01-04 17:47:32 -08:00
Vincent Robinson 544b9d5c72
Add padding[] element to formspecs (#11821) 2021-12-30 12:54:47 -08:00
SmallJoker 14c7fae378
Formspec: Unify argument checks (#11851) 2021-12-29 23:58:26 +01:00
rubenwardy 8dfeba02b9 Fix crash on hypertext[] with not enough parts
The length check used < rather than <=, disabling the check when the formspec version
matches the client's FORMSPEC_API_VERSION.

Additionally, it was possible to have fewer parts than required if the formspec version
was greater than the client's FORMSPEC_API_VERSION.
2021-10-25 21:39:40 +01:00
TheBrokenRail 3dcf9e963e
Touch UI support for desktop builds (#10729) 2021-09-26 18:04:09 +02:00
sfan5 75bf9b75ca
Make sure relevant std::stringstreams are set to binary 2021-09-11 21:06:57 +02:00
sfan5 758e3aa1ca Fix background color of formspec text fields 2021-05-30 11:40:14 +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
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