ScummVM API documentation
system.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_LIB_ALLEGRO_SYSTEM_H
23#define AGS_LIB_ALLEGRO_SYSTEM_H
24
25#include "ags/lib/allegro/base.h"
26#include "ags/lib/allegro/color.h"
27#include "ags/lib/allegro/gfx.h"
28#include "ags/shared/core/types.h"
29
30namespace AGS3 {
31
32#ifndef AL_METHOD
33#define AL_METHOD(type, name, args) type (*name) args
34#endif
35
36#define SYSTEM_AUTODETECT 0
37#define SYSTEM_SCUMMVM AL_ID('S','C','V','M')
38#define SYSTEM_NONE AL_ID('N','O','N','E')
39
40#define GFX_SCUMMVM AL_ID('S', 'C', 'V', 'M')
41
42#define SWITCH_NONE 0
43#define SWITCH_PAUSE 1
44#define SWITCH_AMNESIA 2
45#define SWITCH_BACKGROUND 3
46#define SWITCH_BACKAMNESIA 4
47
48#define SWITCH_IN 0
49#define SWITCH_OUT 1
50
51struct GFX_MODE {
52int width, height, bpp;
53};
54
56 int num_modes; /* number of gfx modes */
57 GFX_MODE *mode; /* pointer to the actual mode list array */
58};
59
61 int id;
62 const char *name;
63 const char *desc;
64 const char *ascii_name;
65 AL_METHOD(int, init, (void));
66 AL_METHOD(void, exit, (void));
67 AL_METHOD(void, get_executable_name, (char *output, int size));
68 AL_METHOD(int, find_resource, (char *dest, const char *resource, int size));
69 AL_METHOD(void, set_window_title, (const char *name));
70 AL_METHOD(int, set_close_button_callback, (AL_METHOD(void, proc, (void))));
71 AL_METHOD(void, message, (const char *msg));
72 AL_METHOD(void, assert, (const char *msg));
73 AL_METHOD(void, save_console_state, (void));
74 AL_METHOD(void, restore_console_state, (void));
75 AL_METHOD(BITMAP *, create_bitmap, (int color_depth, int width, int height));
76 AL_METHOD(void, created_bitmap, (BITMAP *bmp));
77 AL_METHOD(BITMAP *, create_sub_bitmap, (BITMAP *parent, int x, int y, int width, int height));
78 AL_METHOD(void, created_sub_bitmap, (BITMAP *bmp, BITMAP *parent));
79 AL_METHOD(int, destroy_bitmap, (BITMAP *bitmap));
80 AL_METHOD(void, read_hardware_palette, (void));
81 AL_METHOD(void, set_palette_range, (const RGB *p, int from, int to, int retracesync));
82 AL_METHOD(struct GFX_VTABLE *, get_vtable, (int color_depth));
83 AL_METHOD(int, set_display_switch_mode, (int mode));
84 AL_METHOD(void, display_switch_lock, (int lock, int foreground));
85 AL_METHOD(int, desktop_color_depth, (void));
86 AL_METHOD(int, get_desktop_resolution, (int *width, int *height));
87 AL_METHOD(void, get_gfx_safe_mode, (int *driver, struct GFX_MODE *mode));
88 AL_METHOD(void, yield_timeslice, (void));
89 AL_METHOD(void *, create_mutex, (void));
90 AL_METHOD(void, destroy_mutex, (void *handle));
91 AL_METHOD(void, lock_mutex, (void *handle));
92 AL_METHOD(void, unlock_mutex, (void *handle));
93};
94
95/* creates and manages the screen bitmap */
96struct GFX_DRIVER {
97 int id;
98 AL_CONST char *name;
99 AL_CONST char *desc;
100 AL_CONST char *ascii_name;
101 AL_METHOD(BITMAP *, init, (int w, int h, int v_w, int v_h, int color_depth));
102 AL_METHOD(void, exit, (BITMAP *b));
103 AL_METHOD(int, scroll, (int x, int y));
104 AL_METHOD(void, vsync, (void));
105 AL_METHOD(void, set_palette, (AL_CONST RGB *p, int from, int to, int retracesync));
106 AL_METHOD(int, request_scroll, (int x, int y));
107 AL_METHOD(int, poll_scroll, (void));
108 AL_METHOD(void, enable_triple_buffer, (void));
109 AL_METHOD(BITMAP *, create_video_bitmap, (int width, int height));
110 AL_METHOD(void, destroy_video_bitmap, (BITMAP *bitmap));
111 AL_METHOD(int, show_video_bitmap, (BITMAP *bitmap));
112 AL_METHOD(int, request_video_bitmap, (BITMAP *bitmap));
113 AL_METHOD(BITMAP *, create_system_bitmap, (int width, int height));
114 AL_METHOD(void, destroy_system_bitmap, (BITMAP *bitmap));
115 AL_METHOD(int, set_mouse_sprite, (BITMAP *sprite, int xfocus, int yfocus));
116 AL_METHOD(int, show_mouse, (BITMAP *bmp, int x, int y));
117 AL_METHOD(void, hide_mouse, (void));
118 AL_METHOD(void, move_mouse, (int x, int y));
119 AL_METHOD(void, save_video_state, (void));
120 AL_METHOD(void, restore_video_state, (void));
121 AL_METHOD(void, set_blender_mode, (int mode, int r, int g, int b, int a));
122 AL_METHOD(GFX_MODE_LIST *, fetch_mode_list, (void));
123 int w, h; /* physical (not virtual!) screen size */
124 int linear; /* true if video memory is linear */
125 long bank_size; /* bank size, in bytes */
126 long bank_gran; /* bank granularity, in bytes */
127 long vid_mem; /* video memory size, in bytes */
128 long vid_phys_base; /* physical address of video memory */
129 int windowed; /* true if driver runs windowed */
130};
131
132extern void set_color_depth(int depth);
133extern int get_color_depth();
134extern int get_desktop_resolution(int32_t *width, int32_t *height);
135extern void request_refresh_rate(int rate);
136extern void set_close_button_callback(void(*proc)());
137
138extern GFX_MODE_LIST *get_gfx_mode_list(int card);
139extern void destroy_gfx_mode_list(GFX_MODE_LIST *list);
140
141inline void vsync() {}
142inline int set_display_switch_callback(int dir, AL_METHOD(void, cb, (void))) {
143 return 0;
144}
145inline int set_display_switch_mode(int v) {
146 return -1;
147}
148
149} // namespace AGS3
150
151#endif
Definition: surface.h:32
Definition: system.h:96
Definition: system.h:55
Definition: system.h:51
Definition: system.h:60
Definition: color.h:49