clientdynamicinfo.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. Minetest
  3. Copyright (C) 2022-3 rubenwardy <rw@rubenwardy.com>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU Lesser General Public License as published by
  6. the Free Software Foundation; either version 2.1 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public License along
  13. with this program; if not, write to the Free Software Foundation, Inc.,
  14. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  15. */
  16. #pragma once
  17. #include "irrlichttypes_bloated.h"
  18. struct ClientDynamicInfo
  19. {
  20. public:
  21. v2u32 render_target_size;
  22. f32 real_gui_scaling;
  23. f32 real_hud_scaling;
  24. v2f32 max_fs_size;
  25. bool touch_controls;
  26. bool equal(const ClientDynamicInfo &other) const {
  27. return render_target_size == other.render_target_size &&
  28. std::abs(real_gui_scaling - other.real_gui_scaling) < 0.001f &&
  29. std::abs(real_hud_scaling - other.real_hud_scaling) < 0.001f &&
  30. touch_controls == other.touch_controls;
  31. }
  32. #ifndef SERVER
  33. static ClientDynamicInfo getCurrent();
  34. private:
  35. static v2f32 calculateMaxFSSize(v2u32 render_target_size, f32 gui_scaling);
  36. #endif
  37. };