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