Mercurial > sdl-ios-xcode
annotate src/video/SDL_video.c @ 1719:5b9f50c957ed SDL-1.3
You can now create multiple windows on Win32
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 28 Jun 2006 08:12:07 +0000 |
parents | 931d111e737a |
children | a1ebb17f9c52 |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1296
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1296
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
0 | 7 License as published by the Free Software Foundation; either |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1296
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
0 | 9 |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1296
diff
changeset
|
13 Lesser General Public License for more details. |
0 | 14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1296
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1296
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1296
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 18 |
19 Sam Lantinga | |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
229
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1385
diff
changeset
|
22 #include "SDL_config.h" |
0 | 23 |
24 /* The high-level video driver subsystem */ | |
25 | |
26 #include "SDL.h" | |
27 #include "SDL_sysvideo.h" | |
28 #include "SDL_blit.h" | |
29 #include "SDL_pixels_c.h" | |
1676
e136f3ffdc1b
Adding software renderer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
1672
diff
changeset
|
30 #include "SDL_renderer_sw.h" |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
31 #include "../events/SDL_sysevents.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
32 #include "../events/SDL_events_c.h" |
0 | 33 |
34 /* Available video drivers */ | |
35 static VideoBootStrap *bootstrap[] = { | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
36 #if SDL_VIDEO_DRIVER_QUARTZ |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
37 &QZ_bootstrap, |
1133
609c060fd2a2
The MacOSX Carbon/Cocoa/X11 all in one library patch. Relevant emails:
Ryan C. Gordon <icculus@icculus.org>
parents:
1076
diff
changeset
|
38 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
39 #if SDL_VIDEO_DRIVER_X11 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
40 &X11_bootstrap, |
0 | 41 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
42 #if SDL_VIDEO_DRIVER_DGA |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
43 &DGA_bootstrap, |
0 | 44 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
45 #if SDL_VIDEO_DRIVER_NANOX |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
46 &NX_bootstrap, |
30
57bf11a5efd7
Added initial support for Nano-X (thanks Hsieh-Fu!)
Sam Lantinga <slouken@lokigames.com>
parents:
19
diff
changeset
|
47 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
48 #if SDL_VIDEO_DRIVER_IPOD |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
49 &iPod_bootstrap, |
1140
af8b0f9ac2f4
iPod Linux framebuffer support.
Ryan C. Gordon <icculus@icculus.org>
parents:
1133
diff
changeset
|
50 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
51 #if SDL_VIDEO_DRIVER_QTOPIA |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
52 &Qtopia_bootstrap, |
567 | 53 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
54 #if SDL_VIDEO_DRIVER_WSCONS |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
55 &WSCONS_bootstrap, |
1187 | 56 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
57 #if SDL_VIDEO_DRIVER_FBCON |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
58 &FBCON_bootstrap, |
0 | 59 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
60 #if SDL_VIDEO_DRIVER_DIRECTFB |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
61 &DirectFB_bootstrap, |
167
cb384ef627f6
Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
125
diff
changeset
|
62 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
63 #if SDL_VIDEO_DRIVER_PS2GS |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
64 &PS2GS_bootstrap, |
0 | 65 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
66 #if SDL_VIDEO_DRIVER_GGI |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
67 &GGI_bootstrap, |
0 | 68 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
69 #if SDL_VIDEO_DRIVER_VGL |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
70 &VGL_bootstrap, |
75
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
58
diff
changeset
|
71 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
72 #if SDL_VIDEO_DRIVER_SVGALIB |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
73 &SVGALIB_bootstrap, |
0 | 74 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
75 #if SDL_VIDEO_DRIVER_GAPI |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
76 &GAPI_bootstrap, |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
77 #endif |
1712
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
1707
diff
changeset
|
78 #if SDL_VIDEO_DRIVER_WIN32 |
931d111e737a
Started framework for Windows video driver
Sam Lantinga <slouken@libsdl.org>
parents:
1707
diff
changeset
|
79 &WIN32_bootstrap, |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
80 #endif |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
81 #if SDL_VIDEO_DRIVER_BWINDOW |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
82 &BWINDOW_bootstrap, |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
83 #endif |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
84 #if SDL_VIDEO_DRIVER_TOOLBOX |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
85 &TOOLBOX_bootstrap, |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
86 #endif |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
87 #if SDL_VIDEO_DRIVER_DRAWSPROCKET |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
88 &DSp_bootstrap, |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
89 #endif |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
90 #if SDL_VIDEO_DRIVER_CYBERGRAPHICS |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
91 &CGX_bootstrap, |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
92 #endif |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
93 #if SDL_VIDEO_DRIVER_PHOTON |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
94 &ph_bootstrap, |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
95 #endif |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
96 #if SDL_VIDEO_DRIVER_EPOC |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
97 &EPOC_bootstrap, |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
98 #endif |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
99 #if SDL_VIDEO_DRIVER_XBIOS |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
100 &XBIOS_bootstrap, |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
101 #endif |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
102 #if SDL_VIDEO_DRIVER_GEM |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
103 &GEM_bootstrap, |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
104 #endif |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
105 #if SDL_VIDEO_DRIVER_PICOGUI |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
106 &PG_bootstrap, |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
107 #endif |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
108 #if SDL_VIDEO_DRIVER_DC |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
109 &DC_bootstrap, |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
110 #endif |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
111 #if SDL_VIDEO_DRIVER_RISCOS |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
112 &RISCOS_bootstrap, |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
113 #endif |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
114 #if SDL_VIDEO_DRIVER_OS2FS |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
115 &OS2FSLib_bootstrap, |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
116 #endif |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
117 #if SDL_VIDEO_DRIVER_AALIB |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
118 &AALIB_bootstrap, |
0 | 119 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
120 #if SDL_VIDEO_DRIVER_DUMMY |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
121 &DUMMY_bootstrap, |
610
95433459fbd2
Date: Mon, 14 Apr 2003 22:08:27 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
580
diff
changeset
|
122 #endif |
1658 | 123 #if SDL_VIDEO_DRIVER_GLSDL |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
124 &glSDL_bootstrap, |
1658 | 125 #endif |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
126 NULL |
0 | 127 }; |
173
83018110dce8
Added initial support for EPOC/Symbian OS (thanks Hannu!)
Sam Lantinga <slouken@libsdl.org>
parents:
167
diff
changeset
|
128 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
129 static SDL_VideoDevice *_this = NULL; |
0 | 130 |
131 /* Various local functions */ | |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
132 int SDL_VideoInit(const char *driver_name, Uint32 flags); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
133 void SDL_VideoQuit(void); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
134 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
135 static int |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
136 cmpmodes(const void *A, const void *B) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
137 { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
138 SDL_DisplayMode a = *(const SDL_DisplayMode *) A; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
139 SDL_DisplayMode b = *(const SDL_DisplayMode *) B; |
0 | 140 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
141 if (a.w != b.w) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
142 return b.w - a.w; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
143 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
144 if (a.h != b.h) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
145 return b.h - a.h; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
146 } |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
147 if (SDL_BITSPERPIXEL(a.format) != SDL_BITSPERPIXEL(b.format)) { |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
148 return SDL_BITSPERPIXEL(b.format) - SDL_BITSPERPIXEL(a.format); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
149 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
150 if (a.refresh_rate != b.refresh_rate) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
151 return b.refresh_rate - a.refresh_rate; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
152 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
153 return 0; |
1660
8b9d79e7eacf
Added API requested in bug #43:
Sam Lantinga <slouken@libsdl.org>
parents:
1658
diff
changeset
|
154 } |
8b9d79e7eacf
Added API requested in bug #43:
Sam Lantinga <slouken@libsdl.org>
parents:
1658
diff
changeset
|
155 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
156 int |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
157 SDL_GetNumVideoDrivers(void) |
1660
8b9d79e7eacf
Added API requested in bug #43:
Sam Lantinga <slouken@libsdl.org>
parents:
1658
diff
changeset
|
158 { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
159 return SDL_arraysize(bootstrap) - 1; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
160 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
161 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
162 const char * |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
163 SDL_GetVideoDriver(int index) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
164 { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
165 if (index >= 0 && index < SDL_GetNumVideoDrivers()) { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
166 return bootstrap[index]->name; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
167 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
168 return NULL; |
1660
8b9d79e7eacf
Added API requested in bug #43:
Sam Lantinga <slouken@libsdl.org>
parents:
1658
diff
changeset
|
169 } |
0 | 170 |
171 /* | |
172 * Initialize the video and event subsystems -- determine native pixel format | |
173 */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
174 int |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
175 SDL_VideoInit(const char *driver_name, Uint32 flags) |
0 | 176 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
177 SDL_VideoDevice *video; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
178 int index; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
179 int i; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
180 int bpp; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
181 Uint32 Rmask, Gmask, Bmask, Amask; |
0 | 182 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
183 /* Toggle the event thread flags, based on OS requirements */ |
0 | 184 #if defined(MUST_THREAD_EVENTS) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
185 flags |= SDL_INIT_EVENTTHREAD; |
0 | 186 #elif defined(CANT_THREAD_EVENTS) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
187 if ((flags & SDL_INIT_EVENTTHREAD) == SDL_INIT_EVENTTHREAD) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
188 SDL_SetError("OS doesn't support threaded events"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
189 return -1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
190 } |
0 | 191 #endif |
192 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
193 /* Check to make sure we don't overwrite '_this' */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
194 if (_this != NULL) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
195 SDL_VideoQuit(); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
196 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
197 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
198 /* Select the proper video driver */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
199 index = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
200 video = NULL; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
201 if (driver_name != NULL) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
202 for (i = 0; bootstrap[i]; ++i) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
203 if (SDL_strncmp(bootstrap[i]->name, driver_name, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
204 SDL_strlen(bootstrap[i]->name)) == 0) { |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
205 if (bootstrap[i]->available()) { |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
206 video = bootstrap[i]->create(index); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
207 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
208 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
209 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
210 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
211 } else { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
212 for (i = 0; bootstrap[i]; ++i) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
213 if (bootstrap[i]->available()) { |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
214 video = bootstrap[i]->create(index); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
215 if (video != NULL) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
216 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
217 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
218 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
219 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
220 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
221 if (video == NULL) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
222 if (driver_name) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
223 SDL_SetError("%s not available", driver_name); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
224 } else { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
225 SDL_SetError("No available video device"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
226 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
227 return -1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
228 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
229 _this = video; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
230 _this->name = bootstrap[i]->name; |
1670 | 231 _this->next_object_id = 1; |
0 | 232 |
1669
9857d21967bb
The test programs compile again.
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
233 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
234 /* Set some very sane GL defaults */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
235 _this->gl_config.driver_loaded = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
236 _this->gl_config.dll_handle = NULL; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
237 _this->gl_config.red_size = 3; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
238 _this->gl_config.green_size = 3; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
239 _this->gl_config.blue_size = 2; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
240 _this->gl_config.alpha_size = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
241 _this->gl_config.buffer_size = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
242 _this->gl_config.depth_size = 16; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
243 _this->gl_config.stencil_size = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
244 _this->gl_config.double_buffer = 1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
245 _this->gl_config.accum_red_size = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
246 _this->gl_config.accum_green_size = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
247 _this->gl_config.accum_blue_size = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
248 _this->gl_config.accum_alpha_size = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
249 _this->gl_config.stereo = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
250 _this->gl_config.multisamplebuffers = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
251 _this->gl_config.multisamplesamples = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
252 _this->gl_config.accelerated = -1; /* not known, don't set */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
253 _this->gl_config.swap_control = -1; /* not known, don't set */ |
0 | 254 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
255 /* Initialize the video subsystem */ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
256 if (_this->VideoInit(_this) < 0) { |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
257 SDL_VideoQuit(); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
258 return -1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
259 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
260 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
261 /* Make sure some displays were added */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
262 if (_this->num_displays == 0) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
263 SDL_SetError("The video driver did not add any displays"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
264 SDL_VideoQuit(); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
265 return (-1); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
266 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
267 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
268 /* Sort the video modes */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
269 for (i = 0; i < _this->num_displays; ++i) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
270 SDL_qsort(_this->displays[i].display_modes, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
271 _this->displays[i].num_display_modes, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
272 sizeof(SDL_DisplayMode), cmpmodes); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
273 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
274 |
1676
e136f3ffdc1b
Adding software renderer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
1672
diff
changeset
|
275 /* The software renderer is always available */ |
e136f3ffdc1b
Adding software renderer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
1672
diff
changeset
|
276 for (i = 0; i < _this->num_displays; ++i) { |
e136f3ffdc1b
Adding software renderer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
1672
diff
changeset
|
277 if (_this->displays[i].num_render_drivers > 0) { |
e136f3ffdc1b
Adding software renderer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
1672
diff
changeset
|
278 SDL_AddRenderDriver(i, &SDL_SW_RenderDriver); |
e136f3ffdc1b
Adding software renderer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
1672
diff
changeset
|
279 } |
e136f3ffdc1b
Adding software renderer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
1672
diff
changeset
|
280 } |
e136f3ffdc1b
Adding software renderer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
1672
diff
changeset
|
281 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
282 /* Start the event loop */ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
283 if (SDL_StartEventLoop(flags) < 0) { |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
284 SDL_VideoQuit(); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
285 return -1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
286 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
287 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
288 /* We're ready to go! */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
289 return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
290 } |
0 | 291 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
292 const char * |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
293 SDL_GetCurrentVideoDriver() |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
294 { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
295 if (!_this) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
296 return NULL; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
297 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
298 return _this->name; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
299 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
300 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
301 SDL_VideoDevice * |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
302 SDL_GetVideoDevice() |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
303 { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
304 return _this; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
305 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
306 |
1677
5e4c5e095925
Added new style dummy renderer
Sam Lantinga <slouken@libsdl.org>
parents:
1676
diff
changeset
|
307 int |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
308 SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
309 { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
310 SDL_VideoDisplay display; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
311 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
312 SDL_zero(display); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
313 if (desktop_mode) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
314 display.desktop_mode = *desktop_mode; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
315 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
316 display.current_mode = display.desktop_mode; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
317 |
1677
5e4c5e095925
Added new style dummy renderer
Sam Lantinga <slouken@libsdl.org>
parents:
1676
diff
changeset
|
318 return SDL_AddVideoDisplay(&display); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
319 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
320 |
1677
5e4c5e095925
Added new style dummy renderer
Sam Lantinga <slouken@libsdl.org>
parents:
1676
diff
changeset
|
321 int |
1669
9857d21967bb
The test programs compile again.
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
322 SDL_AddVideoDisplay(const SDL_VideoDisplay * display) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
323 { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
324 SDL_VideoDisplay *displays; |
1677
5e4c5e095925
Added new style dummy renderer
Sam Lantinga <slouken@libsdl.org>
parents:
1676
diff
changeset
|
325 int index = -1; |
0 | 326 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
327 displays = |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
328 SDL_realloc(_this->displays, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
329 (_this->num_displays + 1) * sizeof(*displays)); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
330 if (displays) { |
1677
5e4c5e095925
Added new style dummy renderer
Sam Lantinga <slouken@libsdl.org>
parents:
1676
diff
changeset
|
331 index = _this->num_displays++; |
5e4c5e095925
Added new style dummy renderer
Sam Lantinga <slouken@libsdl.org>
parents:
1676
diff
changeset
|
332 displays[index] = *display; |
1682
7ae8018b2e5d
Default palette entries to white, instead of black.
Sam Lantinga <slouken@libsdl.org>
parents:
1681
diff
changeset
|
333 displays[index].device = _this; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
334 _this->displays = displays; |
1677
5e4c5e095925
Added new style dummy renderer
Sam Lantinga <slouken@libsdl.org>
parents:
1676
diff
changeset
|
335 } else { |
5e4c5e095925
Added new style dummy renderer
Sam Lantinga <slouken@libsdl.org>
parents:
1676
diff
changeset
|
336 SDL_OutOfMemory(); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
337 } |
1677
5e4c5e095925
Added new style dummy renderer
Sam Lantinga <slouken@libsdl.org>
parents:
1676
diff
changeset
|
338 return index; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
339 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
340 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
341 int |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
342 SDL_GetNumVideoDisplays(void) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
343 { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
344 if (!_this) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
345 return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
346 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
347 return _this->num_displays; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
348 } |
0 | 349 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
350 int |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
351 SDL_SelectVideoDisplay(int index) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
352 { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
353 if (!_this) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
354 SDL_SetError("Video subsystem has not been initialized"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
355 return (-1); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
356 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
357 if (index >= 0) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
358 if (index >= _this->num_displays) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
359 SDL_SetError("index must be in the range 0 - %d", |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
360 _this->num_displays - 1); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
361 return -1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
362 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
363 _this->current_display = index; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
364 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
365 return _this->current_display; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
366 } |
0 | 367 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
368 void |
1670 | 369 SDL_AddDisplayMode(int displayIndex, const SDL_DisplayMode * mode) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
370 { |
1670 | 371 SDL_VideoDisplay *display = &_this->displays[displayIndex]; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
372 SDL_DisplayMode *modes; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
373 int i, nmodes; |
0 | 374 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
375 /* Make sure we don't already have the mode in the list */ |
1670 | 376 modes = display->display_modes; |
377 nmodes = display->num_display_modes; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
378 for (i = 0; i < nmodes; ++i) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
379 if (SDL_memcmp(mode, &modes[i], sizeof(*mode)) == 0) { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
380 return; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
381 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
382 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
383 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
384 /* Go ahead and add the new mode */ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
385 modes = SDL_realloc(modes, (nmodes + 1) * sizeof(*mode)); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
386 if (modes) { |
1670 | 387 display->display_modes = modes; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
388 modes[nmodes] = *mode; |
1670 | 389 display->num_display_modes++; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
390 } |
0 | 391 } |
392 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
393 int |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
394 SDL_GetNumDisplayModes() |
0 | 395 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
396 if (_this) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
397 return SDL_CurrentDisplay.num_display_modes; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
398 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
399 return 0; |
0 | 400 } |
401 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
402 const SDL_DisplayMode * |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
403 SDL_GetDisplayMode(int index) |
0 | 404 { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
405 if (index < 0 || index >= SDL_GetNumDisplayModes()) { |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
406 SDL_SetError("index must be in the range of 0 - %d", |
1670 | 407 SDL_GetNumDisplayModes() - 1); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
408 return NULL; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
409 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
410 return &SDL_CurrentDisplay.display_modes[index]; |
0 | 411 } |
412 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
413 const SDL_DisplayMode * |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
414 SDL_GetDesktopDisplayMode(void) |
0 | 415 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
416 if (_this) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
417 return &SDL_CurrentDisplay.desktop_mode; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
418 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
419 return NULL; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
420 } |
0 | 421 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
422 const SDL_DisplayMode * |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
423 SDL_GetCurrentDisplayMode(void) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
424 { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
425 if (_this) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
426 return &SDL_CurrentDisplay.current_mode; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
427 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
428 return NULL; |
0 | 429 } |
430 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
431 SDL_DisplayMode * |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
432 SDL_GetClosestDisplayMode(const SDL_DisplayMode * mode, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
433 SDL_DisplayMode * closest) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
434 { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
435 Uint32 target_format; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
436 int target_refresh_rate; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
437 int i; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
438 SDL_DisplayMode *current, *match; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
439 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
440 if (!_this || !mode || !closest) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
441 return NULL; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
442 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
443 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
444 /* Default to the desktop format */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
445 if (mode->format) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
446 target_format = mode->format; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
447 } else { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
448 target_format = SDL_CurrentDisplay.desktop_mode.format; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
449 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
450 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
451 /* Default to the desktop refresh rate */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
452 if (mode->refresh_rate) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
453 target_refresh_rate = mode->refresh_rate; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
454 } else { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
455 target_refresh_rate = SDL_CurrentDisplay.desktop_mode.refresh_rate; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
456 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
457 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
458 match = NULL; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
459 for (i = 0; i < SDL_CurrentDisplay.num_display_modes; ++i) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
460 current = &SDL_CurrentDisplay.display_modes[i]; |
0 | 461 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
462 if ((current->w && current->h) && |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
463 (current->w < mode->w || current->h < mode->h)) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
464 /* Out of sorted modes large enough here */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
465 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
466 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
467 if (!match || current->w < match->w || current->h < match->h) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
468 match = current; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
469 continue; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
470 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
471 if (current->format != match->format) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
472 /* Sorted highest depth to lowest */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
473 if (current->format == target_format || |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
474 (SDL_BITSPERPIXEL(current->format) >= |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
475 SDL_BITSPERPIXEL(target_format) |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
476 && SDL_PIXELTYPE(current->format) == |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
477 SDL_PIXELTYPE(target_format))) { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
478 match = current; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
479 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
480 continue; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
481 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
482 if (current->refresh_rate != match->refresh_rate) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
483 /* Sorted highest refresh to lowest */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
484 if (current->refresh_rate >= target_refresh_rate) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
485 match = current; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
486 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
487 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
488 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
489 if (match) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
490 if (match->format) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
491 closest->format = match->format; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
492 } else { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
493 closest->format = mode->format; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
494 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
495 if (match->w && match->h) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
496 closest->w = match->w; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
497 closest->h = match->h; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
498 } else { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
499 closest->w = mode->w; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
500 closest->h = mode->h; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
501 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
502 if (match->refresh_rate) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
503 closest->refresh_rate = match->refresh_rate; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
504 } else { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
505 closest->refresh_rate = mode->refresh_rate; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
506 } |
1706
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
507 /* Pick some reasonable defaults if the app and driver don't care */ |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
508 if (!closest->format) { |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
509 closest->format = SDL_PixelFormat_RGB888; |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
510 } |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
511 if (!closest->w) { |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
512 closest->w = 640; |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
513 } |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
514 if (!closest->h) { |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
515 closest->h = 480; |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
516 } |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
517 return closest; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
518 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
519 return NULL; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
520 } |
853
dddfc37e1f65
Don't allow video modes larger than the maximum size
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
521 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
522 int |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
523 SDL_SetDisplayMode(const SDL_DisplayMode * mode) |
0 | 524 { |
1667
1fddae038bc8
Implemented many compatibility functions
Sam Lantinga <slouken@libsdl.org>
parents:
1666
diff
changeset
|
525 SDL_VideoDisplay *display; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
526 SDL_DisplayMode display_mode; |
1683
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
527 int i, ncolors; |
0 | 528 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
529 if (!_this) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
530 SDL_SetError("Video subsystem has not been initialized"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
531 return -1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
532 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
533 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
534 if (!mode) { |
1707
57ce47f033a5
Passing NULL to SDL_SetDisplayMode() will set the desktop mode.
Sam Lantinga <slouken@libsdl.org>
parents:
1706
diff
changeset
|
535 mode = SDL_GetDesktopDisplayMode(); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
536 } |
1667
1fddae038bc8
Implemented many compatibility functions
Sam Lantinga <slouken@libsdl.org>
parents:
1666
diff
changeset
|
537 display = &SDL_CurrentDisplay; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
538 display_mode = *mode; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
539 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
540 /* Default to the current mode */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
541 if (!display_mode.format) { |
1667
1fddae038bc8
Implemented many compatibility functions
Sam Lantinga <slouken@libsdl.org>
parents:
1666
diff
changeset
|
542 display_mode.format = display->current_mode.format; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
543 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
544 if (!display_mode.w) { |
1667
1fddae038bc8
Implemented many compatibility functions
Sam Lantinga <slouken@libsdl.org>
parents:
1666
diff
changeset
|
545 display_mode.w = display->current_mode.w; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
546 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
547 if (!display_mode.h) { |
1667
1fddae038bc8
Implemented many compatibility functions
Sam Lantinga <slouken@libsdl.org>
parents:
1666
diff
changeset
|
548 display_mode.h = display->current_mode.h; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
549 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
550 if (!display_mode.refresh_rate) { |
1667
1fddae038bc8
Implemented many compatibility functions
Sam Lantinga <slouken@libsdl.org>
parents:
1666
diff
changeset
|
551 display_mode.refresh_rate = display->current_mode.refresh_rate; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
552 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
553 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
554 /* Get a good video mode, the closest one possible */ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
555 if (!SDL_GetClosestDisplayMode(&display_mode, &display_mode)) { |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
556 SDL_SetError("No video mode large enough for %dx%d", |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
557 display_mode.w, display_mode.h); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
558 return -1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
559 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
560 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
561 /* See if there's anything left to do */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
562 if (SDL_memcmp |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
563 (&display_mode, SDL_GetCurrentDisplayMode(), |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
564 sizeof(display_mode)) == 0) { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
565 return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
566 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
567 |
1683
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
568 /* Set up a palette, if necessary */ |
1681
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
569 if (SDL_ISPIXELFORMAT_INDEXED(display_mode.format)) { |
1683
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
570 ncolors = (1 << SDL_BITSPERPIXEL(display_mode.format)); |
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
571 } else { |
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
572 ncolors = 0; |
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
573 } |
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
574 if ((!ncolors && display->palette) || (ncolors && !display->palette) |
1684
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
575 || (ncolors && ncolors != display->palette->ncolors)) { |
1683
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
576 if (display->palette) { |
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
577 SDL_FreePalette(display->palette); |
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
578 display->palette = NULL; |
1681
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
579 } |
1683
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
580 if (ncolors) { |
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
581 display->palette = SDL_AllocPalette(ncolors); |
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
582 if (!display->palette) { |
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
583 return -1; |
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
584 } |
1706
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
585 SDL_DitherColors(display->palette->colors, |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
586 SDL_BITSPERPIXEL(display_mode.format)); |
1681
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
587 } |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
588 } |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
589 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
590 return _this->SetDisplayMode(_this, &display_mode); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
591 } |
0 | 592 |
1681
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
593 int |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
594 SDL_SetDisplayPalette(const SDL_Color * colors, int firstcolor, int ncolors) |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
595 { |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
596 SDL_Palette *palette; |
1683
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
597 int status = 0; |
1681
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
598 |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
599 if (!_this) { |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
600 SDL_SetError("Video subsystem has not been initialized"); |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
601 return -1; |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
602 } |
1683
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
603 if (!SDL_CurrentDisplay.palette) { |
1681
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
604 SDL_SetError("Display mode does not have a palette"); |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
605 return -1; |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
606 } |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
607 |
1683
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
608 status = |
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
609 SDL_SetPaletteColors(SDL_CurrentDisplay.palette, colors, firstcolor, |
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
610 ncolors); |
1681
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
611 |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
612 if (_this->SetDisplayPalette) { |
1683
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
613 if (_this->SetDisplayPalette(_this, palette) < 0) { |
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
614 status = -1; |
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
615 } |
1681
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
616 } |
1683
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
617 return status; |
1681
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
618 } |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
619 |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
620 int |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
621 SDL_GetDisplayPalette(SDL_Color * colors, int firstcolor, int ncolors) |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
622 { |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
623 SDL_Palette *palette; |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
624 |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
625 if (!_this) { |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
626 SDL_SetError("Video subsystem has not been initialized"); |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
627 return -1; |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
628 } |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
629 |
1683
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
630 palette = SDL_CurrentDisplay.palette; |
1681
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
631 if (!palette->ncolors) { |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
632 SDL_SetError("Display mode does not have a palette"); |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
633 return -1; |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
634 } |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
635 |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
636 if (firstcolor < 0 || (firstcolor + ncolors) > palette->ncolors) { |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
637 SDL_SetError("Palette indices are out of range"); |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
638 return -1; |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
639 } |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
640 |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
641 SDL_memcpy(colors, &palette->colors[firstcolor], |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
642 ncolors * sizeof(*colors)); |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
643 return 0; |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
644 } |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
645 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
646 SDL_WindowID |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
647 SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
648 { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
649 const Uint32 allowed_flags = (SDL_WINDOW_FULLSCREEN | |
1719
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1712
diff
changeset
|
650 SDL_WINDOW_OPENGL | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
651 SDL_WINDOW_SHOWN | |
1719
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1712
diff
changeset
|
652 SDL_WINDOW_BORDERLESS | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
653 SDL_WINDOW_RESIZABLE | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
654 SDL_WINDOW_MAXIMIZED | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
655 SDL_WINDOW_MINIMIZED | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
656 SDL_WINDOW_INPUT_GRABBED); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
657 SDL_Window window; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
658 int num_windows; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
659 SDL_Window *windows; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
660 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
661 if (!_this) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
662 SDL_SetError("Video subsystem has not been initialized"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
663 return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
664 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
665 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
666 SDL_zero(window); |
1670 | 667 window.id = _this->next_object_id++; |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
668 window.title = title ? SDL_strdup(title) : NULL; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
669 window.x = x; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
670 window.y = y; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
671 window.w = w; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
672 window.h = h; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
673 window.flags = (flags & allowed_flags); |
1706
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
674 window.display = _this->current_display; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
675 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
676 if (_this->CreateWindow && _this->CreateWindow(_this, &window) < 0) { |
1667
1fddae038bc8
Implemented many compatibility functions
Sam Lantinga <slouken@libsdl.org>
parents:
1666
diff
changeset
|
677 if (window.title) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
678 SDL_free(window.title); |
1667
1fddae038bc8
Implemented many compatibility functions
Sam Lantinga <slouken@libsdl.org>
parents:
1666
diff
changeset
|
679 } |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
680 return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
681 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
682 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
683 num_windows = SDL_CurrentDisplay.num_windows; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
684 windows = |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
685 SDL_realloc(SDL_CurrentDisplay.windows, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
686 (num_windows + 1) * sizeof(*windows)); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
687 if (!windows) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
688 if (_this->DestroyWindow) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
689 _this->DestroyWindow(_this, &window); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
690 } |
1667
1fddae038bc8
Implemented many compatibility functions
Sam Lantinga <slouken@libsdl.org>
parents:
1666
diff
changeset
|
691 if (window.title) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
692 SDL_free(window.title); |
1667
1fddae038bc8
Implemented many compatibility functions
Sam Lantinga <slouken@libsdl.org>
parents:
1666
diff
changeset
|
693 } |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
694 return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
695 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
696 windows[num_windows] = window; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
697 SDL_CurrentDisplay.windows = windows; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
698 SDL_CurrentDisplay.num_windows++; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
699 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
700 return window.id; |
0 | 701 } |
702 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
703 SDL_WindowID |
1681
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
704 SDL_CreateWindowFrom(const void *data) |
0 | 705 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
706 SDL_Window window; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
707 int num_windows; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
708 SDL_Window *windows; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
709 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
710 if (!_this) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
711 SDL_SetError("Video subsystem has not been initialized"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
712 return (0); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
713 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
714 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
715 SDL_zero(window); |
1670 | 716 window.id = _this->next_object_id++; |
1706
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
717 window.display = _this->current_display; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
718 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
719 if (!_this->CreateWindowFrom || |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
720 _this->CreateWindowFrom(_this, &window, data) < 0) { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
721 return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
722 } |
0 | 723 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
724 num_windows = SDL_CurrentDisplay.num_windows; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
725 windows = |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
726 SDL_realloc(SDL_CurrentDisplay.windows, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
727 (num_windows + 1) * sizeof(*windows)); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
728 if (!windows) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
729 if (_this->DestroyWindow) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
730 _this->DestroyWindow(_this, &window); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
731 } |
1667
1fddae038bc8
Implemented many compatibility functions
Sam Lantinga <slouken@libsdl.org>
parents:
1666
diff
changeset
|
732 if (window.title) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
733 SDL_free(window.title); |
1667
1fddae038bc8
Implemented many compatibility functions
Sam Lantinga <slouken@libsdl.org>
parents:
1666
diff
changeset
|
734 } |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
735 return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
736 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
737 windows[num_windows] = window; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
738 SDL_CurrentDisplay.windows = windows; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
739 SDL_CurrentDisplay.num_windows++; |
430
60effdbf14ee
Make sure width and height passed to SDL_GetVideoMode() are sane.
Ryan C. Gordon <icculus@icculus.org>
parents:
423
diff
changeset
|
740 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
741 return window.id; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
742 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
743 |
1706
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
744 SDL_Window * |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
745 SDL_GetWindowFromID(SDL_WindowID windowID) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
746 { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
747 int i, j; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
748 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
749 if (!_this) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
750 return NULL; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
751 } |
0 | 752 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
753 for (i = 0; i < _this->num_displays; ++i) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
754 SDL_VideoDisplay *display = &_this->displays[i]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
755 for (j = 0; j < display->num_windows; ++j) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
756 SDL_Window *window = &display->windows[j]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
757 if (window->id == windowID) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
758 return window; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
759 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
760 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
761 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
762 return NULL; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
763 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
764 |
1706
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
765 SDL_VideoDisplay * |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
766 SDL_GetDisplayFromWindow(SDL_Window * window) |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
767 { |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
768 if (!_this) { |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
769 return NULL; |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
770 } |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
771 return &_this->displays[window->display]; |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
772 } |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
773 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
774 Uint32 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
775 SDL_GetWindowFlags(SDL_WindowID windowID) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
776 { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
777 SDL_Window *window = SDL_GetWindowFromID(windowID); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
778 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
779 if (!window) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
780 return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
781 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
782 return window->flags; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
783 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
784 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
785 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
786 SDL_SetWindowTitle(SDL_WindowID windowID, const char *title) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
787 { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
788 SDL_Window *window = SDL_GetWindowFromID(windowID); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
789 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
790 if (!window) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
791 return; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
792 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
793 if (window->title) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
794 SDL_free(window->title); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
795 } |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
796 window->title = SDL_strdup(title); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
797 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
798 if (_this->SetWindowTitle) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
799 _this->SetWindowTitle(_this, window); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
800 } |
0 | 801 } |
802 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
803 const char * |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
804 SDL_GetWindowTitle(SDL_WindowID windowID) |
0 | 805 { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
806 SDL_Window *window = SDL_GetWindowFromID(windowID); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
807 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
808 if (!window) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
809 return NULL; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
810 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
811 return window->title; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
812 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
813 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
814 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
815 SDL_SetWindowData(SDL_WindowID windowID, void *userdata) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
816 { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
817 SDL_Window *window = SDL_GetWindowFromID(windowID); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
818 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
819 if (!window) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
820 return; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
821 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
822 window->userdata = userdata; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
823 } |
0 | 824 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
825 void * |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
826 SDL_GetWindowData(SDL_WindowID windowID) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
827 { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
828 SDL_Window *window = SDL_GetWindowFromID(windowID); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
829 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
830 if (!window) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
831 return NULL; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
832 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
833 return window->userdata; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
834 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
835 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
836 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
837 SDL_SetWindowPosition(SDL_WindowID windowID, int x, int y) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
838 { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
839 SDL_Window *window = SDL_GetWindowFromID(windowID); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
840 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
841 if (!window) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
842 return; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
843 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
844 |
1719
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1712
diff
changeset
|
845 if (x != SDL_WINDOWPOS_UNDEFINED) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1712
diff
changeset
|
846 window->x = x; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1712
diff
changeset
|
847 } |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1712
diff
changeset
|
848 if (y != SDL_WINDOWPOS_UNDEFINED) { |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1712
diff
changeset
|
849 window->y = y; |
5b9f50c957ed
You can now create multiple windows on Win32
Sam Lantinga <slouken@libsdl.org>
parents:
1712
diff
changeset
|
850 } |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
851 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
852 if (_this->SetWindowPosition) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
853 _this->SetWindowPosition(_this, window); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
854 } |
0 | 855 } |
856 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
857 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
858 SDL_GetWindowPosition(SDL_WindowID windowID, int *x, int *y) |
0 | 859 { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
860 SDL_Window *window = SDL_GetWindowFromID(windowID); |
0 | 861 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
862 if (!window) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
863 return; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
864 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
865 if (x) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
866 *x = window->x; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
867 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
868 if (y) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
869 *y = window->y; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
870 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
871 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
872 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
873 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
874 SDL_SetWindowSize(SDL_WindowID windowID, int w, int h) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
875 { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
876 SDL_Window *window = SDL_GetWindowFromID(windowID); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
877 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
878 if (!window) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
879 return; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
880 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
881 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
882 window->w = w; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
883 window->h = h; |
0 | 884 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
885 if (_this->SetWindowSize) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
886 _this->SetWindowSize(_this, window); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
887 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
888 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
889 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
890 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
891 SDL_GetWindowSize(SDL_WindowID windowID, int *w, int *h) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
892 { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
893 SDL_Window *window = SDL_GetWindowFromID(windowID); |
0 | 894 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
895 if (!window) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
896 return; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
897 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
898 if (w) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
899 *w = window->w; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
900 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
901 if (h) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
902 *h = window->h; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
903 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
904 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
905 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
906 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
907 SDL_ShowWindow(SDL_WindowID windowID) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
908 { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
909 SDL_Window *window = SDL_GetWindowFromID(windowID); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
910 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
911 if (!window || (window->flags & SDL_WINDOW_SHOWN)) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
912 return; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
913 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
914 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
915 window->flags |= SDL_WINDOW_SHOWN; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
916 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
917 if (_this->ShowWindow) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
918 _this->ShowWindow(_this, window); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
919 } |
0 | 920 } |
921 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
922 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
923 SDL_HideWindow(SDL_WindowID windowID) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
924 { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
925 SDL_Window *window = SDL_GetWindowFromID(windowID); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
926 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
927 if (!window || !(window->flags & SDL_WINDOW_SHOWN)) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
928 return; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
929 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
930 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
931 window->flags &= ~SDL_WINDOW_SHOWN; |
910
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
883
diff
changeset
|
932 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
933 if (_this->HideWindow) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
934 _this->HideWindow(_this, window); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
935 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
936 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
937 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
938 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
939 SDL_RaiseWindow(SDL_WindowID windowID) |
0 | 940 { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
941 SDL_Window *window = SDL_GetWindowFromID(windowID); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
942 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
943 if (!window) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
944 return; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
945 } |
0 | 946 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
947 if (_this->RaiseWindow) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
948 _this->RaiseWindow(_this, window); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
949 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
950 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
951 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
952 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
953 SDL_MaximizeWindow(SDL_WindowID windowID) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
954 { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
955 SDL_Window *window = SDL_GetWindowFromID(windowID); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
956 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
957 if (!window || (window->flags & SDL_WINDOW_MAXIMIZED)) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
958 return; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
959 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
960 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
961 window->flags |= SDL_WINDOW_MAXIMIZED; |
0 | 962 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
963 if (_this->MaximizeWindow) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
964 _this->MaximizeWindow(_this, window); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
965 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
966 } |
0 | 967 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
968 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
969 SDL_MinimizeWindow(SDL_WindowID windowID) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
970 { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
971 SDL_Window *window = SDL_GetWindowFromID(windowID); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
972 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
973 if (!window || (window->flags & SDL_WINDOW_MINIMIZED)) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
974 return; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
975 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
976 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
977 window->flags |= SDL_WINDOW_MINIMIZED; |
0 | 978 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
979 if (_this->MinimizeWindow) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
980 _this->MinimizeWindow(_this, window); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
981 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
982 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
983 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
984 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
985 SDL_RestoreWindow(SDL_WindowID windowID) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
986 { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
987 SDL_Window *window = SDL_GetWindowFromID(windowID); |
0 | 988 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
989 if (!window |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
990 || (window->flags & (SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED))) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
991 return; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
992 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
993 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
994 window->flags &= ~(SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED); |
0 | 995 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
996 if (_this->RestoreWindow) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
997 _this->RestoreWindow(_this, window); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
998 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
999 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1000 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1001 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1002 SDL_SetWindowGrab(SDL_WindowID windowID, int mode) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1003 { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1004 SDL_Window *window = SDL_GetWindowFromID(windowID); |
14
c3e9d4a623c1
Fixed stuck keys when changing the video mode
Sam Lantinga <slouken@lokigames.com>
parents:
11
diff
changeset
|
1005 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1006 if (!window || (!!mode == !!(window->flags & SDL_WINDOW_INPUT_GRABBED))) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1007 return; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1008 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1009 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1010 if (mode) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1011 window->flags |= SDL_WINDOW_INPUT_GRABBED; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1012 } else { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1013 window->flags &= ~SDL_WINDOW_INPUT_GRABBED; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1014 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1015 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1016 if (_this->SetWindowGrab) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1017 _this->SetWindowGrab(_this, window); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1018 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1019 } |
0 | 1020 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1021 int |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1022 SDL_GetWindowGrab(SDL_WindowID windowID) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1023 { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1024 SDL_Window *window = SDL_GetWindowFromID(windowID); |
0 | 1025 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1026 if (!window) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1027 return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1028 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1029 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1030 return ((window->flags & SDL_WINDOW_INPUT_GRABBED) != 0); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1031 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1032 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1033 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1034 SDL_DestroyWindow(SDL_WindowID windowID) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1035 { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1036 int i, j; |
229
4d24d5a660a8
Fix a crash if an OpenGL video mode can't be set.
Sam Lantinga <slouken@libsdl.org>
parents:
216
diff
changeset
|
1037 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1038 if (!_this) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1039 return; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1040 } |
0 | 1041 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1042 for (i = 0; i < _this->num_displays; ++i) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1043 SDL_VideoDisplay *display = &_this->displays[i]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1044 for (j = 0; j < display->num_windows; ++j) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1045 SDL_Window *window = &display->windows[j]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1046 if (window->id != windowID) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1047 continue; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1048 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1049 if (window->flags & SDL_WINDOW_INPUT_GRABBED) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1050 window->flags &= ~SDL_WINDOW_INPUT_GRABBED; |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1051 _this->SetWindowGrab(_this, window); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1052 } |
1670 | 1053 if (window->renderer) { |
1054 SDL_DestroyRenderer(window->id); | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1055 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1056 if (_this->DestroyWindow) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1057 _this->DestroyWindow(_this, window); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1058 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1059 if (window->title) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1060 SDL_free(window->title); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1061 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1062 if (window->gamma) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1063 SDL_free(window->gamma); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1064 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1065 if (j != display->num_windows - 1) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1066 SDL_memcpy(&display->windows[i], |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1067 &display->windows[i + 1], |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1068 (display->num_windows - i - 1) * sizeof(*window)); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1069 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1070 --display->num_windows; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1071 return; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1072 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1073 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1074 } |
0 | 1075 |
1670 | 1076 void |
1077 SDL_AddRenderDriver(int displayIndex, const SDL_RenderDriver * driver) | |
1078 { | |
1079 SDL_VideoDisplay *display = &_this->displays[displayIndex]; | |
1080 SDL_RenderDriver *render_drivers; | |
1081 | |
1082 render_drivers = | |
1083 SDL_realloc(display->render_drivers, | |
1084 (display->num_render_drivers + | |
1085 1) * sizeof(*render_drivers)); | |
1086 if (render_drivers) { | |
1087 render_drivers[display->num_render_drivers] = *driver; | |
1088 display->render_drivers = render_drivers; | |
1089 display->num_render_drivers++; | |
1090 } | |
1091 } | |
1092 | |
1093 int | |
1094 SDL_GetNumRenderers(void) | |
1095 { | |
1096 if (_this) { | |
1097 return SDL_CurrentDisplay.num_render_drivers; | |
1098 } | |
1099 return 0; | |
1100 } | |
1101 | |
1102 int | |
1103 SDL_GetRendererInfo(int index, SDL_RendererInfo * info) | |
1104 { | |
1105 if (index < 0 || index >= SDL_GetNumRenderers()) { | |
1106 SDL_SetError("index must be in the range of 0 - %d", | |
1107 SDL_GetNumRenderers() - 1); | |
1108 return -1; | |
1109 } | |
1110 *info = SDL_CurrentDisplay.render_drivers[index].info; | |
1111 return 0; | |
1112 } | |
1113 | |
1114 int | |
1115 SDL_CreateRenderer(SDL_WindowID windowID, int index, Uint32 flags) | |
1116 { | |
1117 SDL_Window *window = SDL_GetWindowFromID(windowID); | |
1118 | |
1119 if (!window) { | |
1120 return 0; | |
1121 } | |
1122 | |
1123 if (index < 0) { | |
1124 int n = SDL_GetNumRenderers(); | |
1125 for (index = 0; index < n; ++index) { | |
1680
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1126 SDL_RenderDriver *driver = |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1127 &SDL_CurrentDisplay.render_drivers[index]; |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1128 |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1129 /* Skip minimal drivers in automatic scans */ |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1130 if (!(flags & SDL_Renderer_Minimal) |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1131 && (driver->info.flags & SDL_Renderer_Minimal)) { |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1132 continue; |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1133 } |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1134 if ((driver->info.flags & flags) == flags) { |
1670 | 1135 break; |
1136 } | |
1137 } | |
1138 if (index == n) { | |
1139 SDL_SetError("Couldn't find matching render driver"); | |
1140 return -1; | |
1141 } | |
1142 } | |
1143 | |
1144 if (index >= SDL_GetNumRenderers()) { | |
1145 SDL_SetError("index must be -1 or in the range of 0 - %d", | |
1146 SDL_GetNumRenderers() - 1); | |
1147 return -1; | |
1148 } | |
1149 | |
1150 /* Free any existing renderer */ | |
1151 SDL_DestroyRenderer(windowID); | |
1152 | |
1153 /* Create a new renderer instance */ | |
1154 window->renderer = | |
1155 SDL_CurrentDisplay.render_drivers[index].CreateRenderer(window, | |
1156 flags); | |
1157 if (!window->renderer) { | |
1158 return -1; | |
1159 } | |
1160 SDL_CurrentDisplay.current_renderer = window->renderer; | |
1161 | |
1162 return 0; | |
1163 } | |
1164 | |
1165 int | |
1166 SDL_SelectRenderer(SDL_WindowID windowID) | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1167 { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1168 SDL_Window *window = SDL_GetWindowFromID(windowID); |
1670 | 1169 |
1170 if (!window || !window->renderer) { | |
1171 return -1; | |
1172 } | |
1173 SDL_CurrentDisplay.current_renderer = window->renderer; | |
1174 return 0; | |
1175 } | |
1176 | |
1177 SDL_TextureID | |
1178 SDL_CreateTexture(Uint32 format, int access, int w, int h) | |
1179 { | |
1680
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1180 int hash; |
1670 | 1181 SDL_Renderer *renderer; |
1182 SDL_Texture *texture; | |
1183 | |
1184 if (!_this) { | |
1185 return 0; | |
1186 } | |
1187 | |
1188 renderer = SDL_CurrentDisplay.current_renderer; | |
1189 if (!renderer || !renderer->CreateTexture) { | |
1190 return 0; | |
1191 } | |
1192 | |
1193 texture = (SDL_Texture *) SDL_malloc(sizeof(*texture)); | |
1194 if (!texture) { | |
1195 SDL_OutOfMemory(); | |
1196 return 0; | |
1197 } | |
1198 | |
1199 SDL_zerop(texture); | |
1200 texture->id = _this->next_object_id++; | |
1201 texture->format = format; | |
1202 texture->access = access; | |
1203 texture->w = w; | |
1204 texture->h = h; | |
1205 texture->renderer = renderer; | |
0 | 1206 |
1676
e136f3ffdc1b
Adding software renderer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
1672
diff
changeset
|
1207 if (renderer->CreateTexture(renderer, texture) < 0) { |
1670 | 1208 SDL_free(texture); |
1209 return 0; | |
1210 } | |
1680
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1211 |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1212 hash = (texture->id % SDL_arraysize(SDL_CurrentDisplay.textures)); |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1213 texture->next = SDL_CurrentDisplay.textures[hash]; |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1214 SDL_CurrentDisplay.textures[hash] = texture; |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1215 |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1216 return texture->id; |
1670 | 1217 } |
1218 | |
1219 SDL_TextureID | |
1220 SDL_CreateTextureFromSurface(Uint32 format, int access, SDL_Surface * surface) | |
1221 { | |
1222 SDL_TextureID textureID; | |
1223 Uint32 surface_flags = surface->flags; | |
1224 SDL_PixelFormat *fmt = surface->format; | |
1225 Uint32 colorkey; | |
1226 Uint8 alpha; | |
1227 SDL_Rect bounds; | |
1228 SDL_Surface dst; | |
1229 int bpp; | |
1230 Uint32 Rmask, Gmask, Bmask, Amask; | |
1231 | |
1232 if (!surface) { | |
1233 SDL_SetError("SDL_CreateTextureFromSurface() passed NULL surface"); | |
1234 return 0; | |
1235 } | |
1236 | |
1237 if (format) { | |
1238 if (!SDL_PixelFormatEnumToMasks | |
1239 (format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) { | |
1240 SDL_SetError("Unknown pixel format"); | |
1241 return 0; | |
1242 } | |
1243 } else { | |
1706
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1244 if (fmt->Amask || !(surface_flags & (SDL_SRCCOLORKEY | SDL_SRCALPHA))) { |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1245 bpp = fmt->BitsPerPixel; |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1246 Rmask = fmt->Rmask; |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1247 Gmask = fmt->Gmask; |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1248 Bmask = fmt->Bmask; |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1249 Amask = fmt->Amask; |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1250 } else { |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1251 /* Need a format with alpha */ |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1252 bpp = 32; |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1253 Rmask = 0x00FF0000; |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1254 Gmask = 0x0000FF00; |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1255 Bmask = 0x000000FF; |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1256 Amask = 0xFF000000; |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1257 } |
1670 | 1258 format = SDL_MasksToPixelFormatEnum(bpp, Rmask, Gmask, Bmask, Amask); |
1259 if (!format) { | |
1260 SDL_SetError("Unknown pixel format"); | |
1261 return 0; | |
1262 } | |
1263 } | |
1264 | |
1265 textureID = SDL_CreateTexture(format, access, surface->w, surface->h); | |
1266 if (!textureID) { | |
1267 return 0; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1268 } |
0 | 1269 |
1670 | 1270 /* Set up a destination surface for the texture update */ |
1271 SDL_zero(dst); | |
1272 dst.format = SDL_AllocFormat(bpp, Rmask, Gmask, Bmask, Amask); | |
1273 if (!dst.format) { | |
1274 SDL_DestroyTexture(textureID); | |
1275 return 0; | |
1276 } | |
1277 dst.w = surface->w; | |
1278 dst.h = surface->h; | |
1279 if (SDL_LockTexture(textureID, NULL, 1, &dst.pixels, &dst.pitch) == 0) { | |
1280 dst.flags |= SDL_PREALLOC; | |
1281 } else { | |
1282 dst.pitch = SDL_CalculatePitch(&dst); | |
1283 dst.pixels = SDL_malloc(dst.h * dst.pitch); | |
1284 if (!dst.pixels) { | |
1285 SDL_DestroyTexture(textureID); | |
1286 SDL_FreeFormat(dst.format); | |
1287 SDL_OutOfMemory(); | |
1288 return 0; | |
1289 } | |
1290 } | |
1291 | |
1292 /* Copy the palette if any */ | |
1706
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1293 if (fmt->palette) { |
1670 | 1294 SDL_SetTexturePalette(textureID, fmt->palette->colors, 0, |
1295 fmt->palette->ncolors); | |
1706
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1296 SDL_SetSurfacePalette(&dst, fmt->palette); |
1670 | 1297 } |
1298 | |
1299 /* Make the texture transparent if the surface has colorkey */ | |
1300 if (surface_flags & SDL_SRCCOLORKEY) { | |
1301 int row; | |
1302 int length = dst.w * dst.format->BytesPerPixel; | |
1303 Uint8 *p = (Uint8 *) dst.pixels; | |
1304 for (row = 0; row < dst.h; ++row) { | |
1305 SDL_memset(p, 0, length); | |
1306 p += dst.pitch; | |
1307 } | |
1308 } | |
1309 | |
1310 /* Copy over the alpha channel */ | |
1311 if (surface_flags & SDL_SRCALPHA) { | |
1312 if (fmt->Amask) { | |
1313 surface->flags &= ~SDL_SRCALPHA; | |
1314 } else { | |
1315 /* FIXME: Need to make sure the texture has an alpha channel | |
1316 * and copy 'alpha' into the texture alpha channel. | |
1317 */ | |
1318 alpha = surface->format->alpha; | |
1319 SDL_SetAlpha(surface, 0, 0); | |
1320 } | |
1321 } | |
1322 | |
1323 /* Copy over the image data */ | |
1324 bounds.x = 0; | |
1325 bounds.y = 0; | |
1326 bounds.w = surface->w; | |
1327 bounds.h = surface->h; | |
1328 SDL_LowerBlit(surface, &bounds, &dst, &bounds); | |
1329 | |
1330 /* Clean up the original surface */ | |
1331 if ((surface_flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) { | |
1332 Uint32 cflags = surface_flags & (SDL_SRCCOLORKEY | SDL_RLEACCELOK); | |
1333 SDL_SetColorKey(surface, cflags, colorkey); | |
1334 } | |
1335 if ((surface_flags & SDL_SRCALPHA) == SDL_SRCALPHA) { | |
1336 Uint32 aflags = surface_flags & (SDL_SRCALPHA | SDL_RLEACCELOK); | |
1337 if (fmt->Amask) { | |
1338 surface->flags |= SDL_SRCALPHA; | |
1339 } else { | |
1340 SDL_SetAlpha(surface, aflags, alpha); | |
1341 } | |
1342 } | |
1343 | |
1344 /* Update the texture */ | |
1345 if (dst.flags & SDL_PREALLOC) { | |
1346 SDL_UnlockTexture(textureID); | |
1347 } else { | |
1348 SDL_UpdateTexture(textureID, NULL, dst.pixels, dst.pitch); | |
1349 SDL_free(dst.pixels); | |
1350 } | |
1351 SDL_FreeFormat(dst.format); | |
1352 | |
1353 return textureID; | |
1354 } | |
1355 | |
1356 static __inline__ SDL_Texture * | |
1357 SDL_GetTextureFromID(SDL_TextureID textureID) | |
1358 { | |
1359 int hash; | |
1360 SDL_Texture *texture; | |
1361 | |
1362 if (!_this) { | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1363 return NULL; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1364 } |
0 | 1365 |
1670 | 1366 hash = (textureID % SDL_arraysize(SDL_CurrentDisplay.textures)); |
1367 for (texture = SDL_CurrentDisplay.textures[hash]; texture; | |
1368 texture = texture->next) { | |
1369 if (texture->id == textureID) { | |
1370 return texture; | |
1669
9857d21967bb
The test programs compile again.
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
1371 } |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1372 } |
1670 | 1373 return NULL; |
1374 } | |
1375 | |
1376 int | |
1377 SDL_QueryTexture(SDL_TextureID textureID, Uint32 * format, int *access, | |
1378 int *w, int *h) | |
1379 { | |
1380 SDL_Texture *texture = SDL_GetTextureFromID(textureID); | |
1381 | |
1382 if (!texture) { | |
1383 return -1; | |
1384 } | |
1385 | |
1386 if (format) { | |
1387 *format = texture->format; | |
1388 } | |
1389 if (access) { | |
1390 *access = texture->access; | |
1391 } | |
1392 if (w) { | |
1393 *w = texture->w; | |
1394 } | |
1395 if (h) { | |
1396 *h = texture->h; | |
1397 } | |
1398 return 0; | |
1399 } | |
1400 | |
1401 int | |
1678
90bf530ced8e
SDL_SetVideoMode() compiles now...
Sam Lantinga <slouken@libsdl.org>
parents:
1677
diff
changeset
|
1402 SDL_QueryTexturePixels(SDL_TextureID textureID, void **pixels, int *pitch) |
90bf530ced8e
SDL_SetVideoMode() compiles now...
Sam Lantinga <slouken@libsdl.org>
parents:
1677
diff
changeset
|
1403 { |
90bf530ced8e
SDL_SetVideoMode() compiles now...
Sam Lantinga <slouken@libsdl.org>
parents:
1677
diff
changeset
|
1404 SDL_Texture *texture = SDL_GetTextureFromID(textureID); |
90bf530ced8e
SDL_SetVideoMode() compiles now...
Sam Lantinga <slouken@libsdl.org>
parents:
1677
diff
changeset
|
1405 SDL_Renderer *renderer; |
90bf530ced8e
SDL_SetVideoMode() compiles now...
Sam Lantinga <slouken@libsdl.org>
parents:
1677
diff
changeset
|
1406 |
90bf530ced8e
SDL_SetVideoMode() compiles now...
Sam Lantinga <slouken@libsdl.org>
parents:
1677
diff
changeset
|
1407 if (!texture) { |
90bf530ced8e
SDL_SetVideoMode() compiles now...
Sam Lantinga <slouken@libsdl.org>
parents:
1677
diff
changeset
|
1408 return -1; |
90bf530ced8e
SDL_SetVideoMode() compiles now...
Sam Lantinga <slouken@libsdl.org>
parents:
1677
diff
changeset
|
1409 } |
90bf530ced8e
SDL_SetVideoMode() compiles now...
Sam Lantinga <slouken@libsdl.org>
parents:
1677
diff
changeset
|
1410 |
90bf530ced8e
SDL_SetVideoMode() compiles now...
Sam Lantinga <slouken@libsdl.org>
parents:
1677
diff
changeset
|
1411 renderer = texture->renderer; |
90bf530ced8e
SDL_SetVideoMode() compiles now...
Sam Lantinga <slouken@libsdl.org>
parents:
1677
diff
changeset
|
1412 if (!renderer->QueryTexturePixels) { |
90bf530ced8e
SDL_SetVideoMode() compiles now...
Sam Lantinga <slouken@libsdl.org>
parents:
1677
diff
changeset
|
1413 return -1; |
90bf530ced8e
SDL_SetVideoMode() compiles now...
Sam Lantinga <slouken@libsdl.org>
parents:
1677
diff
changeset
|
1414 } |
90bf530ced8e
SDL_SetVideoMode() compiles now...
Sam Lantinga <slouken@libsdl.org>
parents:
1677
diff
changeset
|
1415 return renderer->QueryTexturePixels(renderer, texture, pixels, pitch); |
90bf530ced8e
SDL_SetVideoMode() compiles now...
Sam Lantinga <slouken@libsdl.org>
parents:
1677
diff
changeset
|
1416 } |
90bf530ced8e
SDL_SetVideoMode() compiles now...
Sam Lantinga <slouken@libsdl.org>
parents:
1677
diff
changeset
|
1417 |
90bf530ced8e
SDL_SetVideoMode() compiles now...
Sam Lantinga <slouken@libsdl.org>
parents:
1677
diff
changeset
|
1418 int |
1681
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1419 SDL_SetTexturePalette(SDL_TextureID textureID, const SDL_Color * colors, |
1680
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1420 int firstcolor, int ncolors) |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1421 { |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1422 SDL_Texture *texture = SDL_GetTextureFromID(textureID); |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1423 SDL_Renderer *renderer; |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1424 |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1425 if (!texture) { |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1426 return -1; |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1427 } |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1428 |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1429 renderer = texture->renderer; |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1430 if (!renderer->SetTexturePalette) { |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1431 return -1; |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1432 } |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1433 return renderer->SetTexturePalette(renderer, texture, colors, firstcolor, |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1434 ncolors); |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1435 } |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1436 |
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
1437 int |
1681
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1438 SDL_GetTexturePalette(SDL_TextureID textureID, SDL_Color * colors, |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1439 int firstcolor, int ncolors) |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1440 { |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1441 SDL_Texture *texture = SDL_GetTextureFromID(textureID); |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1442 SDL_Renderer *renderer; |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1443 |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1444 if (!texture) { |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1445 return -1; |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1446 } |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1447 |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1448 renderer = texture->renderer; |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1449 if (!renderer->GetTexturePalette) { |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1450 return -1; |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1451 } |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1452 return renderer->GetTexturePalette(renderer, texture, colors, firstcolor, |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1453 ncolors); |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1454 } |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1455 |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1456 int |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1457 SDL_UpdateTexture(SDL_TextureID textureID, const SDL_Rect * rect, |
1670 | 1458 const void *pixels, int pitch) |
1459 { | |
1460 SDL_Texture *texture = SDL_GetTextureFromID(textureID); | |
1461 SDL_Renderer *renderer; | |
1684
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1462 SDL_Rect full_rect; |
1670 | 1463 |
1464 if (!texture) { | |
1465 return -1; | |
1466 } | |
1467 | |
1468 renderer = texture->renderer; | |
1469 if (!renderer->UpdateTexture) { | |
1470 return -1; | |
1471 } | |
1684
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1472 |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1473 if (!rect) { |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1474 full_rect.x = 0; |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1475 full_rect.y = 0; |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1476 full_rect.w = texture->w; |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1477 full_rect.h = texture->h; |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1478 rect = &full_rect; |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1479 } |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1480 |
1676
e136f3ffdc1b
Adding software renderer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
1672
diff
changeset
|
1481 return renderer->UpdateTexture(renderer, texture, rect, pixels, pitch); |
1670 | 1482 } |
1483 | |
1484 int | |
1681
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1485 SDL_LockTexture(SDL_TextureID textureID, const SDL_Rect * rect, int markDirty, |
1670 | 1486 void **pixels, int *pitch) |
1487 { | |
1488 SDL_Texture *texture = SDL_GetTextureFromID(textureID); | |
1489 SDL_Renderer *renderer; | |
1684
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1490 SDL_Rect full_rect; |
1670 | 1491 |
1492 if (!texture) { | |
1493 return -1; | |
1494 } | |
0 | 1495 |
1670 | 1496 renderer = texture->renderer; |
1497 if (!renderer->LockTexture) { | |
1498 return -1; | |
1499 } | |
1684
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1500 |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1501 if (!rect) { |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1502 full_rect.x = 0; |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1503 full_rect.y = 0; |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1504 full_rect.w = texture->w; |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1505 full_rect.h = texture->h; |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1506 rect = &full_rect; |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1507 } |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1508 |
1676
e136f3ffdc1b
Adding software renderer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
1672
diff
changeset
|
1509 return renderer->LockTexture(renderer, texture, rect, markDirty, pixels, |
e136f3ffdc1b
Adding software renderer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
1672
diff
changeset
|
1510 pitch); |
1670 | 1511 } |
1512 | |
1513 void | |
1514 SDL_UnlockTexture(SDL_TextureID textureID) | |
1515 { | |
1516 SDL_Texture *texture = SDL_GetTextureFromID(textureID); | |
1517 SDL_Renderer *renderer; | |
1518 | |
1519 if (!texture) { | |
1520 return; | |
1521 } | |
1522 | |
1523 renderer = texture->renderer; | |
1524 if (!renderer->UnlockTexture) { | |
1525 return; | |
1526 } | |
1676
e136f3ffdc1b
Adding software renderer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
1672
diff
changeset
|
1527 return renderer->UnlockTexture(renderer, texture); |
1670 | 1528 } |
1529 | |
1530 void | |
1681
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1531 SDL_DirtyTexture(SDL_TextureID textureID, int numrects, |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1532 const SDL_Rect * rects) |
1670 | 1533 { |
1534 SDL_Texture *texture = SDL_GetTextureFromID(textureID); | |
1535 SDL_Renderer *renderer; | |
1536 | |
1537 if (!texture) { | |
1538 return; | |
1539 } | |
1540 | |
1541 renderer = texture->renderer; | |
1542 if (!renderer->DirtyTexture) { | |
1543 return; | |
1544 } | |
1676
e136f3ffdc1b
Adding software renderer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
1672
diff
changeset
|
1545 renderer->DirtyTexture(renderer, texture, numrects, rects); |
1670 | 1546 } |
1547 | |
1548 void | |
1549 SDL_SelectRenderTexture(SDL_TextureID textureID) | |
1550 { | |
1551 SDL_Texture *texture = SDL_GetTextureFromID(textureID); | |
1552 SDL_Renderer *renderer; | |
1553 | |
1554 if (!texture || texture->access != SDL_TextureAccess_Render) { | |
1555 return; | |
1556 } | |
1557 renderer = texture->renderer; | |
1558 if (!renderer->SelectRenderTexture) { | |
1559 return; | |
1560 } | |
1676
e136f3ffdc1b
Adding software renderer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
1672
diff
changeset
|
1561 renderer->SelectRenderTexture(renderer, texture); |
1670 | 1562 } |
1563 | |
1564 int | |
1681
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1565 SDL_RenderFill(const SDL_Rect * rect, Uint32 color) |
1670 | 1566 { |
1567 SDL_Renderer *renderer; | |
1684
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1568 SDL_Rect full_rect; |
1670 | 1569 |
1570 if (!_this) { | |
1571 return -1; | |
1572 } | |
1573 | |
1574 renderer = SDL_CurrentDisplay.current_renderer; | |
1575 if (!renderer || !renderer->RenderFill) { | |
1576 return -1; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1577 } |
910
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
883
diff
changeset
|
1578 |
1684
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1579 if (!rect) { |
1706
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1580 SDL_Window *window = SDL_GetWindowFromID(renderer->window); |
1684
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1581 full_rect.x = 0; |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1582 full_rect.y = 0; |
1706
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1583 full_rect.w = window->w; |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1584 full_rect.h = window->h; |
1684
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1585 rect = &full_rect; |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1586 } |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1587 |
1676
e136f3ffdc1b
Adding software renderer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
1672
diff
changeset
|
1588 renderer->RenderFill(renderer, rect, color); |
1670 | 1589 } |
1590 | |
1591 int | |
1681
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1592 SDL_RenderCopy(SDL_TextureID textureID, const SDL_Rect * srcrect, |
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1593 const SDL_Rect * dstrect, int blendMode, int scaleMode) |
1670 | 1594 { |
1595 SDL_Texture *texture = SDL_GetTextureFromID(textureID); | |
1596 SDL_Renderer *renderer; | |
1684
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1597 SDL_Rect full_srcrect; |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1598 SDL_Rect full_dstrect; |
1670 | 1599 |
1600 if (!texture || texture->renderer != SDL_CurrentDisplay.current_renderer) { | |
1601 return; | |
1602 } | |
1603 | |
1604 renderer = SDL_CurrentDisplay.current_renderer; | |
1605 if (!renderer || !renderer->RenderCopy) { | |
1606 return -1; | |
1607 } | |
1608 | |
1684
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1609 if (!srcrect) { |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1610 full_srcrect.x = 0; |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1611 full_srcrect.y = 0; |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1612 full_srcrect.w = texture->w; |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1613 full_srcrect.h = texture->h; |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1614 srcrect = &full_srcrect; |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1615 } |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1616 if (!dstrect) { |
1706
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1617 SDL_Window *window = SDL_GetWindowFromID(renderer->window); |
1684
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1618 full_dstrect.x = 0; |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1619 full_dstrect.y = 0; |
1706
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1620 full_dstrect.w = window->w; |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1621 full_dstrect.h = window->h; |
1684
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1622 dstrect = &full_dstrect; |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1623 } |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1624 |
1676
e136f3ffdc1b
Adding software renderer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
1672
diff
changeset
|
1625 return renderer->RenderCopy(renderer, texture, srcrect, dstrect, |
e136f3ffdc1b
Adding software renderer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
1672
diff
changeset
|
1626 blendMode, scaleMode); |
1670 | 1627 } |
1628 | |
1629 int | |
1681
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1630 SDL_RenderReadPixels(const SDL_Rect * rect, void *pixels, int pitch) |
1670 | 1631 { |
1632 SDL_Renderer *renderer; | |
1684
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1633 SDL_Rect full_rect; |
1670 | 1634 |
1635 if (!_this) { | |
1636 return -1; | |
1637 } | |
1638 | |
1639 renderer = SDL_CurrentDisplay.current_renderer; | |
1640 if (!renderer || !renderer->RenderReadPixels) { | |
1641 return -1; | |
1642 } | |
1643 | |
1684
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1644 if (!rect) { |
1706
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1645 SDL_Window *window = SDL_GetWindowFromID(renderer->window); |
1684
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1646 full_rect.x = 0; |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1647 full_rect.y = 0; |
1706
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1648 full_rect.w = window->w; |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1649 full_rect.h = window->h; |
1684
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1650 rect = &full_rect; |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1651 } |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1652 |
1676
e136f3ffdc1b
Adding software renderer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
1672
diff
changeset
|
1653 return renderer->RenderReadPixels(renderer, rect, pixels, pitch); |
1670 | 1654 } |
1655 | |
1656 int | |
1681
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1657 SDL_RenderWritePixels(const SDL_Rect * rect, const void *pixels, int pitch) |
1670 | 1658 { |
1659 SDL_Renderer *renderer; | |
1684
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1660 SDL_Rect full_rect; |
1670 | 1661 |
1662 if (!_this) { | |
1663 return -1; | |
1664 } | |
1665 | |
1666 renderer = SDL_CurrentDisplay.current_renderer; | |
1667 if (!renderer || !renderer->RenderWritePixels) { | |
1668 return -1; | |
1669 } | |
1670 | |
1684
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1671 if (!rect) { |
1706
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1672 SDL_Window *window = SDL_GetWindowFromID(renderer->window); |
1684
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1673 full_rect.x = 0; |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1674 full_rect.y = 0; |
1706
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1675 full_rect.w = window->w; |
1577404809f0
Added a multi-window version of testsprite using the new API.
Sam Lantinga <slouken@libsdl.org>
parents:
1684
diff
changeset
|
1676 full_rect.h = window->h; |
1684
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1677 rect = &full_rect; |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1678 } |
c4aa1a2f48f1
Software YUV texture support in progress...
Sam Lantinga <slouken@libsdl.org>
parents:
1683
diff
changeset
|
1679 |
1676
e136f3ffdc1b
Adding software renderer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
1672
diff
changeset
|
1680 return renderer->RenderWritePixels(renderer, rect, pixels, pitch); |
1670 | 1681 } |
1682 | |
1683 void | |
1684 SDL_RenderPresent(void) | |
1685 { | |
1686 SDL_Renderer *renderer; | |
1687 | |
1688 if (!_this) { | |
1689 return; | |
1690 } | |
1691 | |
1692 renderer = SDL_CurrentDisplay.current_renderer; | |
1693 if (!renderer || !renderer->RenderPresent) { | |
1694 return; | |
1695 } | |
650
fe445b59d307
We need to lookup the address of glGetString before calling GL_MakeCurrent(),
Ryan C. Gordon <icculus@icculus.org>
parents:
630
diff
changeset
|
1696 |
1676
e136f3ffdc1b
Adding software renderer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
1672
diff
changeset
|
1697 renderer->RenderPresent(renderer); |
1670 | 1698 } |
1699 | |
1700 void | |
1701 SDL_DestroyTexture(SDL_TextureID textureID) | |
1702 { | |
1703 int hash; | |
1704 SDL_Texture *prev, *texture; | |
1705 SDL_Renderer *renderer; | |
1706 | |
1707 if (!_this) { | |
1708 return; | |
1709 } | |
1710 | |
1711 /* Look up the texture in the hash table */ | |
1712 hash = (textureID % SDL_arraysize(SDL_CurrentDisplay.textures)); | |
1713 prev = NULL; | |
1714 for (texture = SDL_CurrentDisplay.textures[hash]; texture; | |
1715 prev = texture, texture = texture->next) { | |
1716 if (texture->id == textureID) { | |
1717 break; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1718 } |
1670 | 1719 } |
1720 if (!texture) { | |
1721 return; | |
1722 } | |
1723 | |
1724 /* Unlink the texture from the list */ | |
1725 if (prev) { | |
1726 prev->next = texture->next; | |
1727 } else { | |
1728 SDL_CurrentDisplay.textures[hash] = texture->next; | |
1729 } | |
1669
9857d21967bb
The test programs compile again.
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
1730 |
1670 | 1731 /* Free the texture */ |
1732 renderer = texture->renderer; | |
1676
e136f3ffdc1b
Adding software renderer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
1672
diff
changeset
|
1733 renderer->DestroyTexture(renderer, texture); |
1670 | 1734 SDL_free(texture); |
1735 } | |
1736 | |
1737 void | |
1738 SDL_DestroyRenderer(SDL_WindowID windowID) | |
1739 { | |
1740 SDL_Window *window = SDL_GetWindowFromID(windowID); | |
1741 SDL_Renderer *renderer; | |
1742 int i; | |
1743 | |
1744 if (!window) { | |
1745 return; | |
1746 } | |
0 | 1747 |
1670 | 1748 renderer = window->renderer; |
1749 if (!renderer) { | |
1750 return; | |
1751 } | |
1752 | |
1753 /* Free existing textures for this renderer */ | |
1754 for (i = 0; i < SDL_arraysize(SDL_CurrentDisplay.textures); ++i) { | |
1755 SDL_Texture *texture; | |
1756 SDL_Texture *prev = NULL; | |
1757 SDL_Texture *next; | |
1758 for (texture = SDL_CurrentDisplay.textures[i]; texture; | |
1759 texture = next) { | |
1760 next = texture->next; | |
1761 if (texture->renderer == renderer) { | |
1762 if (prev) { | |
1763 prev->next = next; | |
1764 } else { | |
1765 SDL_CurrentDisplay.textures[i] = next; | |
1766 } | |
1676
e136f3ffdc1b
Adding software renderer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
1672
diff
changeset
|
1767 renderer->DestroyTexture(renderer, texture); |
1670 | 1768 SDL_free(texture); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1769 } else { |
1670 | 1770 prev = texture; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1771 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1772 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1773 } |
0 | 1774 |
1670 | 1775 /* Free the renderer instance */ |
1776 renderer->DestroyRenderer(renderer); | |
0 | 1777 |
1670 | 1778 /* Clear references */ |
1779 window->renderer = NULL; | |
1780 if (SDL_CurrentDisplay.current_renderer == renderer) { | |
1781 SDL_CurrentDisplay.current_renderer = NULL; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1782 } |
0 | 1783 } |
1784 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1785 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1786 SDL_VideoQuit(void) |
0 | 1787 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1788 int i, j; |
0 | 1789 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1790 if (!_this) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1791 return; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1792 } |
0 | 1793 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1794 /* Halt event processing before doing anything else */ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1795 SDL_StopEventLoop(); |
0 | 1796 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1797 /* Clean up the system video */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1798 for (i = _this->num_displays; i--;) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1799 SDL_VideoDisplay *display = &_this->displays[i]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1800 for (j = display->num_windows; j--;) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1801 SDL_DestroyWindow(display->windows[i].id); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1802 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1803 if (display->windows) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1804 SDL_free(display->windows); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1805 display->windows = NULL; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1806 } |
1683
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
1807 if (display->palette) { |
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
1808 SDL_FreePalette(display->palette); |
396a35389351
Finished palettized display handling.
Sam Lantinga <slouken@libsdl.org>
parents:
1682
diff
changeset
|
1809 display->palette = NULL; |
1681
80a5e6a4e1e2
Working on paletted display and texture support (two different issues)
Sam Lantinga <slouken@libsdl.org>
parents:
1680
diff
changeset
|
1810 } |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1811 } |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1812 _this->VideoQuit(_this); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1813 if (_this->displays) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1814 SDL_free(_this->displays); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1815 } |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1816 _this->free(_this); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1817 _this = NULL; |
0 | 1818 } |
1819 | |
1820 /* Load the GL driver library */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1821 int |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1822 SDL_GL_LoadLibrary(const char *path) |
0 | 1823 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1824 int retval; |
0 | 1825 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1826 retval = -1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1827 if (_this == NULL) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1828 SDL_SetError("Video subsystem has not been initialized"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1829 } else { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1830 if (_this->GL_LoadLibrary) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1831 retval = _this->GL_LoadLibrary(_this, path); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1832 } else { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1833 SDL_SetError("No dynamic GL support in video driver"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1834 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1835 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1836 return (retval); |
0 | 1837 } |
1838 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1839 void * |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1840 SDL_GL_GetProcAddress(const char *proc) |
0 | 1841 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1842 void *func; |
0 | 1843 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1844 func = NULL; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1845 if (_this->GL_GetProcAddress) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1846 if (_this->gl_config.driver_loaded) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1847 func = _this->GL_GetProcAddress(_this, proc); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1848 } else { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1849 SDL_SetError("No GL driver has been loaded"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1850 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1851 } else { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1852 SDL_SetError("No dynamic GL support in video driver"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1853 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1854 return func; |
0 | 1855 } |
1856 | |
1857 /* Set the specified GL attribute for setting up a GL video mode */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1858 int |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1859 SDL_GL_SetAttribute(SDL_GLattr attr, int value) |
0 | 1860 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1861 int retval; |
0 | 1862 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1863 retval = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1864 switch (attr) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1865 case SDL_GL_RED_SIZE: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1866 _this->gl_config.red_size = value; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1867 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1868 case SDL_GL_GREEN_SIZE: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1869 _this->gl_config.green_size = value; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1870 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1871 case SDL_GL_BLUE_SIZE: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1872 _this->gl_config.blue_size = value; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1873 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1874 case SDL_GL_ALPHA_SIZE: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1875 _this->gl_config.alpha_size = value; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1876 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1877 case SDL_GL_DOUBLEBUFFER: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1878 _this->gl_config.double_buffer = value; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1879 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1880 case SDL_GL_BUFFER_SIZE: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1881 _this->gl_config.buffer_size = value; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1882 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1883 case SDL_GL_DEPTH_SIZE: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1884 _this->gl_config.depth_size = value; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1885 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1886 case SDL_GL_STENCIL_SIZE: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1887 _this->gl_config.stencil_size = value; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1888 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1889 case SDL_GL_ACCUM_RED_SIZE: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1890 _this->gl_config.accum_red_size = value; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1891 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1892 case SDL_GL_ACCUM_GREEN_SIZE: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1893 _this->gl_config.accum_green_size = value; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1894 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1895 case SDL_GL_ACCUM_BLUE_SIZE: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1896 _this->gl_config.accum_blue_size = value; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1897 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1898 case SDL_GL_ACCUM_ALPHA_SIZE: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1899 _this->gl_config.accum_alpha_size = value; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1900 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1901 case SDL_GL_STEREO: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1902 _this->gl_config.stereo = value; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1903 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1904 case SDL_GL_MULTISAMPLEBUFFERS: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1905 _this->gl_config.multisamplebuffers = value; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1906 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1907 case SDL_GL_MULTISAMPLESAMPLES: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1908 _this->gl_config.multisamplesamples = value; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1909 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1910 case SDL_GL_ACCELERATED_VISUAL: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1911 _this->gl_config.accelerated = value; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1912 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1913 case SDL_GL_SWAP_CONTROL: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1914 _this->gl_config.swap_control = value; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1915 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1916 default: |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1917 SDL_SetError("Unknown OpenGL attribute"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1918 retval = -1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1919 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1920 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1921 return (retval); |
0 | 1922 } |
1923 | |
1924 /* Retrieve an attribute value from the windowing system. */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1925 int |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1926 SDL_GL_GetAttribute(SDL_GLattr attr, int *value) |
0 | 1927 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1928 int retval = -1; |
0 | 1929 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1930 if (_this->GL_GetAttribute) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1931 retval = _this->GL_GetAttribute(_this, attr, value); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1932 } else { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1933 *value = 0; |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1934 SDL_SetError("GL_GetAttribute not supported"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1935 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1936 return retval; |
0 | 1937 } |
1938 | |
1939 /* Perform a GL buffer swap on the current GL context */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1940 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1941 SDL_GL_SwapBuffers(void) |
0 | 1942 { |
1670 | 1943 // FIXME: Track the current window context - do we provide N contexts, and match them to M windows, or is there a one-to-one mapping? |
1944 _this->GL_SwapBuffers(_this); | |
0 | 1945 } |
1946 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1947 #if 0 // FIXME |
541
796f2fe699be
Support 1-bit alpha on surfaces passed to SDL_WM_SetIcon() (thanks Glenn!)
Sam Lantinga <slouken@libsdl.org>
parents:
509
diff
changeset
|
1948 /* Utility function used by SDL_WM_SetIcon(); |
796f2fe699be
Support 1-bit alpha on surfaces passed to SDL_WM_SetIcon() (thanks Glenn!)
Sam Lantinga <slouken@libsdl.org>
parents:
509
diff
changeset
|
1949 * flags & 1 for color key, flags & 2 for alpha channel. */ |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1950 static void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1951 CreateMaskFromColorKeyOrAlpha(SDL_Surface * icon, Uint8 * mask, int flags) |
0 | 1952 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1953 int x, y; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1954 Uint32 colorkey; |
0 | 1955 #define SET_MASKBIT(icon, x, y, mask) \ |
1956 mask[(y*((icon->w+7)/8))+(x/8)] &= ~(0x01<<(7-(x%8))) | |
1957 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1958 colorkey = icon->format->colorkey; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1959 switch (icon->format->BytesPerPixel) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1960 case 1: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1961 { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1962 Uint8 *pixels; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1963 for (y = 0; y < icon->h; ++y) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1964 pixels = (Uint8 *) icon->pixels + y * icon->pitch; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1965 for (x = 0; x < icon->w; ++x) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1966 if (*pixels++ == colorkey) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1967 SET_MASKBIT(icon, x, y, mask); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1968 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1969 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1970 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1971 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1972 break; |
0 | 1973 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1974 case 2: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1975 { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1976 Uint16 *pixels; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1977 for (y = 0; y < icon->h; ++y) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1978 pixels = (Uint16 *) icon->pixels + y * icon->pitch / 2; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1979 for (x = 0; x < icon->w; ++x) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1980 if ((flags & 1) && *pixels == colorkey) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1981 SET_MASKBIT(icon, x, y, mask); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1982 } else if ((flags & 2) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1983 && (*pixels & icon->format->Amask) == 0) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1984 SET_MASKBIT(icon, x, y, mask); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1985 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1986 pixels++; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1987 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1988 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1989 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1990 break; |
0 | 1991 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1992 case 4: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1993 { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1994 Uint32 *pixels; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1995 for (y = 0; y < icon->h; ++y) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1996 pixels = (Uint32 *) icon->pixels + y * icon->pitch / 4; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1997 for (x = 0; x < icon->w; ++x) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
1998 if ((flags & 1) && *pixels == colorkey) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
1999 SET_MASKBIT(icon, x, y, mask); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2000 } else if ((flags & 2) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2001 && (*pixels & icon->format->Amask) == 0) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
2002 SET_MASKBIT(icon, x, y, mask); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2003 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2004 pixels++; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2005 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2006 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2007 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2008 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2009 } |
0 | 2010 } |
2011 | |
2012 /* | |
2013 * Sets the window manager icon for the display window. | |
2014 */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2015 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
2016 SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask) |
0 | 2017 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2018 if (icon && _this->SetIcon) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2019 /* Generate a mask if necessary, and create the icon! */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2020 if (mask == NULL) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2021 int mask_len = icon->h * (icon->w + 7) / 8; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2022 int flags = 0; |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
2023 mask = (Uint8 *) SDL_malloc(mask_len); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2024 if (mask == NULL) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2025 return; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2026 } |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
2027 SDL_memset(mask, ~0, mask_len); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2028 if (icon->flags & SDL_SRCCOLORKEY) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2029 flags |= 1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2030 if (icon->flags & SDL_SRCALPHA) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2031 flags |= 2; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2032 if (flags) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
2033 CreateMaskFromColorKeyOrAlpha(icon, mask, flags); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2034 } |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
2035 _this->SetIcon(_this, icon, mask); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
2036 SDL_free(mask); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2037 } else { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
2038 _this->SetIcon(_this, icon, mask); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2039 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2040 } |
0 | 2041 } |
2042 #endif | |
2043 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2044 SDL_bool |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
2045 SDL_GetWindowWMInfo(SDL_WindowID windowID, SDL_SysWMinfo * info) |
0 | 2046 { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
2047 SDL_Window *window = SDL_GetWindowFromID(windowID); |
0 | 2048 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2049 if (!window || !_this->GetWindowWMInfo) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2050 return SDL_FALSE; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2051 } |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1667
diff
changeset
|
2052 return (_this->GetWindowWMInfo(_this, window, info)); |
0 | 2053 } |
2054 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
2055 /* vi: set ts=4 sw=4 expandtab: */ |