gameconfig.hpp 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. // SuperTux
  2. // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
  3. //
  4. // This program is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License
  15. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. #ifndef HEADER_SUPERTUX_SUPERTUX_GAMECONFIG_HPP
  17. #define HEADER_SUPERTUX_SUPERTUX_GAMECONFIG_HPP
  18. #include <optional>
  19. #include "control/joystick_config.hpp"
  20. #include "control/keyboard_config.hpp"
  21. #include "math/size.hpp"
  22. #include "math/vector.hpp"
  23. #include "video/drawing_context.hpp"
  24. #include "video/video_system.hpp"
  25. class Config final
  26. {
  27. public:
  28. Config();
  29. void load();
  30. void save();
  31. int profile;
  32. /** the width/height to be used to display the game in fullscreen */
  33. Size fullscreen_size;
  34. /** refresh rate for use in fullscreen, 0 for auto */
  35. int fullscreen_refresh_rate;
  36. /** the width/height of the window managers window */
  37. Size window_size;
  38. /** Window is resizable */
  39. bool window_resizable;
  40. /** the aspect ratio */
  41. Size aspect_size;
  42. #ifdef __EMSCRIPTEN__
  43. /** @deprecated Whether to automatically resize the game when the browser is resized */
  44. bool fit_window;
  45. #endif
  46. float magnification;
  47. bool use_fullscreen;
  48. VideoSystem::Enum video;
  49. int vsync;
  50. bool show_fps;
  51. bool show_player_pos;
  52. bool show_controller;
  53. bool sound_enabled;
  54. bool music_enabled;
  55. int sound_volume;
  56. int music_volume;
  57. /** initial random seed. 0 ==> set from time() */
  58. int random_seed;
  59. bool enable_script_debugger;
  60. /** this variable is set if tux should spawn somewhere which isn't the "main" spawn point*/
  61. std::optional<Vector> tux_spawn_pos;
  62. /** force SuperTux language to this locale, e.g. "de". A file
  63. "data/locale/xx.po" must exist for this to work. An empty string
  64. means autodetect. */
  65. std::string locale;
  66. KeyboardConfig keyboard_config;
  67. JoystickConfig joystick_config;
  68. bool mobile_controls;
  69. float m_mobile_controls_scale;
  70. struct Addon
  71. {
  72. std::string id;
  73. bool enabled;
  74. };
  75. std::vector<Addon> addons;
  76. bool developer_mode;
  77. bool christmas_mode;
  78. bool transitions_enabled;
  79. bool confirmation_dialog;
  80. bool pause_on_focusloss;
  81. bool custom_mouse_cursor;
  82. bool do_release_check;
  83. bool custom_title_levels;
  84. #ifdef ENABLE_DISCORD
  85. bool enable_discord;
  86. #endif
  87. bool hide_editor_levelnames;
  88. struct Notification
  89. {
  90. std::string id;
  91. bool disabled;
  92. };
  93. std::vector<Notification> notifications;
  94. Color menubackcolor;
  95. Color menufrontcolor;
  96. Color menuhelpbackcolor;
  97. Color menuhelpfrontcolor;
  98. Color labeltextcolor;
  99. Color activetextcolor;
  100. Color hlcolor;
  101. Color editorcolor;
  102. Color editorhovercolor;
  103. Color editorgrabcolor;
  104. float menuroundness;
  105. int editor_selected_snap_grid_size;
  106. bool editor_render_grid;
  107. bool editor_snap_to_grid;
  108. bool editor_render_background;
  109. bool editor_render_lighting;
  110. bool editor_autotile_mode;
  111. bool editor_autotile_help;
  112. int editor_autosave_frequency;
  113. bool editor_undo_tracking;
  114. int editor_undo_stack_size;
  115. bool editor_show_deprecated_tiles;
  116. bool multiplayer_auto_manage_players;
  117. bool multiplayer_multibind;
  118. bool multiplayer_buzz_controllers;
  119. std::string repository_url;
  120. bool is_christmas() const;
  121. };
  122. #endif
  123. /* EOF */