ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
sys_main.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 //=============================================================================
23 //
24 // The main backend interface.
25 //
26 // TODO: split up later if it gets filled with functions in all categories.
27 //
28 //=============================================================================
29 
30 #include "ags/shared/core/platform.h"
31 #include "ags/shared/util/string.h"
32 #include "common/std/vector.h"
33 #include "ags/engine/gfx/gfx_defines.h"
34 
35 namespace AGS3 {
36 
37 // Initializes main backend system;
38 // should be called before anything else backend related.
39 // Returns 0 on success, non-0 on failure.
40 int sys_main_init(/*config*/);
41 // Shutdown main backend system;
42 // should be called last, after everything else backend related is shutdown.
43 void sys_main_shutdown();
44 // Sets whether the engine wants to update while the window has no focus.
45 // TODO: this is a placeholder at the moment, check later if we need any implementation
46 void sys_set_background_mode(bool on);
47 
48 // Display utilities.
49 //
50 // Queries the display index on which the window is currently positioned.
51 // Returns default display index in case window does not exist yet, or on any error.
52 int sys_get_window_display_index();
53 // Queries current desktop resolution.
54 int sys_get_desktop_resolution(int &width, int &height);
55 // Queries supported desktop modes.
56 void sys_get_desktop_modes(std::vector<AGS::Engine::DisplayMode> &dms, int color_depth = 0);
57 // Sets output driver for the backend's renderer
58 void sys_renderer_set_output(const AGS::Shared::String &name);
59 
60 // Audio utilities.
61 //
62 // Tries to init the audio backend; optionally requests particular driver
63 bool sys_audio_init(const AGS::Shared::String &driver_name = "");
64 // Shutdown audio backend
65 void sys_audio_shutdown();
66 
67 // Window utilities.
68 //
69 struct SDL_Window;
70 // Create a new single game window.
71 SDL_Window *sys_window_create(const char *window_title, int w, int h, AGS::Engine::WindowMode mode, int ex_flags = 0);
72 // Returns current game window, if one exists, or null.
73 SDL_Window *sys_get_window();
74 // Sets current window style, does nothing if window was not created.
75 void sys_window_set_style(AGS::Engine::WindowMode mode, int ex_flags = 0);
76 // Set new window size; optionally center new window on screen
77 bool sys_window_set_size(int w, int h, bool center);
78 // Centers the window on screen, optionally choose the display to position on
79 void sys_window_center(int display_index = -1);
80 // Reduces window's size to fit into the said display bounds, and repositions to the display's center
81 void sys_window_fit_in_display(int display_index);
82 // Shows or hides system cursor when it's in the game window
83 void sys_window_show_cursor(bool on);
84 // Locks on unlocks mouse inside the window.
85 // Returns new state of the mouse lock.
86 bool sys_window_lock_mouse(bool on);
87 // Sets mouse position within the game window
88 void sys_window_set_mouse(int x, int y);
89 // Destroy current game window, if one exists.
90 void sys_window_destroy();
91 // Set window title text.
92 void sys_window_set_title(const char *title);
93 // Set window icon.
94 // TODO: this is a placeholder, until we figure out the best way to set icon with SDL on wanted systems.
95 void sys_window_set_icon();
96 
97 #if AGS_PLATFORM_OS_WINDOWS
98 // Returns game window's handle.
99 void *sys_win_get_window();
100 #endif
101 
102 } // namespace AGS3
Definition: vector.h:39
Definition: ags.h:40