Commit Graph

374 Commits

Author SHA1 Message Date
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
Desour 1bc74b0ba1 Fix undefined inf to s32 cast in GUIScrollBar::setPos 2023-11-19 20:45:18 +01:00
Muhammad Rifqi Priyo Susanto aa912e90a7
Make text containers wider in the Volume Change dialog (#13995)
These containers are widened to account for translations.
2023-11-15 07:00:03 +07:00
Gregor Parzefall 96197025b9
Fix hypertext[] sometimes calculating incorrect scrollbar height (#13943) 2023-10-29 17:54:31 +01:00
SmallJoker 906417cc0d
GUI: Autofocus newly opened GUIModalMenu instances (#13911)
This in particular fixes incorrect event propagation to menus that
are no longer shown, such as the key change menu when opened within
the settings tab.
2023-10-22 15:31:42 +02:00
SmallJoker 2fbf5f4250
CSM: Fix duplicate player names (#13910) 2023-10-22 15:31:29 +02:00
Gregor Parzefall 6fdc7e0dad
Make hypertext[] respect font size settings (#13858) 2023-10-16 20:47:16 +02:00
DS 3c41195986
Inventory: Fix picking up items via drop and pickup doubleclick (#13891) 2023-10-16 20:46:57 +02:00
sfan5 9ec40ce8e9 Enforce minimum for curl(_file_download)_timeout 2023-10-05 17:29:49 +02:00
Gregor Parzefall 56965bc814
Android: Add `field_enter_after_edit[]` formspec element (#13836) 2023-10-01 11:20:50 +02:00
Desour 606215fae9 Move sound_openal and sound_openal_internal into new src/client/sound directory 2023-09-30 18:54:26 +02:00
Gregor Parzefall 7b56daa236
Small setting-related fixes (#13755) 2023-08-27 20:18:41 +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
Desour 7e4dccb3b5 Revert "Get rid of global guienv variable"
This reverts commit 16da954bd7.
2023-08-24 22:14:44 +02:00
Desour f98726c516 Revert "Use our GUIButton in touchscreengui"
This reverts commit f7f3aaf43c.
Fixes #13743.
2023-08-24 22:14:44 +02:00
Gregor Parzefall 92b6ff4721
TouchScreenGUI: Fix only 9 hotbar slots being usable (#13698)
Co-authored-by: Muhammad Rifqi Priyo Susanto <muhammadrifqipriyosusanto@gmail.com>
2023-08-24 17:45:51 +02:00
gamefreq0 d0ee63c766
Enable shift-click crafting (#13729) 2023-08-24 12:00:54 +07:00
Desour 16da954bd7 Get rid of global guienv variable
(It can already be accessed via the renderingengine.)
2023-08-14 18:13:47 +02: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 7e7aceb8c1 Replace all actual uses of irrlicht CGUIStaticText with our StaticText 2023-08-14 18:13:47 +02:00
Desour f7f3aaf43c Use our GUIButton in touchscreengui 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
Desour 9d62abbe46 Replace any uses of CGUIScrollBar and IGUIScrollBar with GUIScrollBar 2023-08-14 18:13:47 +02:00
Desour 124d064015 GUIButton: Default BgColor to white, as opposed to unintialized
(Same as what CGUIButton uses (via colors=0).)
2023-08-14 18:13:47 +02:00
Desour 2903f692ba GUIButton: Use default member initializers 2023-08-14 18:13:47 +02:00
Desour 7f9de5db0b Make touchscreengui compile 2023-08-14 18:13:47 +02:00
rubenwardy 137e4ce866
Fix hypertext in the mainmenu (#13731) 2023-08-13 13:28:33 +01:00
Joachim Stolberg 21ecdd5681
Fix textarea scrollbar inside border=false (#13678) 2023-07-30 14:54:52 +01:00
Desour e0192e256f Fix incorrect rounding in GUIInventoryList::getItemIndexAtPos 2023-07-22 17:19:57 +02:00
Gregor Parzefall 7473e4cafd Expose all OpenGL filtering modes, use OpenGL names for them
Because of a review comment on the Irrlicht PR by numberZero.
2023-07-20 22:15:47 +02:00
Gregor Parzefall 6bf63d4b41 Rename SMaterial::TextureLayer -> SMaterial::TextureLayers
It's not the "texture layer" of the material, but an array of texture layers.
2023-07-20 22:15:47 +02:00
Gregor Parzefall 9bef3c136a Split up texture filtering properties of SMaterialLayer into MinFilter and MagFilter
You can	now set	the filter used	when scaling textures down and the filter used when scaling textures up separately.
2023-07-20 22:15:47 +02:00
Gregor Parzefall 307e380f30 Refactor the way you set material properties
Instead of using SMaterial::setFlag, you now set them directly on SMaterial or SMaterialLayer.
2023-07-20 22:15:47 +02:00
Muhammad Rifqi Priyo Susanto 2061984313 Simplifies code by using Irrlicht's operator overloads
New variables are added to replace in-place calculations.
2023-07-14 21:00:29 +07:00
Muhammad Rifqi Priyo Susanto 3a47559e86 Fix some memory leaks and code style issues
Maximum line length is 95 characters.
Some members' name are changed.
Struct initialisations use brace syntax; eliminating the usage of the memset function.
Iterations use for-each-loop instead of while-loop+iterator.
char * -> std::string
button_info * -> std::shared_ptr<button_info>
2023-07-14 21:00:29 +07:00
Desour 8e09077de8 Fix sound manager not being stepped by GUIEngine 2023-07-14 14:42:00 +02:00
Gregor Parzefall 7e51e2dea6 Fix compiler error on MSVC with ENABLE_TOUCH=TRUE 2023-06-24 20:37:59 +02:00
Gregor Parzefall 03ffc2618c
TouchScreenGUI: Add an exit / "ESC" button to the rare controls bar (#13574) 2023-06-22 17:50:36 +02:00
DS edcbfa31c9
Sound refactor and improvements (#12764) 2023-06-16 20:15:21 +02:00
Muhammad Rifqi Priyo Susanto a4e69d6843
TouchScreenGUI: Read coordinates directly for virtual joystick (#13567)
The movement's direction and speed are calculated directly from the button's relative screen coordinate. The previous method was to trigger the movement using a keyboard event.
The only virtual joystick status left is Aux1 button.

---------

Co-authored-by: Gregor Parzefall <gregor.parzefall@posteo.de>
2023-06-16 22:40:16 +07: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
DS 553dc02deb
Fix some memleaks from GUIButtonImage (#13564)
* `m_foreground_image` was grabbed, but not dropped in the destructor.
* `m_image` was created with new. It is grabbed by itself and by the env (not only by the env!, so it's an owning ptr). This owning ptr also was never dropped.
2023-06-06 19:01:32 +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
Gregor Parzefall fc3d6c1dd9
Place nodes with single tap on Android (+ bugfix) (#13187)
Don't place nodes when closing button bars.
Update docs (also in-game).
Rename "Default controls" -> "Controls" in Android pause menu since players can't change them (normally), so calling them "default" doesn't make sense.
2023-05-29 12:30:30 +07:00
Gregor Parzefall 15fb4cab15
Fix Android segfault when game exits before TouchScreenGUI is initalized 2023-05-11 22:51:16 +02:00
Desour 8b73743baa Reduce number of recursively included headers
This should improve compilation speed.

Things changed:
* Prefer forward-declarations in headers.
* Move header-includes out of headers if possible.
* Move some functions definitions out of headers.
* Put some member variables into unique_ptrs (see Client).
2023-04-27 18:50:33 +02:00
Desour e9e8eed360 GUIChatConsole: Use primary selection 2023-04-27 18:50:17 +02:00
Desour 062b4d036a GUIEditBox: Use primary selection 2023-04-27 18:50:17 +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
DS d49d80a4a0
Store whether window is maximized (#12861) 2023-04-14 21:04:03 +02:00
rubenwardy 9d1ae80e89
Add focused styling to buttons (#13414) 2023-04-14 00:09:29 +01:00
Gregor Parzefall 2a1bc82887
Fix black loading screen background if `menu_clouds = false` (#13322) 2023-04-13 18:12:48 +01: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 b201c03625 Use smart-ptrs in GUIEngine 2023-04-11 20:06:15 +02:00
sfan5 9d736e8b8b Drop ENABLE_GLES option
ENABLE_GLES predates forking Irrlicht. Its primary use was to distinguish Irrlicht-ogles from upstream version as Minetest could be compiled with either.
That's not necessary anymore and gets in the way sometimes.
2023-04-08 20:19:35 +02:00
Desour 67068cfaf4 Get rid of wgettext 2023-04-08 20:17:50 +02:00
numzero d6be6682ec Drop dependency on IrrCompileConfig
The only remaining thing is IRRLICHT_SDK_VERSION via irrlicht.h
2023-03-01 09:06:23 +01:00
sfan5 3bafbaac49 Remove dead code behind Irrlicht version checks 2023-02-18 16:46:51 +01:00
Jude Melton-Houghton 055fc69c11
Handle num lock in chat (#12984) 2022-11-30 10:43:12 -05:00
Muhammad Rifqi Priyo Susanto 40a45b8c99
Virtual joystick: Use s32 when using m_screensize as a subtrahend (#12814)
If still uses u32, m_screensize will yield a big value (underflow) when used as a subtrahend.
ETIE_MOVED is allowed to be run if joystick's ID is available and virtual joystick is fixed.
Add .0f for some float values.
2022-11-26 09:16:14 -05:00
Abdou-31 d1b80b462e
Fix typos and en_US/en_GB inconsistency in various files (#12902) 2022-11-09 11:57:19 -05: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
Riceball LEE 8bdedd2bcf
guiChatConsole: fix the unicode characters crowded together on prompt (#12867)
Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
2022-10-21 17:12:07 +02:00
DS 7153cb8a0b
Fix formspec focus (#12795) 2022-10-21 17:11:41 +02:00
Jude Melton-Houghton b38ffdec27
Implement vector and node conversion in Lua (#12609)
Co-authored-by: sfan5 <sfan5@live.de>
2022-10-18 18:01:44 -04:00
Muhammad Rifqi Priyo Susanto 3978b9b8ed
Add crosshair support for Android (#7865)
If enabled, a crosshair will be shown to select object.
This will give Android players a way to play like they play on desktop.
On third-person back camera mode, player is forced to use crosshair.
On third-person front camera mode, player is unable to select anything.

Co-authored-by: ROllerozxa <temporaryemail4meh+github@gmail.com>
Co-authored-by: rubenwardy <rw@rubenwardy.com>
2022-09-29 20:30:33 +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
Elliott Lester 7c5e3cac6a
Apply DPI Scaling to GUIModalMenu (#12693)
Co-authored-by: sfan5 <sfan5@live.de>
2022-08-15 21:19:47 +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
SmallJoker a463620edb
Re-order sound-related code (#12382)
Dropped ServerSoundParams -> moved to ServerPlayingSound. This gets rid of the duplicated
'fade' and 'pitch' values on server-side where only one was used anyway.
SimpleSoundSpec is the basic sound without positional information, hence 'loop' is included.

Recursively added PROTOCOL_VERSION to most functions to reduce the versioning mess in the
future. Per-type version numbers are kept for now as a safety rope in a special case.
2022-06-20 21:56:12 +02:00
ROllerozxa 992f501159 Fix Android input box crash 2022-06-14 19:22:22 +02:00
rubenwardy 03d86ea0b4
Add register dialog to separate login/register (#12185)
New users find Minetest's account system confusing.
This change moves username/password to a new dialog,
with login and register buttons added to the Join Game tab.

The old registration confirmation dialog is removed in
favour of the new dialog.

Fixes #8138
2022-06-05 17:47:38 +02:00
sfan5 0c6a029413 Improve a translation string
fixes #11442
2022-05-29 14:00:19 +02:00
paradust7 9f338f5a56
Replace all uses of core::list with std::list (#12313) 2022-05-22 00:11:59 +02:00
savilli af37f9dc54
Remove confusing message in keybindings menu 2022-05-17 20:11:08 +02:00
DS 633e23bd65
FormspecMenu: make drawing of backgrounds less hacky (#9517) 2022-02-22 19:17:53 +01:00
sfan5 058846d687 Rework drawtime and related timekeeping code to use microseconds 2022-01-27 22:30:02 +01:00
SmallJoker 8fab406c28 Formspec: Fix bgcolor and set_focus checks 2022-01-09 18:47:12 +01:00
sfan5 76dbd0d2d0
Fully remove bitmap font support (#11863)
Freetype is now a build requirement.
2022-01-08 14:53:25 +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
ROllerozxa 05573d6d8d
Remove unused (de)serializeAttributes() methods 2021-12-29 23:00:16 +01:00
ExeVirus 52bfbf6ed0
Allow for Game-Specific Menu Music (#11241) 2021-11-22 17:26:46 +00: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
SmallJoker d51d0f3a5a
Various code improvements
* Camera: Fix division by 0 after view bobbing
* Remove ignored constness
* Connection: Improve window size range limits
2021-09-27 17:45:44 +02:00
TheBrokenRail 3dcf9e963e
Touch UI support for desktop builds (#10729) 2021-09-26 18:04:09 +02:00