Mercurial > sdl-ios-xcode
annotate src/video/cybergfx/SDL_cgxvideo.c @ 1432:0801c9fdbdd6
*** empty log message ***
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 25 Feb 2006 20:48:26 +0000 |
parents | d910939febfa |
children | 8d9bb0cf2c2a |
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:
255
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:
255
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:
255
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:
255
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:
255
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:
255
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:
255
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:
21
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:
1361
diff
changeset
|
22 #include "SDL_config.h" |
0 | 23 |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
24 /* |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
25 * CGX based SDL video driver implementation by Gabriele Greco |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
26 * gabriele.greco@aruba.it |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
27 */ |
0 | 28 |
1358
c71e05b4dc2e
More header massaging... works great on Windows. ;-)
Sam Lantinga <slouken@libsdl.org>
parents:
1338
diff
changeset
|
29 #include "SDL_endian.h" |
0 | 30 #include "SDL_timer.h" |
31 #include "SDL_thread.h" | |
32 #include "SDL_video.h" | |
33 #include "SDL_mouse.h" | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
34 #include "../SDL_sysvideo.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
35 #include "../SDL_pixels_c.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
36 #include "../../events/SDL_events_c.h" |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
37 #include "SDL_cgxgl_c.h" |
0 | 38 #include "SDL_cgxvideo.h" |
39 #include "SDL_cgxwm_c.h" | |
40 #include "SDL_amigamouse_c.h" | |
41 #include "SDL_amigaevents_c.h" | |
42 #include "SDL_cgxmodes_c.h" | |
43 #include "SDL_cgximage_c.h" | |
44 | |
45 /* Initialization/Query functions */ | |
46 static int CGX_VideoInit(_THIS, SDL_PixelFormat *vformat); | |
47 static SDL_Surface *CGX_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags); | |
48 static int CGX_ToggleFullScreen(_THIS, int on); | |
49 static void CGX_UpdateMouse(_THIS); | |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
50 static int CGX_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors); |
0 | 51 static void CGX_VideoQuit(_THIS); |
52 | |
53 /* CGX driver bootstrap functions */ | |
54 | |
55 struct Library *CyberGfxBase=NULL; | |
56 struct IntuitionBase *IntuitionBase=NULL; | |
57 struct GfxBase *GfxBase=NULL; | |
58 | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
59 int CGX_SetGamma(_THIS, float red, float green, float blue) |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
60 { |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
61 SDL_SetError("Gamma correction not supported"); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
62 return -1; |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
63 } |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
64 |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
65 int CGX_GetGamma(_THIS, float red, float green, float blue) |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
66 { |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
67 SDL_SetError("Gamma correction not supported"); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
68 return -1; |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
69 } |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
70 |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
71 int CGX_SetGammaRamp(_THIS, Uint16 *ramp) |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
72 { |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
73 #if 0 |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
74 Int i, ncolors; |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
75 XColor xcmap[256]; |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
76 |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
77 /* See if actually setting the gamma is supported */ |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
78 if ( SDL_Visual->class != DirectColor ) { |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
79 SDL_SetError("Gamma correction not supported on this visual"); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
80 return(-1); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
81 } |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
82 |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
83 /* Calculate the appropriate palette for the given gamma ramp */ |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
84 ncolors = SDL_Visual->map_entries; |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
85 for ( i=0; i<ncolors; ++i ) { |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
86 Uint8 c = (256 * i / ncolors); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
87 xcmap[i].pixel = SDL_MapRGB(this->screen->format, c, c, c); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
88 xcmap[i].red = ramp[0*256+c]; |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
89 xcmap[i].green = ramp[1*256+c]; |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
90 xcmap[i].blue = ramp[2*256+c]; |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
91 xcmap[i].flags = (DoRed|DoGreen|DoBlue); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
92 } |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
93 XStoreColors(GFX_Display, SDL_XColorMap, xcmap, ncolors); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
94 XSync(GFX_Display, False); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
95 |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
96 return(0); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
97 |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
98 #else |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
99 SDL_SetError("Gamma correction not supported on this visual"); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
100 return(-1); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
101 |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
102 #endif |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
103 } |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
104 |
0 | 105 static void DestroyScreen(_THIS) |
106 { | |
107 if(currently_fullscreen) | |
108 { | |
109 if(this->hidden->dbuffer) | |
110 { | |
111 extern struct MsgPort *safeport,*dispport; | |
112 | |
113 this->hidden->dbuffer=0; | |
114 | |
115 if(safeport) | |
116 { | |
117 while(GetMsg(safeport)!=NULL); | |
118 DeleteMsgPort(safeport); | |
119 } | |
120 if(dispport) | |
121 { | |
122 while(GetMsg(dispport)!=NULL); | |
123 DeleteMsgPort(dispport); | |
124 } | |
125 | |
126 this->hidden->SB[0]->sb_DBufInfo->dbi_SafeMessage.mn_ReplyPort=this->hidden->SB[0]->sb_DBufInfo->dbi_DispMessage.mn_ReplyPort=NULL; | |
127 this->hidden->SB[1]->sb_DBufInfo->dbi_SafeMessage.mn_ReplyPort=this->hidden->SB[1]->sb_DBufInfo->dbi_DispMessage.mn_ReplyPort=NULL; | |
128 | |
129 if(this->hidden->SB[1]) | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
130 FreeScreenBuffer(SDL_Display,this->hidden->SB[1]); |
0 | 131 if(this->hidden->SB[0]) |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
132 FreeScreenBuffer(SDL_Display,this->hidden->SB[0]); |
0 | 133 |
134 | |
135 this->hidden->SB[0]=this->hidden->SB[1]=NULL; | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
136 |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
137 if(SDL_RastPort && SDL_RastPort != &SDL_Display->RastPort) |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
138 SDL_free(SDL_RastPort); |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
139 |
0 | 140 SDL_RastPort=NULL; |
141 } | |
142 CloseScreen(GFX_Display); | |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
143 currently_fullscreen=0; |
0 | 144 } |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
145 else if(GFX_Display) |
0 | 146 UnlockPubScreen(NULL,GFX_Display); |
147 | |
148 GFX_Display = NULL; | |
149 } | |
150 | |
151 static int CGX_Available(void) | |
152 { | |
153 struct Library *l; | |
154 | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
155 l = OpenLibrary("cybergraphics.library",0L); |
0 | 156 |
157 if ( l != NULL ) { | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
158 D(bug("CGX video device AVAILABLE\n")); |
0 | 159 CloseLibrary(l); |
160 } | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
161 D(else bug("**CGX video device UNAVAILABLE\n")); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
162 |
0 | 163 return(l != NULL); |
164 } | |
165 | |
166 static void CGX_DeleteDevice(SDL_VideoDevice *device) | |
167 { | |
168 if ( device ) { | |
169 if ( device->hidden ) { | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
170 SDL_free(device->hidden); |
0 | 171 } |
172 if ( device->gl_data ) { | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
173 SDL_free(device->gl_data); |
0 | 174 } |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
175 SDL_free(device); |
0 | 176 } |
177 } | |
178 | |
179 static SDL_VideoDevice *CGX_CreateDevice(int devindex) | |
180 { | |
181 SDL_VideoDevice *device; | |
182 | |
183 /* Initialize all variables that we clean on shutdown */ | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
184 device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice)); |
0 | 185 if ( device ) { |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
186 SDL_memset(device, 0, (sizeof *device)); |
0 | 187 device->hidden = (struct SDL_PrivateVideoData *) |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
188 SDL_malloc((sizeof *device->hidden)); |
0 | 189 device->gl_data = (struct SDL_PrivateGLData *) |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
190 SDL_malloc((sizeof *device->gl_data)); |
0 | 191 } |
192 if ( (device == NULL) || (device->hidden == NULL) || | |
193 (device->gl_data == NULL) ) { | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
194 D(bug("Unable to create video device!\n")); |
0 | 195 SDL_OutOfMemory(); |
196 CGX_DeleteDevice(device); | |
197 return(0); | |
198 } | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
199 SDL_memset(device->hidden, 0, sizeof(*device->hidden)); |
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
200 SDL_memset(device->gl_data, 0, sizeof(*device->gl_data)); |
0 | 201 |
202 /* Set the driver flags */ | |
203 device->handles_any_size = 1; | |
204 | |
205 /* Set the function pointers */ | |
206 device->VideoInit = CGX_VideoInit; | |
207 device->ListModes = CGX_ListModes; | |
208 device->SetVideoMode = CGX_SetVideoMode; | |
209 device->ToggleFullScreen = CGX_ToggleFullScreen; | |
210 device->UpdateMouse = CGX_UpdateMouse; | |
211 device->SetColors = CGX_SetColors; | |
212 device->UpdateRects = NULL; | |
213 device->VideoQuit = CGX_VideoQuit; | |
214 device->AllocHWSurface = CGX_AllocHWSurface; | |
215 device->CheckHWBlit = CGX_CheckHWBlit; | |
216 device->FillHWRect = CGX_FillHWRect; | |
217 device->SetHWColorKey = CGX_SetHWColorKey; | |
218 device->SetHWAlpha = NULL; | |
219 device->LockHWSurface = CGX_LockHWSurface; | |
220 device->UnlockHWSurface = CGX_UnlockHWSurface; | |
221 device->FlipHWSurface = CGX_FlipHWSurface; | |
222 device->FreeHWSurface = CGX_FreeHWSurface; | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
223 device->SetGamma = CGX_SetGamma; |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
224 device->GetGamma = CGX_GetGamma; |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
225 device->SetGammaRamp = CGX_SetGammaRamp; |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
226 device->GetGammaRamp = NULL; |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
227 #if SDL_VIDEO_OPENGL |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
228 device->GL_LoadLibrary = CGX_GL_LoadLibrary; |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
229 device->GL_GetProcAddress = CGX_GL_GetProcAddress; |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
230 device->GL_GetAttribute = CGX_GL_GetAttribute; |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
231 device->GL_MakeCurrent = CGX_GL_MakeCurrent; |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
232 device->GL_SwapBuffers = CGX_GL_SwapBuffers; |
0 | 233 #endif |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
234 device->SetIcon = CGX_SetIcon; |
0 | 235 device->SetCaption = CGX_SetCaption; |
236 device->IconifyWindow = NULL; /* CGX_IconifyWindow; */ | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
237 device->GrabInput = NULL /* CGX_GrabInput*/; |
0 | 238 device->GetWMInfo = CGX_GetWMInfo; |
239 device->FreeWMCursor = amiga_FreeWMCursor; | |
240 device->CreateWMCursor = amiga_CreateWMCursor; | |
241 device->ShowWMCursor = amiga_ShowWMCursor; | |
242 device->WarpWMCursor = amiga_WarpWMCursor; | |
243 device->CheckMouseMode = amiga_CheckMouseMode; | |
244 device->InitOSKeymap = amiga_InitOSKeymap; | |
245 device->PumpEvents = amiga_PumpEvents; | |
246 | |
247 device->free = CGX_DeleteDevice; | |
248 | |
249 return device; | |
250 } | |
251 | |
252 VideoBootStrap CGX_bootstrap = { | |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
253 "CGX", "AmigaOS CyberGraphics", CGX_Available, CGX_CreateDevice |
0 | 254 }; |
255 | |
256 Uint32 MakeBitMask(_THIS,int type,int format,int *bpp) | |
257 { | |
258 D(if(type==0)bug("REAL pixel format: ")); | |
259 | |
260 if(this->hidden->depth==*bpp) | |
261 { | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
262 |
0 | 263 switch(format) |
264 { | |
265 case PIXFMT_LUT8: | |
266 D(if(type==0)bug("LUT8\n")); | |
267 return 0; | |
268 case PIXFMT_BGR15: | |
269 case PIXFMT_RGB15PC: | |
270 switch(type) | |
271 { | |
272 case 0: | |
273 D(bug("RGB15PC/BGR15\n")); | |
274 return 31; | |
275 case 1: | |
276 return 992; | |
277 case 2: | |
278 return 31744; | |
279 } | |
280 case PIXFMT_RGB15: | |
281 case PIXFMT_BGR15PC: | |
282 switch(type) | |
283 { | |
284 case 0: | |
285 D(bug("RGB15/BGR15PC\n")); | |
286 return 31744; | |
287 case 1: | |
288 return 992; | |
289 case 2: | |
290 return 31; | |
291 } | |
292 case PIXFMT_BGR16PC: | |
293 case PIXFMT_RGB16: | |
294 switch(type) | |
295 { | |
296 case 0: | |
297 D(bug("RGB16PC\n")); | |
298 return 63488; | |
299 case 1: | |
300 return 2016; | |
301 case 2: | |
302 return 31; | |
303 } | |
304 case PIXFMT_BGR16: | |
305 case PIXFMT_RGB16PC: | |
306 switch(type) | |
307 { | |
308 case 0: | |
309 D(bug("RGB16PC/BGR16\n")); | |
310 return 31; | |
311 case 1: | |
312 return 2016; | |
313 case 2: | |
314 return 63488; | |
315 } | |
316 | |
317 case PIXFMT_RGB24: | |
318 switch(type) | |
319 { | |
320 case 0: | |
321 D(bug("RGB24/BGR24\n")); | |
322 return 0xff0000; | |
323 case 1: | |
324 return 0xff00; | |
325 case 2: | |
326 return 0xff; | |
327 } | |
328 case PIXFMT_BGR24: | |
329 switch(type) | |
330 { | |
331 case 0: | |
332 D(bug("BGR24\n")); | |
333 return 0xff; | |
334 case 1: | |
335 return 0xff00; | |
336 case 2: | |
337 return 0xff0000; | |
338 } | |
339 case PIXFMT_ARGB32: | |
340 switch(type) | |
341 { | |
342 case 0: | |
343 D(bug("ARGB32\n")); | |
344 return 0xff0000; | |
345 case 1: | |
346 return 0xff00; | |
347 case 2: | |
348 return 0xff; | |
349 } | |
350 case PIXFMT_BGRA32: | |
351 switch(type) | |
352 { | |
353 case 0: | |
354 D(bug("BGRA32\n")); | |
355 return 0xff00; | |
356 case 1: | |
357 return 0xff0000; | |
358 case 2: | |
359 return 0xff000000; | |
360 } | |
361 case PIXFMT_RGBA32: | |
362 switch(type) | |
363 { | |
364 case 0: | |
365 D(bug("RGBA32\n")); | |
366 return 0xff000000; | |
367 case 1: | |
368 return 0xff0000; | |
369 case 2: | |
370 return 0xff00; | |
371 } | |
372 default: | |
373 D(bug("Unknown pixel format! Default to 24bit\n")); | |
374 return (Uint32) (255<<(type*8)); | |
375 } | |
376 } | |
377 else | |
378 { | |
379 D(if(type==0)bug("DIFFERENT from screen.\nAllocated screen format: ")); | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
380 |
0 | 381 switch(*bpp) |
382 { | |
383 case 32: | |
384 D(if(type==0) bug("RGBA32\n")); | |
385 switch(type) | |
386 { | |
387 case 0: | |
388 return 0xff000000; | |
389 case 1: | |
390 return 0xff0000; | |
391 case 2: | |
392 return 0xff00; | |
393 } | |
394 break; | |
395 case 24: | |
396 use_truecolor: | |
397 switch(type) | |
398 { | |
399 case 0: | |
400 D(bug("RGB24\n")); | |
401 return 0xff0000; | |
402 case 1: | |
403 return 0xff00; | |
404 case 2: | |
405 return 0xff; | |
406 } | |
407 case 16: | |
408 case 15: | |
409 D(if(type==0) bug("Not supported, switching to 24bit!\n")); | |
410 *bpp=24; | |
411 goto use_truecolor; | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
412 break; |
0 | 413 default: |
414 D(if(type==0)bug("This is a chunky display\n")); | |
415 // For chunky display mask is always 0; | |
416 return 0; | |
417 } | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
418 } |
0 | 419 return 0; |
420 } | |
421 | |
422 static int CGX_VideoInit(_THIS, SDL_PixelFormat *vformat) | |
423 { | |
424 int i; | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
425 struct Library *RTGBase; |
0 | 426 |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
427 D(bug("VideoInit... Opening libraries\n")); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
428 |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
429 if(!IntuitionBase) { |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
430 if( !(IntuitionBase=(struct IntuitionBase *)OpenLibrary("intuition.library",39L))) { |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
431 SDL_SetError("Couldn't open intuition V39+"); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
432 return -1; |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
433 } |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
434 } |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
435 |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
436 if(!GfxBase) { |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
437 if( !(GfxBase=(struct GfxBase *)OpenLibrary("graphics.library",39L))) { |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
438 SDL_SetError("Couldn't open graphics V39+"); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
439 return -1; |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
440 } |
0 | 441 } |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
442 |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
443 if(!CyberGfxBase) { |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
444 if( !(CyberGfxBase=OpenLibrary("cybergraphics.library",40L))) { |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
445 SDL_SetError("Couldn't open cybergraphics."); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
446 return(-1); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
447 } |
0 | 448 } |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
449 |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
450 if(RTGBase=OpenLibrary("libs:picasso96/rtg.library",0L)) { |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
451 extern int use_picasso96; |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
452 |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
453 CloseLibrary(RTGBase); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
454 use_picasso96=1; |
0 | 455 } |
456 | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
457 D(bug("Library intialized, locking screen...\n")); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
458 |
0 | 459 SDL_Display = LockPubScreen(NULL); |
460 | |
461 if ( SDL_Display == NULL ) { | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
462 D(bug("Cannot lock display...\n")); |
0 | 463 SDL_SetError("Couldn't lock the display"); |
464 return(-1); | |
465 } | |
466 | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
467 D(bug("Checking if we are using a CGX native display...\n")); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
468 |
0 | 469 if(!IsCyberModeID(GetVPModeID(&SDL_Display->ViewPort))) |
470 { | |
471 Uint32 okid=BestCModeIDTags(CYBRBIDTG_NominalWidth,SDL_Display->Width, | |
472 CYBRBIDTG_NominalHeight,SDL_Display->Height, | |
473 CYBRBIDTG_Depth,8, | |
474 TAG_DONE); | |
475 | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
476 D(bug("Default visual is not CGX native!\n")); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
477 |
0 | 478 UnlockPubScreen(NULL,SDL_Display); |
479 | |
480 GFX_Display=NULL; | |
481 | |
482 if(okid!=INVALID_ID) | |
483 { | |
484 GFX_Display=OpenScreenTags(NULL, | |
485 SA_Width,SDL_Display->Width, | |
486 SA_Height,SDL_Display->Height, | |
487 SA_Depth,8,SA_Quiet,TRUE, | |
488 SA_ShowTitle,FALSE, | |
489 SA_DisplayID,okid, | |
490 TAG_DONE); | |
491 } | |
492 | |
493 if(!GFX_Display) | |
494 { | |
495 SDL_SetError("Unable to open a suited CGX display"); | |
496 return -1; | |
497 } | |
498 else SDL_Display=GFX_Display; | |
499 | |
500 } | |
501 else GFX_Display = SDL_Display; | |
502 | |
503 | |
504 /* See whether or not we need to swap pixels */ | |
505 | |
506 swap_pixels = 0; | |
507 | |
508 // Non e' detto che sia cosi' pero', alcune schede potrebbero gestire i modi in modo differente | |
509 | |
510 if ( SDL_BYTEORDER == SDL_LIL_ENDIAN ) { | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
511 swap_pixels = 1; |
0 | 512 } |
513 | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
514 D(bug("Before GetVideoModes....\n")); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
515 |
0 | 516 /* Get the available video modes */ |
517 if(CGX_GetVideoModes(this) < 0) | |
518 return -1; | |
519 | |
520 /* Determine the default screen depth: | |
521 Use the default visual (or at least one with the same depth) */ | |
522 | |
523 for(i = 0; i < this->hidden->nvisuals; i++) | |
524 if(this->hidden->visuals[i].depth == GetCyberMapAttr(SDL_Display->RastPort.BitMap,CYBRMATTR_DEPTH)) | |
525 break; | |
526 if(i == this->hidden->nvisuals) { | |
527 /* default visual was useless, take the deepest one instead */ | |
528 i = 0; | |
529 } | |
530 SDL_Visual = this->hidden->visuals[i].visual; | |
531 | |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
532 // SDL_XColorMap = SDL_DisplayColormap; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
533 |
0 | 534 this->hidden->depth = this->hidden->visuals[i].depth; |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
535 D(bug("Init: Setting screen depth to: %ld\n",this->hidden->depth)); |
0 | 536 vformat->BitsPerPixel = this->hidden->visuals[i].depth; /* this->hidden->visuals[i].bpp; */ |
537 | |
538 { | |
539 int form; | |
540 APTR handle; | |
541 struct DisplayInfo info; | |
542 | |
543 if(!(handle=FindDisplayInfo(this->hidden->visuals[i].visual))) | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
544 { |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
545 D(bug("Unable to get visual info...\n")); |
0 | 546 return -1; |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
547 } |
0 | 548 |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
549 if(!GetDisplayInfoData(handle,(char *)&info,sizeof(struct DisplayInfo),DTAG_DISP,NULL)) { |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
550 D(bug("Unable to get visual info data...\n")); |
0 | 551 return -1; |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
552 } |
0 | 553 |
554 form=GetCyberIDAttr(CYBRIDATTR_PIXFMT,SDL_Visual); | |
555 | |
556 // In this case I use makebitmask in a way that I'm sure I'll get PIXFMT pixel mask | |
557 | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
558 if ( vformat->BitsPerPixel > 8 ) |
0 | 559 { |
560 vformat->Rmask = MakeBitMask(this,0,form,&this->hidden->depth); | |
561 vformat->Gmask = MakeBitMask(this,1,form,&this->hidden->depth); | |
562 vformat->Bmask = MakeBitMask(this,2,form,&this->hidden->depth); | |
563 } | |
564 } | |
565 | |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
566 /* See if we have been passed a window to use */ |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
567 /* SDL_windowid = SDL_getenv("SDL_WINDOWID"); */ |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
568 SDL_windowid=NULL; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
569 |
0 | 570 /* Create the blank cursor */ |
571 SDL_BlankCursor = AllocMem(16,MEMF_CHIP|MEMF_CLEAR); | |
572 | |
573 /* Fill in some window manager capabilities */ | |
574 this->info.wm_available = 1; | |
575 this->info.blit_hw = 1; | |
576 this->info.blit_hw_CC = 1; | |
577 this->info.blit_sw = 1; | |
578 this->info.blit_fill = 1; | |
579 this->info.video_mem=2000000; // Not always true but almost any Amiga card has this memory! | |
580 | |
581 this->hidden->same_format=0; | |
582 SDL_RastPort=&SDL_Display->RastPort; | |
583 /* We're done! */ | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
584 D(bug("End of CGX_VideoInit\n")); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
585 |
0 | 586 return(0); |
587 } | |
588 | |
589 void CGX_DestroyWindow(_THIS, SDL_Surface *screen) | |
590 { | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
591 D(bug("Destroy Window...\n")); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
592 |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
593 if ( ! SDL_windowid ) { |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
594 /* Hide the managed window */ |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
595 int was_fullscreen=0; |
0 | 596 |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
597 /* Clean up OpenGL */ |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
598 if ( screen ) { |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
599 screen->flags &= ~(SDL_OPENGL|SDL_OPENGLBLIT); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
600 } |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
601 |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
602 if ( screen && (screen->flags & SDL_FULLSCREEN) ) { |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
603 was_fullscreen=1; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
604 screen->flags &= ~SDL_FULLSCREEN; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
605 // CGX_LeaveFullScreen(this); tolto x crash |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
606 } |
0 | 607 |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
608 /* Destroy the output window */ |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
609 if ( SDL_Window ) { |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
610 CloseWindow(SDL_Window); |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
611 SDL_Window=NULL; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
612 } |
0 | 613 |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
614 /* Free the colormap entries */ |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
615 if ( SDL_XPixels ) { |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
616 int numcolors; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
617 unsigned long pixel; |
0 | 618 |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
619 if(this->screen->format&&this->hidden->depth==8&&!was_fullscreen) |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
620 { |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
621 numcolors = 1<<this->screen->format->BitsPerPixel; |
0 | 622 |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
623 if(numcolors>256) |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
624 numcolors=256; |
0 | 625 |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
626 if(!was_fullscreen&&this->hidden->depth==8) |
0 | 627 { |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
628 for ( pixel=0; pixel<numcolors; pixel++ ) |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
629 { |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
630 if(SDL_XPixels[pixel]>=0) |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
631 ReleasePen(GFX_Display->ViewPort.ColorMap,SDL_XPixels[pixel]); |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
632 } |
0 | 633 } |
634 } | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
635 SDL_free(SDL_XPixels); |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
636 SDL_XPixels = NULL; |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
637 } |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
638 } |
0 | 639 } |
640 | |
641 static void CGX_SetSizeHints(_THIS, int w, int h, Uint32 flags) | |
642 { | |
643 if ( flags & SDL_RESIZABLE ) { | |
644 WindowLimits(SDL_Window, 32, 32,4096,4096); | |
645 } else { | |
646 WindowLimits(SDL_Window, w,h,w,h); | |
647 } | |
648 if ( flags & SDL_FULLSCREEN ) { | |
649 flags&=~SDL_RESIZABLE; | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
650 } else if ( SDL_getenv("SDL_VIDEO_CENTERED") ) { |
0 | 651 int display_w, display_h; |
652 | |
653 display_w = SDL_Display->Width; | |
654 display_h = SDL_Display->Height; | |
655 ChangeWindowBox(SDL_Window,(display_w - w - SDL_Window->BorderLeft-SDL_Window->BorderRight)/2, | |
656 (display_h - h - SDL_Window->BorderTop-SDL_Window->BorderBottom)/2, | |
657 w+SDL_Window->BorderLeft+SDL_Window->BorderRight, | |
658 h+SDL_Window->BorderTop+SDL_Window->BorderBottom); | |
659 } | |
660 } | |
661 | |
662 int CGX_CreateWindow(_THIS, SDL_Surface *screen, | |
663 int w, int h, int bpp, Uint32 flags) | |
664 { | |
665 #if 0 | |
666 int i, depth; | |
667 Uint32 vis; | |
668 #endif | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
669 D(bug("CGX_CreateWindow\n")); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
670 |
0 | 671 /* If a window is already present, destroy it and start fresh */ |
672 if ( SDL_Window ) { | |
673 CGX_DestroyWindow(this, screen); | |
674 } | |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
675 |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
676 /* See if we have been given a window id */ |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
677 if ( SDL_windowid ) { |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
678 SDL_Window = (struct Window *)atol(SDL_windowid); |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
679 } else { |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
680 SDL_Window = 0; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
681 } |
0 | 682 |
683 /* find out which visual we are going to use */ | |
684 #if 0 | |
685 /* questo l'ho spostato nell'apertura dello schermo, in quanto su Amiga le finestre | |
686 hanno il pixel mode degli schermi. | |
687 */ | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
688 /*if ( flags & SDL_OPENGL ) { |
0 | 689 SDL_SetError("OpenGL not supported by the Amiga SDL!"); |
690 return -1; | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
691 } |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
692 else {*/ |
0 | 693 for ( i = 0; i < this->hidden->nvisuals; i++ ) { |
694 if ( this->hidden->visuals[i].depth == bpp ) /* era .depth */ | |
695 break; | |
696 } | |
697 if ( i == this->hidden->nvisuals ) { | |
698 SDL_SetError("No matching visual for requested depth"); | |
699 return -1; /* should never happen */ | |
700 } | |
701 vis = this->hidden->visuals[i].visual; | |
702 depth = this->hidden->visuals[i].depth; | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
703 // } |
0 | 704 SDL_Visual = vis; |
705 this->hidden->depth = depth; | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
706 D(bug("Setting screen depth to: %ld\n",this->hidden->depth)); |
0 | 707 #endif |
708 | |
709 /* Allocate the new pixel format for this video mode */ | |
710 { | |
711 Uint32 form; | |
712 APTR handle; | |
713 struct DisplayInfo info; | |
714 | |
715 if(!(handle=FindDisplayInfo(SDL_Visual))) | |
716 return -1; | |
717 | |
718 if(!GetDisplayInfoData(handle,(char *)&info,sizeof(struct DisplayInfo),DTAG_DISP,NULL)) | |
719 return -1; | |
720 | |
721 form=GetCyberIDAttr(CYBRIDATTR_PIXFMT,SDL_Visual); | |
722 | |
723 if(flags&SDL_HWSURFACE) | |
724 { | |
725 if(bpp!=this->hidden->depth) | |
726 { | |
727 bpp=this->hidden->depth; | |
728 D(bug("Accel forces bpp to be equal (%ld)\n",bpp)); | |
729 } | |
730 } | |
731 | |
732 D(bug("BEFORE screen allocation: bpp:%ld (real:%ld)\n",bpp,this->hidden->depth)); | |
733 | |
734 /* With this call if needed I'll revert the wanted bpp to a bpp best suited for the display, actually occurs | |
735 only with requested format 15/16bit and display format != 15/16bit | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
736 */ |
0 | 737 |
738 if ( ! SDL_ReallocFormat(screen, bpp, | |
739 MakeBitMask(this,0,form,&bpp), MakeBitMask(this,1,form,&bpp), MakeBitMask(this,2,form,&bpp), 0) ) | |
740 return -1; | |
741 | |
742 D(bug("AFTER screen allocation: bpp:%ld (real:%ld)\n",bpp,this->hidden->depth)); | |
743 | |
744 } | |
745 | |
746 /* Create the appropriate colormap */ | |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
747 /* |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
748 if ( SDL_XColorMap != SDL_DisplayColormap ) { |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
749 XFreeColormap(SDL_Display, SDL_XColorMap); |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
750 } |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
751 */ |
0 | 752 if ( GetCyberMapAttr(SDL_Display->RastPort.BitMap,CYBRMATTR_PIXFMT)==PIXFMT_LUT8 || bpp==8 ) { |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
753 int ncolors,i; |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
754 D(bug("XPixels palette allocation...\n")); |
0 | 755 |
756 /* Allocate the pixel flags */ | |
757 | |
758 if(bpp==8) | |
759 ncolors=256; | |
760 else | |
761 ncolors = 1 << screen->format->BitsPerPixel; | |
762 | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
763 SDL_XPixels = (Sint32 *)SDL_malloc(ncolors * sizeof(Sint32)); |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
764 |
0 | 765 if(SDL_XPixels == NULL) { |
766 SDL_OutOfMemory(); | |
767 return -1; | |
768 } | |
769 | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
770 |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
771 for(i=0;i<ncolors;i++) |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
772 SDL_XPixels[i]=-1; |
0 | 773 |
774 /* always allocate a private colormap on non-default visuals */ | |
775 if(bpp==8) | |
776 flags |= SDL_HWPALETTE; | |
777 | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
778 if ( flags & SDL_HWPALETTE ) |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
779 screen->flags |= SDL_HWPALETTE; |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
780 } |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
781 |
0 | 782 /* resize the (possibly new) window manager window */ |
783 | |
784 /* Create (or use) the X11 display window */ | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
785 |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
786 if ( !SDL_windowid ) { |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
787 if( flags & SDL_FULLSCREEN ) |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
788 { |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
789 SDL_Window = OpenWindowTags(NULL,WA_Width,w,WA_Height,h, |
0 | 790 WA_Flags,WFLG_ACTIVATE|WFLG_RMBTRAP|WFLG_BORDERLESS|WFLG_BACKDROP|WFLG_REPORTMOUSE, |
791 WA_IDCMP,IDCMP_RAWKEY|IDCMP_MOUSEBUTTONS|IDCMP_MOUSEMOVE, | |
792 WA_CustomScreen,(ULONG)SDL_Display, | |
793 TAG_DONE); | |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
794 |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
795 D(bug("Opening backdrop window %ldx%ld on display %lx!\n",w,h,SDL_Display)); |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
796 } |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
797 else |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
798 { |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
799 /* Create GimmeZeroZero window when OpenGL is used */ |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
800 unsigned long gzz = FALSE; |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
801 if( flags & SDL_OPENGL ) { |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
802 gzz = TRUE; |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
803 } |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
804 |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
805 SDL_Window = OpenWindowTags(NULL,WA_InnerWidth,w,WA_InnerHeight,h, |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
806 WA_Flags,WFLG_REPORTMOUSE|WFLG_ACTIVATE|WFLG_RMBTRAP | ((flags&SDL_NOFRAME) ? 0 : (WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|WFLG_DRAGBAR | ((flags&SDL_RESIZABLE) ? WFLG_SIZEGADGET|WFLG_SIZEBBOTTOM : 0))), |
0 | 807 WA_IDCMP,IDCMP_RAWKEY|IDCMP_CLOSEWINDOW|IDCMP_MOUSEBUTTONS|IDCMP_NEWSIZE|IDCMP_MOUSEMOVE, |
808 WA_PubScreen,(ULONG)SDL_Display, | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
809 WA_GimmeZeroZero, gzz, |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
810 TAG_DONE); |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
811 D(bug("Opening WB window of size: %ldx%ld!\n",w,h)); |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
812 } |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
813 |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
814 if(!SDL_Window) |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
815 return -1; |
0 | 816 } |
817 | |
818 this->hidden->BytesPerPixel=GetCyberMapAttr(SDL_Window->RPort->BitMap,CYBRMATTR_BPPIX); | |
819 | |
820 if(screen->flags & SDL_DOUBLEBUF) | |
821 { | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
822 if(SDL_RastPort=SDL_malloc(sizeof(struct RastPort))) |
0 | 823 { |
824 InitRastPort(SDL_RastPort); | |
825 SDL_RastPort->BitMap=this->hidden->SB[1]->sb_BitMap; | |
826 } | |
827 else | |
828 return -1; | |
829 } | |
830 else SDL_RastPort=SDL_Window->RPort; | |
831 | |
832 if(flags&SDL_HWSURFACE) | |
833 screen->flags|=SDL_HWSURFACE; | |
834 | |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
835 if( !SDL_windowid ) { |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
836 CGX_SetSizeHints(this, w, h, flags); |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
837 current_w = w; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
838 current_h = h; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
839 } |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
840 |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
841 /* Set our colormaps when not setting a GL mode */ |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
842 /* |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
843 if ( ! (flags & SDL_OPENGL) ) { |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
844 XSetWindowColormap(SDL_Display, SDL_Window, SDL_XColorMap); |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
845 } |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
846 */ |
0 | 847 |
848 /* Map them both and go fullscreen, if requested */ | |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
849 if ( ! SDL_windowid ) { |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
850 if ( flags & SDL_FULLSCREEN ) { |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
851 screen->flags |= SDL_FULLSCREEN; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
852 currently_fullscreen=1; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
853 // CGX_EnterFullScreen(this); Ci siamo gia'! |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
854 } else { |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
855 screen->flags &= ~SDL_FULLSCREEN; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
856 } |
0 | 857 } |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
858 screen->w = w; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
859 screen->h = h; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
860 screen->pitch = SDL_CalculatePitch(screen); |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
861 CGX_ResizeImage(this, screen, flags); |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
862 |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
863 /* Make OpenGL Context if needed*/ |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
864 if(flags & SDL_OPENGL) { |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
865 if(this->gl_data->gl_active == 0) { |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
866 if(CGX_GL_Init(this) < 0) |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
867 return -1; |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
868 else |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
869 screen->flags |= SDL_OPENGL; |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
870 } |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
871 else { |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
872 if(CGX_GL_Update(this) < 0) |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
873 return -1; |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
874 else |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
875 screen->flags |= SDL_OPENGL; |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
876 } |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
877 } |
0 | 878 } |
879 | |
880 int CGX_ResizeWindow(_THIS, | |
881 SDL_Surface *screen, int w, int h, Uint32 flags) | |
882 { | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
883 D(bug("CGX_ResizeWindow\n")); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
884 |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
885 if ( ! SDL_windowid ) { |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
886 /* Resize the window manager window */ |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
887 CGX_SetSizeHints(this, w, h, flags); |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
888 current_w = w; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
889 current_h = h; |
0 | 890 |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
891 ChangeWindowBox(SDL_Window,SDL_Window->LeftEdge,SDL_Window->TopEdge, w+SDL_Window->BorderLeft+SDL_Window->BorderRight, |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
892 h+SDL_Window->BorderTop+SDL_Window->BorderBottom); |
0 | 893 |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
894 screen->w = w; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
895 screen->h = h; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
896 screen->pitch = SDL_CalculatePitch(screen); |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
897 CGX_ResizeImage(this, screen, flags); |
0 | 898 } |
899 return(0); | |
900 } | |
901 | |
902 static SDL_Surface *CGX_SetVideoMode(_THIS, SDL_Surface *current, | |
903 int width, int height, int bpp, Uint32 flags) | |
904 { | |
905 Uint32 saved_flags; | |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
906 int needcreate=0; |
0 | 907 |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
908 D(bug("CGX_SetVideoMode current:%lx\n",current)); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
909 |
0 | 910 /* Lock the event thread, in multi-threading environments */ |
911 SDL_Lock_EventThread(); | |
912 | |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
913 // Check if the window needs to be closed or can be resized |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
914 |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
915 if( (flags&SDL_FULLSCREEN) || (current && current->flags&SDL_FULLSCREEN && !(flags&SDL_FULLSCREEN))) |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
916 needcreate=1; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
917 |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
918 // Check if we need to close an already existing videomode... |
0 | 919 |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
920 if(current && current->flags&SDL_FULLSCREEN && !(flags&SDL_FULLSCREEN)) { |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
921 unsigned long i; |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
922 D(bug("Destroying image, window & screen!\n")); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
923 |
0 | 924 CGX_DestroyImage(this,current); |
925 CGX_DestroyWindow(this,current); | |
926 DestroyScreen(this); | |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
927 GFX_Display=SDL_Display=LockPubScreen(NULL); |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
928 |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
929 bpp=this->hidden->depth=GetCyberMapAttr(SDL_Display->RastPort.BitMap,CYBRMATTR_DEPTH); |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
930 |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
931 for ( i = 0; i < this->hidden->nvisuals; i++ ) { |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
932 if ( this->hidden->visuals[i].depth == bpp ) /* era .depth */ |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
933 break; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
934 } |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
935 if ( i == this->hidden->nvisuals ) { |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
936 SDL_SetError("No matching visual for requested depth"); |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
937 return NULL; /* should never happen */ |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
938 } |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
939 SDL_Visual = this->hidden->visuals[i].visual; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
940 |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
941 D(bug("Setting screen depth to: %ld\n",this->hidden->depth)); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
942 |
0 | 943 } |
944 /* Check the combination of flags we were passed */ | |
945 if ( flags & SDL_FULLSCREEN ) { | |
946 int i; | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
947 |
0 | 948 /* Clear fullscreen flag if not supported */ |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
949 if ( SDL_windowid ) { |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
950 flags &= ~SDL_FULLSCREEN; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
951 } |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
952 else if(current && current->flags&SDL_FULLSCREEN ) { |
0 | 953 if(current->w!=width || |
954 current->h!=height || | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
955 (this->hidden && this->hidden->depth!=bpp)) |
0 | 956 { |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
957 D(bug("Deleting previous window...\n")); |
0 | 958 CGX_DestroyImage(this,current); |
959 CGX_DestroyWindow(this,current); | |
960 DestroyScreen(this); | |
961 goto buildnewscreen; | |
962 } | |
963 } | |
964 else | |
965 buildnewscreen: | |
966 { | |
967 Uint32 okid=BestCModeIDTags(CYBRBIDTG_NominalWidth,width, | |
968 CYBRBIDTG_NominalHeight,height, | |
969 CYBRBIDTG_Depth,bpp, | |
970 TAG_DONE); | |
971 | |
972 GFX_Display=NULL; | |
973 | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
974 D(bug("Opening screen...\n")); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
975 |
0 | 976 if(okid!=INVALID_ID) |
977 GFX_Display=OpenScreenTags(NULL, | |
978 SA_Width,width, | |
979 SA_Height,height, | |
980 SA_Quiet,TRUE,SA_ShowTitle,FALSE, | |
981 SA_Depth,bpp, | |
982 SA_DisplayID,okid, | |
983 TAG_DONE); | |
984 | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
985 if(!GFX_Display) { |
0 | 986 GFX_Display=SDL_Display; |
987 flags &= ~SDL_FULLSCREEN; | |
988 flags &= ~SDL_DOUBLEBUF; | |
989 } | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
990 else { |
0 | 991 UnlockPubScreen(NULL,SDL_Display); |
992 SDL_Display=GFX_Display; | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
993 |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
994 D(bug("Screen opened.\n")); |
0 | 995 |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
996 if(flags&SDL_DOUBLEBUF) { |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
997 int ok=0; |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
998 D(bug("Start of DBuffering allocations...\n")); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
999 |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1000 if(this->hidden->SB[0]=AllocScreenBuffer(SDL_Display,NULL,SB_SCREEN_BITMAP)) { |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1001 |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1002 if(this->hidden->SB[1]=AllocScreenBuffer(SDL_Display,NULL,0L)) { |
0 | 1003 extern struct MsgPort *safeport,*dispport; |
1004 | |
1005 safeport=CreateMsgPort(); | |
1006 dispport=CreateMsgPort(); | |
1007 | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1008 if(!safeport || !dispport) { |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1009 if(safeport) { |
0 | 1010 DeleteMsgPort(safeport); |
1011 safeport=NULL; | |
1012 } | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1013 if(dispport) { |
0 | 1014 DeleteMsgPort(dispport); |
1015 dispport=NULL; | |
1016 } | |
1017 FreeScreenBuffer(SDL_Display,this->hidden->SB[0]); | |
1018 FreeScreenBuffer(SDL_Display,this->hidden->SB[1]); | |
1019 } | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1020 else { |
0 | 1021 extern ULONG safe_sigbit,disp_sigbit; |
1022 int i; | |
1023 | |
1024 safe_sigbit=1L<< safeport->mp_SigBit; | |
1025 disp_sigbit=1L<< dispport->mp_SigBit; | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1026 |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1027 for(i=0;i<2;i++) { |
0 | 1028 this->hidden->SB[i]->sb_DBufInfo->dbi_SafeMessage.mn_ReplyPort=safeport; |
1029 this->hidden->SB[i]->sb_DBufInfo->dbi_DispMessage.mn_ReplyPort=dispport; | |
1030 } | |
1031 | |
1032 ok=1; | |
1033 D(bug("Dbuffering enabled!\n")); | |
1034 this->hidden->dbuffer=1; | |
1035 current->flags|=SDL_DOUBLEBUF; | |
1036 } | |
1037 } | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1038 else { |
0 | 1039 FreeScreenBuffer(SDL_Display,this->hidden->SB[1]); |
1040 this->hidden->SB[0]=NULL; | |
1041 } | |
1042 } | |
1043 | |
1044 if(!ok) | |
1045 flags&=~SDL_DOUBLEBUF; | |
1046 } | |
1047 } | |
1048 | |
1049 if(GetCyberMapAttr(SDL_Display->RastPort.BitMap,CYBRMATTR_DEPTH)==bpp) | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1050 this->hidden->same_format=1; |
0 | 1051 } |
1052 | |
1053 bpp=this->hidden->depth=GetCyberMapAttr(SDL_Display->RastPort.BitMap,CYBRMATTR_DEPTH); | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1054 D(bug("Setting screen depth to: %ld\n",this->hidden->depth)); |
0 | 1055 |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1056 for ( i = 0; i < this->hidden->nvisuals; i++ ) |
0 | 1057 if ( this->hidden->visuals[i].depth == bpp ) /* era .depth */ |
1058 break; | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1059 |
0 | 1060 if ( i == this->hidden->nvisuals ) { |
1061 SDL_SetError("No matching visual for requested depth"); | |
1062 return NULL; /* should never happen */ | |
1063 } | |
1064 SDL_Visual = this->hidden->visuals[i].visual; | |
1065 | |
1066 } | |
1067 | |
1068 /* Set up the X11 window */ | |
1069 saved_flags = current->flags; | |
1070 | |
1071 if (SDL_Window && (saved_flags&SDL_OPENGL) == (flags&SDL_OPENGL) | |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1072 && bpp == current->format->BitsPerPixel && !needcreate) { |
0 | 1073 if (CGX_ResizeWindow(this, current, width, height, flags) < 0) { |
1074 current = NULL; | |
1075 goto done; | |
1076 } | |
1077 } else { | |
1078 if (CGX_CreateWindow(this,current,width,height,bpp,flags) < 0) { | |
1079 current = NULL; | |
1080 goto done; | |
1081 } | |
1082 } | |
1083 | |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1084 #if 0 |
0 | 1085 /* Set up the new mode framebuffer */ |
1086 if ( ((current->w != width) || (current->h != height)) || | |
1087 ((saved_flags&SDL_OPENGL) != (flags&SDL_OPENGL)) ) { | |
1088 current->w = width; | |
1089 current->h = height; | |
1090 current->pitch = SDL_CalculatePitch(current); | |
1091 CGX_ResizeImage(this, current, flags); | |
1092 } | |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1093 #endif |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1094 |
0 | 1095 current->flags |= (flags&SDL_RESIZABLE); // Resizable only if the user asked it |
1096 | |
1097 done: | |
1098 /* Release the event thread */ | |
1099 SDL_Unlock_EventThread(); | |
1100 | |
1101 /* We're done! */ | |
1102 return(current); | |
1103 } | |
1104 | |
1105 static int CGX_ToggleFullScreen(_THIS, int on) | |
1106 { | |
1107 Uint32 event_thread; | |
1108 | |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1109 /* Don't switch if we don't own the window */ |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1110 if ( SDL_windowid ) { |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1111 return(0); |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1112 } |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1113 |
0 | 1114 /* Don't lock if we are the event thread */ |
1115 event_thread = SDL_EventThreadID(); | |
1116 if ( event_thread && (SDL_ThreadID() == event_thread) ) { | |
1117 event_thread = 0; | |
1118 } | |
1119 if ( event_thread ) { | |
1120 SDL_Lock_EventThread(); | |
1121 } | |
1122 if ( on ) { | |
1123 this->screen->flags |= SDL_FULLSCREEN; | |
1124 CGX_EnterFullScreen(this); | |
1125 } else { | |
1126 this->screen->flags &= ~SDL_FULLSCREEN; | |
1127 CGX_LeaveFullScreen(this); | |
1128 } | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1129 |
0 | 1130 CGX_RefreshDisplay(this); |
1131 if ( event_thread ) { | |
1132 SDL_Unlock_EventThread(); | |
1133 } | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1134 |
0 | 1135 SDL_ResetKeyboard(); |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1136 |
0 | 1137 return(1); |
1138 } | |
1139 | |
1140 static void SetSingleColor(Uint32 fmt, unsigned char r, unsigned char g, unsigned char b, unsigned char *c) | |
1141 { | |
1142 switch(fmt) | |
1143 { | |
1144 case PIXFMT_BGR15: | |
1145 case PIXFMT_RGB15PC: | |
1146 { | |
1147 Uint16 *t=(Uint16 *)c; | |
1148 *t=(r>>3) | ((g>>3)<<5) | ((b>>3)<<10) ; | |
1149 } | |
1150 break; | |
1151 case PIXFMT_RGB15: | |
1152 case PIXFMT_BGR15PC: | |
1153 { | |
1154 Uint16 *t=(Uint16 *)c; | |
1155 *t=(b>>3) | ((g>>3)<<5) | ((r>>3)<<10) ; | |
1156 } | |
1157 break; | |
1158 case PIXFMT_BGR16PC: | |
1159 case PIXFMT_RGB16: | |
1160 { | |
1161 Uint16 *t=(Uint16 *)c; | |
1162 *t=(b>>3) | ((g>>2)<<5) | ((r>>3)<<11) ; | |
1163 } | |
1164 break; | |
1165 case PIXFMT_BGR16: | |
1166 case PIXFMT_RGB16PC: | |
1167 { | |
1168 Uint16 *t=(Uint16 *)c; | |
1169 *t=(r>>3) | ((g>>2)<<5) | ((b>>3)<<11) ; | |
1170 } | |
1171 break; | |
1172 case PIXFMT_RGB24: | |
1173 c[0]=r; | |
1174 c[1]=g; | |
1175 c[2]=b; | |
1176 c[3]=0; | |
1177 break; | |
1178 case PIXFMT_BGR24: | |
1179 c[0]=b; | |
1180 c[1]=g; | |
1181 c[2]=r; | |
1182 c[3]=0; | |
1183 break; | |
1184 case PIXFMT_ARGB32: | |
1185 c[0]=0; | |
1186 c[1]=r; | |
1187 c[2]=g; | |
1188 c[3]=b; | |
1189 break; | |
1190 case PIXFMT_BGRA32: | |
1191 c[0]=b; | |
1192 c[1]=g; | |
1193 c[2]=r; | |
1194 c[3]=0; | |
1195 break; | |
1196 case PIXFMT_RGBA32: | |
1197 c[0]=r; | |
1198 c[1]=g; | |
1199 c[2]=b; | |
1200 c[3]=0; | |
1201 break; | |
1202 | |
1203 default: | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1204 D(bug("Error, SetSingleColor with PIXFMT %ld!\n",fmt)); |
0 | 1205 } |
1206 } | |
1207 | |
1208 /* Update the current mouse state and position */ | |
1209 static void CGX_UpdateMouse(_THIS) | |
1210 { | |
1211 /* Lock the event thread, in multi-threading environments */ | |
1212 SDL_Lock_EventThread(); | |
1213 | |
1214 if(currently_fullscreen) | |
1215 { | |
1216 SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS); | |
1217 SDL_PrivateMouseMotion(0, 0, SDL_Display->MouseX, SDL_Display->MouseY); | |
1218 } | |
1219 else | |
1220 { | |
1221 if( SDL_Display->MouseX>=(SDL_Window->LeftEdge+SDL_Window->BorderLeft) && SDL_Display->MouseX<(SDL_Window->LeftEdge+SDL_Window->Width-SDL_Window->BorderRight) && | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1222 SDL_Display->MouseY>=(SDL_Window->TopEdge+SDL_Window->BorderLeft) && SDL_Display->MouseY<(SDL_Window->TopEdge+SDL_Window->Height-SDL_Window->BorderBottom) |
0 | 1223 ) |
1224 { | |
1225 SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS); | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1226 SDL_PrivateMouseMotion(0, 0, SDL_Display->MouseX-SDL_Window->LeftEdge-SDL_Window->BorderLeft, |
0 | 1227 SDL_Display->MouseY-SDL_Window->TopEdge-SDL_Window->BorderTop); |
1228 } | |
1229 else | |
1230 { | |
1231 SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS); | |
1232 } | |
1233 } | |
1234 SDL_Unlock_EventThread(); | |
1235 } | |
1236 | |
1237 static int CGX_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) | |
1238 { | |
1239 int i; | |
1240 | |
1241 /* Check to make sure we have a colormap allocated */ | |
1242 | |
1243 /* It's easy if we have a hidden colormap */ | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1244 if ( (this->screen->flags & SDL_HWPALETTE) && currently_fullscreen ) |
0 | 1245 { |
1246 ULONG xcmap[256*3+2]; | |
1247 | |
1248 xcmap[0]=(ncolors<<16); | |
1249 xcmap[0]+=firstcolor; | |
1250 | |
1251 // D(bug("Setting %ld colors on an HWPALETTE screen\n",ncolors)); | |
1252 | |
1253 for ( i=0; i<ncolors; i++ ) { | |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1254 xcmap[i*3+1] = colors[i+firstcolor].r<<24; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1255 xcmap[i*3+2] = colors[i+firstcolor].g<<24; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1256 xcmap[i*3+3] = colors[i+firstcolor].b<<24; |
0 | 1257 } |
1258 xcmap[ncolors*3+1]=0; | |
1259 LoadRGB32(&GFX_Display->ViewPort,xcmap); | |
1260 } else { | |
1261 // XPixels are not needed on 8bit screen with hwpalette | |
1262 unsigned long pixel; | |
1263 | |
1264 if ( SDL_XPixels == NULL ) { | |
1265 D(bug("SetColors without colormap!")); | |
1266 return(0); | |
1267 } | |
1268 | |
1269 if(this->hidden->depth==8) | |
1270 { | |
1271 // In this case I have to unalloc and realloc the full palette | |
1272 D(bug("Obtaining %ld colors on the screen\n",ncolors)); | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1273 |
0 | 1274 /* Free existing allocated colors */ |
1275 for ( pixel=0; pixel<this->screen->format->palette->ncolors; ++pixel ) { | |
1276 if(SDL_XPixels[pixel]>=0) | |
1277 ReleasePen(GFX_Display->ViewPort.ColorMap,SDL_XPixels[pixel]); | |
1278 } | |
1279 | |
1280 /* Try to allocate all the colors */ | |
1281 for ( i=0; i<this->screen->format->palette->ncolors; ++i ) { | |
1282 SDL_XPixels[i]=ObtainBestPenA(GFX_Display->ViewPort.ColorMap,colors[i].r<<24,colors[i].g<<24,colors[i].b<<24,NULL); | |
1283 } | |
1284 } | |
1285 else | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1286 { |
0 | 1287 #ifndef USE_CGX_WRITELUTPIXEL |
1288 Uint32 fmt; | |
1289 D(bug("Preparing a conversion pixel table...\n")); | |
1290 | |
1291 fmt=GetCyberMapAttr(SDL_Display->RastPort.BitMap,CYBRMATTR_PIXFMT); | |
1292 | |
1293 for(i=0;i<ncolors;i++) | |
1294 { | |
1295 SetSingleColor(fmt,colors[firstcolor+i].r,colors[firstcolor+i].g,colors[firstcolor+i].b,(unsigned char *)&SDL_XPixels[firstcolor+i]); | |
1296 } | |
1297 #else | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1298 // D(bug("Executing XPixel(%lx) remapping: (from %ld, %ld colors) first: r%ld g%ld b%ld\n",SDL_XPixels,firstcolor,ncolors,colors[firstcolor].r,colors[firstcolor].g,colors[firstcolor].b)); |
0 | 1299 for(i=0;i<ncolors;i++) |
1300 SDL_XPixels[i+firstcolor]=(colors[firstcolor+i].r<<16)+(colors[firstcolor+i].g<<8)+colors[firstcolor+i].b; | |
1301 #endif | |
1302 } | |
1303 } | |
1304 | |
1305 // Actually it cannot fail! | |
1306 | |
1307 return 1; | |
1308 } | |
1309 | |
1310 /* Note: If we are terminated, this could be called in the middle of | |
1311 another SDL video routine -- notably UpdateRects. | |
1312 */ | |
1313 static void CGX_VideoQuit(_THIS) | |
1314 { | |
1315 /* Shutdown everything that's still up */ | |
1316 /* The event thread should be done, so we can touch SDL_Display */ | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1317 D(bug("CGX_VideoQuit\n")); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1318 |
0 | 1319 if ( SDL_Display != NULL ) { |
1320 /* Clean up OpenGL */ | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1321 if(this->gl_data->gl_active == 1) { |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1322 CGX_GL_Quit(this); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1323 } |
0 | 1324 /* Start shutting down the windows */ |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1325 D(bug("Destroying image...\n")); |
0 | 1326 CGX_DestroyImage(this, this->screen); |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1327 D(bug("Destroying window...\n")); |
0 | 1328 CGX_DestroyWindow(this, this->screen); |
1329 // Otherwise SDL_VideoQuit will try to free it! | |
1330 SDL_VideoSurface=NULL; | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1331 |
0 | 1332 CGX_FreeVideoModes(this); |
1333 | |
1334 /* Free that blank cursor */ | |
1335 if ( SDL_BlankCursor != NULL ) { | |
1336 FreeMem(SDL_BlankCursor,16); | |
1337 SDL_BlankCursor = NULL; | |
1338 } | |
1339 | |
1340 /* Close the X11 graphics connection */ | |
1341 this->hidden->same_format=0; | |
1342 | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1343 D(bug("Destroying screen...\n")); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1344 |
0 | 1345 if ( GFX_Display != NULL ) |
1346 DestroyScreen(this); | |
1347 | |
1348 /* Close the X11 display connection */ | |
1349 SDL_Display = NULL; | |
1350 | |
1351 /* Unload GL library after X11 shuts down */ | |
1352 } | |
1353 | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1354 D(bug("Closing libraries...\n")); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1355 |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1356 if( CyberGfxBase) { |
0 | 1357 CloseLibrary(CyberGfxBase); |
1358 CyberGfxBase=NULL; | |
1359 } | |
1360 | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1361 if (IntuitionBase) { |
0 | 1362 CloseLibrary((struct Library *)IntuitionBase); |
1363 IntuitionBase=NULL; | |
1364 } | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1365 if (GfxBase) { |
0 | 1366 CloseLibrary((struct Library *)GfxBase); |
1367 GfxBase=NULL; | |
1368 } | |
1369 | |
1370 if ( this->screen && (this->screen->flags & SDL_HWSURFACE) ) { | |
1371 /* Direct screen access, no memory buffer */ | |
1372 this->screen->pixels = NULL; | |
1373 } | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1374 D(bug("End of CGX_VideoQuit.\n")); |
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1375 |
0 | 1376 } |
1377 |