-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove excessive touchscreengui.h includes #14466
Merged
grorp
merged 4 commits into
minetest:master
from
grorp:rm-excess-touchscreengui-includes
Mar 17, 2024
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
Minetest | ||
Copyright (C) 2022-3 rubenwardy <rw@rubenwardy.com> | ||
|
||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published by | ||
the Free Software Foundation; either version 2.1 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Lesser General Public License for more details. | ||
|
||
You should have received a copy of the GNU Lesser General Public License along | ||
with this program; if not, write to the Free Software Foundation, Inc., | ||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
#ifndef SERVER | ||
|
||
#include "clientdynamicinfo.h" | ||
|
||
#include "settings.h" | ||
#include "client/renderingengine.h" | ||
#include "gui/touchscreengui.h" | ||
|
||
ClientDynamicInfo ClientDynamicInfo::getCurrent() | ||
{ | ||
v2u32 screen_size = RenderingEngine::getWindowSize(); | ||
f32 density = RenderingEngine::getDisplayDensity(); | ||
f32 gui_scaling = g_settings->getFloat("gui_scaling", 0.5f, 20.0f); | ||
f32 hud_scaling = g_settings->getFloat("hud_scaling", 0.5f, 20.0f); | ||
f32 real_gui_scaling = gui_scaling * density; | ||
f32 real_hud_scaling = hud_scaling * density; | ||
bool touch_controls = g_touchscreengui; | ||
|
||
return { | ||
screen_size, real_gui_scaling, real_hud_scaling, | ||
ClientDynamicInfo::calculateMaxFSSize(screen_size, gui_scaling), | ||
touch_controls | ||
}; | ||
} | ||
|
||
v2f32 ClientDynamicInfo::calculateMaxFSSize(v2u32 render_target_size, f32 gui_scaling) | ||
{ | ||
f32 factor = (g_settings->getBool("enable_touch") ? 10 : 15) / gui_scaling; | ||
f32 ratio = (f32)render_target_size.X / (f32)render_target_size.Y; | ||
if (ratio < 1) | ||
return { factor, factor / ratio }; | ||
else | ||
return { factor * ratio, factor }; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it looks bad that the whole content of the
clientdynamicinfo.cpp
is inside#ifndef SERVER
, but sinceclientdynamicinfo.h
is also used on the server, I can't just move both files into theclient
folder.