The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
settings.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2007 - 2025
3 by Mark de Wever <koraq@xs4all.nl>
4 Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY.
12
13 See the COPYING file for more details.
14*/
15
17
18#include "display.hpp"
19#include "video.hpp"
20
21namespace gui2
22{
23bool new_widgets = false;
24
25namespace settings
26{
27unsigned screen_width = 0;
28unsigned screen_height = 0;
29unsigned gamemap_x_offset = 0;
30
31unsigned gamemap_width = 0;
32unsigned gamemap_height = 0;
33
34/**
35 * Delay before a popup shows. Also used as the delay
36 * required for long press and drag to work.
37 */
38std::chrono::milliseconds popup_show_delay{0};
39std::chrono::milliseconds popup_show_time{0};
40std::chrono::milliseconds help_show_time{0};
41/**
42 * The interval between two clicks to be detected as double click.
43 */
44std::chrono::milliseconds double_click_time{0};
45/**
46 * How much a repeating button need to be held before the action repeats.
47 */
48std::chrono::milliseconds repeat_button_repeat_time{0};
49
50std::string sound_button_click = "";
52std::string sound_toggle_panel_click = "";
53std::string sound_slider_adjust = "";
54
56
57std::vector<game_tip> tips;
58
60{
61 point canvas_size = video::game_canvas_size();
62
63 screen_width = canvas_size.x;
64 screen_height = canvas_size.y;
65
68
70 const rect rect_gm = display->map_outside_area();
71
72 if(rect_gm.w && rect_gm.h) {
73 gamemap_width = rect_gm.w;
74 gamemap_height = rect_gm.h;
75 gamemap_x_offset = rect_gm.x;
76 }
77 }
78}
79
80} // namespace settings
81
82} // namespace gui2
Sort-of-Singleton that many classes, both GUI and non-GUI, use to access the game data.
Definition display.hpp:88
rect map_outside_area() const
Returns the available area for a map, this may differ from the above.
Definition display.cpp:516
static display * get_singleton()
Returns the display object if a display object exists.
Definition display.hpp:102
map_display and display: classes which take care of displaying the map and game-data on the screen.
t_string has_helptip_message
Definition settings.cpp:55
unsigned screen_width
The screen resolution and pixel pitch should be available for all widgets since their drawing method ...
Definition settings.cpp:27
std::vector< game_tip > tips
Definition settings.cpp:57
std::chrono::milliseconds double_click_time
The interval between two clicks to be detected as double click.
Definition settings.cpp:44
std::string sound_slider_adjust
Definition settings.cpp:53
std::string sound_toggle_button_click
Definition settings.cpp:51
std::chrono::milliseconds popup_show_delay
Delay before a popup shows.
Definition settings.cpp:38
unsigned screen_height
Definition settings.cpp:28
unsigned gamemap_x_offset
The offset between the left edge of the screen and the gamemap.
Definition settings.cpp:29
unsigned gamemap_height
Definition settings.cpp:32
std::string sound_button_click
Definition settings.cpp:50
std::chrono::milliseconds popup_show_time
Definition settings.cpp:39
std::chrono::milliseconds help_show_time
Definition settings.cpp:40
std::string sound_toggle_panel_click
Definition settings.cpp:52
unsigned gamemap_width
The size of the map area, if not available equal to the screen size.
Definition settings.cpp:31
void update_screen_size_variables()
Update the size of the screen variables in settings.
Definition settings.cpp:59
std::chrono::milliseconds repeat_button_repeat_time
How much a repeating button need to be held before the action repeats.
Definition settings.cpp:48
Generic file dialog.
bool new_widgets
Do we wish to use the new library or not.
Definition settings.cpp:23
Contains the general settings which have a default.
point game_canvas_size()
The size of the game canvas, in drawing coordinates / game pixels.
Definition video.cpp:432
This file contains the settings handling of the widget library.
Holds a 2D point.
Definition point.hpp:25
An abstract description of a rectangle with integer coordinates.
Definition rect.hpp:49