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