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