ScummVM API documentation
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#ifndef AGS_SYS_MAIN_H
23#define AGS_SYS_MAIN_H
24
25//=============================================================================
26//
27// The main backend interface.
28//
29// TODO: split up later if it gets filled with functions in all categories.
30//
31//=============================================================================
32
33#include "ags/shared/core/platform.h"
34#include "ags/shared/util/string.h"
35#include "common/std/vector.h"
36#include "ags/engine/gfx/gfx_defines.h"
37
38namespace AGS3 {
39
40// Initializes main backend system;
41// should be called before anything else backend related.
42// Returns 0 on success, non-0 on failure.
43int sys_main_init(/*config*/);
44// Shutdown main backend system;
45// should be called last, after everything else backend related is shutdown.
46void sys_main_shutdown();
47// Sets whether the engine wants to update while the window has no focus.
48// TODO: this is a placeholder at the moment, check later if we need any implementation
49void sys_set_background_mode(bool on);
50
51// Display utilities.
52//
53// Queries the display index on which the window is currently positioned.
54// Returns default display index in case window does not exist yet, or on any error.
55int sys_get_window_display_index();
56// Queries current desktop resolution.
57int sys_get_desktop_resolution(int &width, int &height);
58// Queries supported desktop modes.
59void sys_get_desktop_modes(std::vector<AGS::Engine::DisplayMode> &dms, int color_depth = 0);
60// Sets output driver for the backend's renderer
61void sys_renderer_set_output(const AGS::Shared::String &name);
62
63// Audio utilities.
64//
65// Tries to init the audio backend; optionally requests particular driver
66bool sys_audio_init(const AGS::Shared::String &driver_name = "");
67// Shutdown audio backend
68void sys_audio_shutdown();
69
70// Window utilities.
71//
72struct SDL_Window;
73// Create a new single game window.
74SDL_Window *sys_window_create(const char *window_title, int w, int h, AGS::Engine::WindowMode mode, int ex_flags = 0);
75// Returns current game window, if one exists, or null.
76SDL_Window *sys_get_window();
77// Sets current window style, does nothing if window was not created.
78void sys_window_set_style(AGS::Engine::WindowMode mode, int ex_flags = 0);
79// Set new window size; optionally center new window on screen
80bool sys_window_set_size(int w, int h, bool center);
81// Centers the window on screen, optionally choose the display to position on
82void sys_window_center(int display_index = -1);
83// Reduces window's size to fit into the said display bounds, and repositions to the display's center
84void sys_window_fit_in_display(int display_index);
85// Shows or hides system cursor when it's in the game window
86void sys_window_show_cursor(bool on);
87// Locks on unlocks mouse inside the window.
88// Returns new state of the mouse lock.
89bool sys_window_lock_mouse(bool on);
90// Sets mouse position within the game window
91void sys_window_set_mouse(int x, int y);
92// Destroy current game window, if one exists.
93void sys_window_destroy();
94// Set window title text.
95void sys_window_set_title(const char *title);
96// Set window icon.
97// TODO: this is a placeholder, until we figure out the best way to set icon with SDL on wanted systems.
98void sys_window_set_icon();
99
100#if AGS_PLATFORM_OS_WINDOWS
101// Returns game window's handle.
102void *sys_win_get_window();
103#endif
104
105} // namespace AGS3
106
107#endif // AGS_SYS_MAIN_H
Definition: vector.h:39