Mercurial > sdl-ios-xcode
annotate src/video/photon/SDL_ph_video.c @ 309:2de77f7b7a28
*** empty log message ***
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 11 Mar 2002 17:38:56 +0000 |
parents | f6ffac90895c |
children | 3333b6e68289 |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
297
f6ffac90895c
Updated copyright information for 2002
Sam Lantinga <slouken@libsdl.org>
parents:
291
diff
changeset
|
3 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
6 modify it under the terms of the GNU Library General Public | |
7 License as published by the Free Software Foundation; either | |
8 version 2 of the License, or (at your option) any later version. | |
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 | |
13 Library General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU Library General Public | |
16 License along with this library; if not, write to the Free | |
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | |
19 Sam Lantinga | |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
204
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
22 | |
23 #ifdef SAVE_RCSID | |
24 static char rcsid = | |
25 "@(#) $Id$"; | |
26 #endif | |
27 | |
28 #include <stdlib.h> | |
29 #include <stdio.h> | |
30 #include <unistd.h> | |
31 #include <string.h> | |
32 #include <sys/ioctl.h> | |
33 | |
34 #include "SDL.h" | |
35 #include "SDL_error.h" | |
36 #include "SDL_timer.h" | |
37 #include "SDL_thread.h" | |
38 #include "SDL_video.h" | |
39 #include "SDL_mouse.h" | |
40 #include "SDL_endian.h" | |
41 #include "SDL_sysvideo.h" | |
42 #include "SDL_pixels_c.h" | |
43 #include "SDL_events_c.h" | |
44 #include "SDL_ph_video.h" | |
45 #include "SDL_ph_modes_c.h" | |
46 #include "SDL_ph_image_c.h" | |
47 #include "SDL_ph_events_c.h" | |
48 #include "SDL_ph_mouse_c.h" | |
19
8cc4dbfab9ab
Date: Thu, 19 Apr 2001 08:36:54 +0300
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
49 #include "SDL_ph_wm_c.h" |
0 | 50 #include "SDL_phyuv_c.h" |
51 #include "blank_cursor.h" | |
52 | |
53 static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat); | |
54 static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current, | |
55 int width, int height, int bpp, Uint32 flags); | |
56 static int ph_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors); | |
57 static void ph_VideoQuit(_THIS); | |
58 static void ph_DeleteDevice(SDL_VideoDevice *device); | |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
59 |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
60 #ifdef HAVE_OPENGL |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
61 int ph_SetupOpenGLContext(_THIS, int width, int height, int bpp, Uint32 flags); |
266
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
62 static void ph_GL_SwapBuffers(_THIS); |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
63 static int ph_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value); |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
64 #endif /* HAVE_OPENGL */ |
266
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
65 |
0 | 66 static int ph_Available(void) |
67 { | |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
68 int phstat=-1; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
69 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
70 phstat=PtInit(0); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
71 if (phstat==0) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
72 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
73 return 1; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
74 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
75 else |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
76 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
77 return 0; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
78 } |
0 | 79 } |
80 | |
81 static SDL_VideoDevice *ph_CreateDevice(int devindex) | |
82 { | |
83 SDL_VideoDevice *device; | |
84 | |
85 /* Initialize all variables that we clean on shutdown */ | |
86 device = (SDL_VideoDevice *)malloc(sizeof(SDL_VideoDevice)); | |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
87 if (device) { |
0 | 88 memset(device, 0, (sizeof *device)); |
89 device->hidden = (struct SDL_PrivateVideoData *) | |
90 malloc((sizeof *device->hidden)); | |
91 device->gl_data = NULL; | |
92 } | |
93 if ( (device == NULL) || (device->hidden == NULL) ) { | |
94 SDL_OutOfMemory(); | |
95 ph_DeleteDevice(device); | |
96 return(0); | |
97 } | |
98 memset(device->hidden, 0, (sizeof *device->hidden)); | |
99 | |
100 /* Set the driver flags */ | |
279
04351f59b051
Mike Gorchak added some QNX tweaks, including OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
101 device->handles_any_size = 1; /* JB not true for fullscreen */ |
0 | 102 |
103 /* Set the function pointers */ | |
266
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
104 device->CreateYUVOverlay = ph_CreateYUVOverlay; |
0 | 105 device->VideoInit = ph_VideoInit; |
106 device->ListModes = ph_ListModes; | |
107 device->SetVideoMode = ph_SetVideoMode; | |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
108 device->ToggleFullScreen = ph_ToggleFullScreen; |
0 | 109 device->UpdateMouse = NULL; |
110 device->SetColors = ph_SetColors; | |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
111 device->UpdateRects = NULL; /* ph_ResizeImage */ |
0 | 112 device->VideoQuit = ph_VideoQuit; |
113 device->AllocHWSurface = ph_AllocHWSurface; | |
114 device->CheckHWBlit = NULL; | |
115 device->FillHWRect = NULL; | |
116 device->SetHWColorKey = NULL; | |
117 device->SetHWAlpha = NULL; | |
118 device->LockHWSurface = ph_LockHWSurface; | |
119 device->UnlockHWSurface = ph_UnlockHWSurface; | |
120 device->FlipHWSurface = ph_FlipHWSurface; | |
121 device->FreeHWSurface = ph_FreeHWSurface; | |
19
8cc4dbfab9ab
Date: Thu, 19 Apr 2001 08:36:54 +0300
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
122 device->SetCaption = ph_SetCaption; |
0 | 123 device->SetIcon = NULL; |
19
8cc4dbfab9ab
Date: Thu, 19 Apr 2001 08:36:54 +0300
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
124 device->IconifyWindow = ph_IconifyWindow; |
283
3d8b6b9f1e18
Date: Mon, 18 Feb 2002 16:46:59 +1200
Sam Lantinga <slouken@libsdl.org>
parents:
279
diff
changeset
|
125 device->GrabInput = ph_GrabInput; |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
126 device->GetWMInfo = ph_GetWMInfo; |
0 | 127 device->FreeWMCursor = ph_FreeWMCursor; |
128 device->CreateWMCursor = ph_CreateWMCursor; | |
129 device->ShowWMCursor = ph_ShowWMCursor; | |
130 device->WarpWMCursor = ph_WarpWMCursor; | |
131 device->CheckMouseMode = ph_CheckMouseMode; | |
132 device->InitOSKeymap = ph_InitOSKeymap; | |
133 device->PumpEvents = ph_PumpEvents; | |
134 | |
279
04351f59b051
Mike Gorchak added some QNX tweaks, including OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
135 /* OpenGL support. */ |
266
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
136 device->GL_LoadLibrary = NULL; |
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
137 device->GL_GetProcAddress = NULL; |
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
138 device->GL_MakeCurrent = NULL; |
279
04351f59b051
Mike Gorchak added some QNX tweaks, including OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
139 #ifdef HAVE_OPENGL |
266
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
140 device->GL_SwapBuffers = ph_GL_SwapBuffers; |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
141 device->GL_GetAttribute = ph_GL_GetAttribute; |
279
04351f59b051
Mike Gorchak added some QNX tweaks, including OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
142 #else |
04351f59b051
Mike Gorchak added some QNX tweaks, including OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
143 device->GL_SwapBuffers = NULL; |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
144 device->GL_GetAttribute = NULL; |
279
04351f59b051
Mike Gorchak added some QNX tweaks, including OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
145 #endif /* HAVE_OPENGL */ |
266
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
146 |
0 | 147 device->free = ph_DeleteDevice; |
148 | |
149 return device; | |
150 } | |
151 | |
19
8cc4dbfab9ab
Date: Thu, 19 Apr 2001 08:36:54 +0300
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
152 VideoBootStrap ph_bootstrap = { |
0 | 153 "photon", "QNX Photon video output", |
154 ph_Available, ph_CreateDevice | |
155 }; | |
156 | |
157 static void ph_DeleteDevice(SDL_VideoDevice *device) | |
158 { | |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
159 if (device) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
160 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
161 if (device->hidden) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
162 { |
0 | 163 free(device->hidden); |
164 device->hidden = NULL; | |
165 } | |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
166 if (device->gl_data) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
167 { |
0 | 168 free(device->gl_data); |
169 device->gl_data = NULL; | |
170 } | |
171 free(device); | |
172 device = NULL; | |
173 } | |
174 } | |
175 | |
176 static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat) | |
177 { | |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
178 PgColor_t ph_palette[_Pg_MAX_PALETTE]; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
179 int i; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
180 unsigned long *tempptr; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
181 int rtnval; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
182 PgVideoModeInfo_t my_mode_info; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
183 PgHWCaps_t my_hwcaps; |
0 | 184 |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
185 window=NULL; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
186 oglctx=NULL; |
0 | 187 |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
188 if (NULL == (event = malloc(EVENT_SIZE))) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
189 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
190 exit(EXIT_FAILURE); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
191 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
192 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
193 /* Create the blank cursor */ |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
194 SDL_BlankCursor = this->CreateWMCursor(this, blank_cdata, blank_cmask, |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
195 (int)BLANK_CWIDTH, (int)BLANK_CHEIGHT, |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
196 (int)BLANK_CHOTX, (int)BLANK_CHOTY); |
0 | 197 |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
198 if (SDL_BlankCursor == NULL) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
199 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
200 printf("ph_VideoInit: could not create blank cursor\n"); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
201 } |
0 | 202 |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
203 if (PgGetGraphicsHWCaps(&my_hwcaps) < 0) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
204 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
205 fprintf(stderr,"ph_VideoInit: GetGraphicsHWCaps failed!! \n"); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
206 } |
0 | 207 |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
208 if (PgGetVideoModeInfo(my_hwcaps.current_video_mode, &my_mode_info) < 0) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
209 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
210 fprintf(stderr,"ph_VideoInit: PgGetVideoModeInfo failed\n"); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
211 } |
279
04351f59b051
Mike Gorchak added some QNX tweaks, including OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
212 |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
213 /* We need to return BytesPerPixel as it in used by CreateRGBsurface */ |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
214 vformat->BitsPerPixel = my_mode_info.bits_per_pixel; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
215 vformat->BytesPerPixel = my_mode_info.bytes_per_scanline/my_mode_info.width; |
279
04351f59b051
Mike Gorchak added some QNX tweaks, including OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
216 |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
217 /* return a palette if we are in 256 color mode */ |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
218 if (vformat->BitsPerPixel == 8) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
219 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
220 vformat->palette = malloc(sizeof(SDL_Palette)); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
221 memset(vformat->palette, 0, sizeof(SDL_Palette)); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
222 vformat->palette->ncolors = 256; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
223 vformat->palette->colors = (SDL_Color *)malloc(256 *sizeof(SDL_Color)); |
0 | 224 |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
225 /* fill the palette */ |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
226 rtnval = PgGetPalette(ph_palette); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
227 if (rtnval < 0) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
228 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
229 fprintf(stderr, "ph_VideoInit: PgGetPalette failed\n"); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
230 } |
0 | 231 |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
232 tempptr = (unsigned long *)vformat->palette->colors; |
0 | 233 |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
234 for(i=0;i<256; i++) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
235 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
236 *tempptr = (((unsigned long)ph_palette[i]) << 8); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
237 tempptr++; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
238 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
239 } |
0 | 240 |
19
8cc4dbfab9ab
Date: Thu, 19 Apr 2001 08:36:54 +0300
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
241 currently_fullscreen = 0; |
8cc4dbfab9ab
Date: Thu, 19 Apr 2001 08:36:54 +0300
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
242 |
8cc4dbfab9ab
Date: Thu, 19 Apr 2001 08:36:54 +0300
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
243 this->info.wm_available = 1; |
8cc4dbfab9ab
Date: Thu, 19 Apr 2001 08:36:54 +0300
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
244 |
0 | 245 return 0; |
246 } | |
247 | |
248 static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current, | |
249 int width, int height, int bpp, Uint32 flags) | |
250 { | |
251 PgDisplaySettings_t settings; | |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
252 int mode; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
253 PtArg_t arg[32]; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
254 PhDim_t dim; |
266
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
255 int rtnval; |
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
256 PgColor_t ph_palette[_Pg_MAX_PALETTE]; |
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
257 int i; |
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
258 unsigned long *tempptr; |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
259 int pargc; |
0 | 260 |
266
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
261 dim.w=width; |
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
262 dim.h=height; |
0 | 263 |
264 /* Lock the event thread, in multi-threading environments */ | |
265 SDL_Lock_EventThread(); | |
266 | |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
267 /* create window if no OpenGL support selected */ |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
268 if ((flags & SDL_OPENGL)!=SDL_OPENGL) |
0 | 269 { |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
270 pargc=0; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
271 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
272 PtSetArg(&arg[pargc++], Pt_ARG_DIM, &dim, 0); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
273 PtSetArg(&arg[pargc++], Pt_ARG_RESIZE_FLAGS, Pt_FALSE, Pt_RESIZE_XY_AS_REQUIRED); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
274 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
275 if (window!=NULL) |
0 | 276 { |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
277 PtUnrealizeWidget(window); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
278 PtDestroyWidget(window); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
279 window=NULL; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
280 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
281 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
282 window=PtCreateWidget(PtWindow, NULL, pargc-1, arg); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
283 PtRealizeWidget(window); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
284 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
285 PtFlush(); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
286 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
287 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
288 #ifdef HAVE_OPENGL |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
289 if (flags & SDL_OPENGL) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
290 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
291 /* ph_SetupOpenGLContext creates also window as need */ |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
292 if (ph_SetupOpenGLContext(this, width, height, bpp, flags)==0) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
293 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
294 current->flags=flags; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
295 /* setup OGL update function ... ugly method */ |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
296 ph_ResizeImage(this, current, flags); |
0 | 297 } |
298 else | |
299 { | |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
300 /* if context creation fail, report no OpenGL to high level */ |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
301 current->flags=(flags & (~SDL_OPENGL)); |
0 | 302 } |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
303 #else |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
304 if (flags & SDL_OPENGL) /* if no built-in OpenGL support */ |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
305 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
306 fprintf(stderr, "error: no OpenGL support, try to recompile library.\n"); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
307 current->flags=(flags & (~SDL_OPENGL)); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
308 return NULL; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
309 #endif /* HAVE_OPENGL */ |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
310 } |
266
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
311 else |
0 | 312 { |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
313 /* Initialize the window */ |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
314 if (flags & SDL_FULLSCREEN) /* Direct Context , assume SDL_HWSURFACE also set */ |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
315 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
316 /* Get the video mode and set it */ |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
317 if (flags & SDL_ANYFORMAT) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
318 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
319 if ((mode = get_mode_any_format(width, height, bpp)) == 0) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
320 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
321 fprintf(stderr,"error: get_mode_any_format failed\n"); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
322 exit(1); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
323 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
324 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
325 else |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
326 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
327 if ((mode = get_mode(width, height, bpp)) == 0) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
328 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
329 fprintf(stderr,"error: get_mode failed\n"); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
330 exit(1); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
331 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
332 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
333 settings.mode = mode; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
334 settings.refresh = 0; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
335 settings.flags = 0; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
336 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
337 if (PgSetVideoMode( &settings ) < 0) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
338 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
339 fprintf(stderr,"error: PgSetVideoMode failed\n"); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
340 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
341 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
342 /* Get the true height and width */ |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
343 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
344 current->flags = (flags & (~SDL_RESIZABLE)); /* no resize for Direct Context */ |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
345 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
346 /* Begin direct mode */ |
279
04351f59b051
Mike Gorchak added some QNX tweaks, including OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
347 |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
348 ph_EnterFullScreen(this); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
349 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
350 } /* end fullscreen flag */ |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
351 else |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
352 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
353 if (flags & SDL_HWSURFACE) /* Use offscreen memory iff SDL_HWSURFACE flag is set */ |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
354 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
355 /* Hardware surface is Offsceen Context. ph_ResizeImage handles the switch */ |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
356 current->flags = (flags & (~SDL_RESIZABLE)); /* no stretch blit in offscreen context */ |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
357 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
358 else /* must be SDL_SWSURFACE */ |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
359 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
360 current->flags = (flags | SDL_RESIZABLE); /* yes we can resize as this is a software surface */ |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
361 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
362 } |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
363 |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
364 /* If we are setting video to use the palette make sure we have allocated memory for it */ |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
365 if (bpp==8) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
366 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
367 current->format->palette = malloc(sizeof(SDL_Palette)); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
368 memset(current->format->palette, 0, sizeof(SDL_Palette)); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
369 current->format->palette->ncolors = 256; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
370 current->format->palette->colors = (SDL_Color *)malloc(256 *sizeof(SDL_Color)); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
371 /* fill the palette */ |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
372 rtnval = PgGetPalette(ph_palette); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
373 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
374 tempptr = (unsigned long *)current->format->palette->colors; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
375 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
376 for(i=0; i<256; i++) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
377 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
378 *tempptr = (((unsigned long)ph_palette[i]) << 8); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
379 tempptr++; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
380 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
381 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
382 |
0 | 383 } |
384 | |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
385 current->w = width; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
386 current->h = height; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
387 current->format->BitsPerPixel = bpp; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
388 current->format->BytesPerPixel = (bpp+7)/8; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
389 current->pitch = SDL_CalculatePitch(current); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
390 /* Must call at least once it setup image planes */ |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
391 ph_ResizeImage(this, current, flags); |
0 | 392 |
393 SDL_Unlock_EventThread(); | |
394 | |
395 /* We're done! */ | |
396 return(current); | |
397 } | |
398 | |
399 static void ph_VideoQuit(_THIS) | |
400 { | |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
401 PhRegion_t region_info; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
402 |
283
3d8b6b9f1e18
Date: Mon, 18 Feb 2002 16:46:59 +1200
Sam Lantinga <slouken@libsdl.org>
parents:
279
diff
changeset
|
403 ph_DestroyImage(this, SDL_VideoSurface); |
0 | 404 |
279
04351f59b051
Mike Gorchak added some QNX tweaks, including OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
405 if (currently_fullscreen) |
04351f59b051
Mike Gorchak added some QNX tweaks, including OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
406 { |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
407 PdDirectStop(directContext); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
408 PdReleaseDirectContext(directContext); |
279
04351f59b051
Mike Gorchak added some QNX tweaks, including OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
409 directContext=0; |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
410 currently_fullscreen=0; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
411 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
412 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
413 #ifdef HAVE_OPENGL |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
414 if (((this->screen->flags & SDL_FULLSCREEN)==SDL_FULLSCREEN) && |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
415 ((this->screen->flags & SDL_OPENGL)==SDL_OPENGL)) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
416 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
417 region_info.cursor_type=Ph_CURSOR_POINTER; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
418 region_info.rid=PtWidgetRid(window); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
419 PhRegionChange(Ph_REGION_CURSOR, 0, ®ion_info, NULL, NULL); |
279
04351f59b051
Mike Gorchak added some QNX tweaks, including OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
420 } |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
421 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
422 PtFlush(); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
423 #endif /* HAVE_OPENGL */ |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
424 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
425 if (window) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
426 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
427 PtUnrealizeWidget(window); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
428 PtDestroyWidget(window); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
429 window=NULL; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
430 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
431 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
432 #ifdef HAVE_OPENGL |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
433 if (oglctx) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
434 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
435 PhDCSetCurrent(NULL); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
436 PhDCRelease(oglctx); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
437 oglctx=NULL; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
438 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
439 #endif /* HAVE_OPENGL */ |
0 | 440 } |
441 | |
442 static int ph_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) | |
443 { | |
444 PgColor_t *in, *out; | |
445 int i, j; | |
446 int alloct_all = 1; | |
447 | |
448 colors = this->screen->format->palette->colors; | |
449 | |
450 in = alloca( ncolors*sizeof(PgColor_t) ); | |
451 if ( in == NULL ) { | |
452 return 0; | |
453 } | |
454 memset(in,0,ncolors*sizeof(PgColor_t)); | |
455 | |
456 out = alloca( ncolors*sizeof(PgColor_t) ); | |
457 if ( out == NULL ) { | |
458 return 0; | |
459 } | |
460 | |
461 for (i=0,j=firstcolor;i<ncolors;i++,j++) | |
462 { | |
463 in[i] |= colors[j].r<<16 ; | |
464 in[i] |= colors[j].g<<8 ; | |
465 in[i] |= colors[j].b ; | |
466 } | |
467 | |
468 if ( (this->screen->flags & SDL_HWPALETTE) == SDL_HWPALETTE ) | |
469 { | |
470 if( PgSetPalette( in, 0, 0, ncolors, Pg_PALSET_HARD, 0) < 0 ) | |
471 { | |
472 fprintf(stderr,"error: PgSetPalette(..,Pg_PALSET_HARD) failed\n"); | |
473 return 0; | |
474 } | |
475 } | |
476 else | |
477 { | |
478 if ( PgColorMatch(ncolors, in, out) < 0 ) | |
479 { | |
480 fprintf(stderr,"error: PgColorMatch failed\n"); | |
481 return 0; | |
482 } | |
483 for (i=0;i<ncolors;i++) | |
484 { | |
485 if (memcmp(&in[i],&out[i],sizeof(PgColor_t))) | |
486 { | |
487 alloct_all = 0; | |
488 break; | |
489 } | |
490 } | |
491 if( PgSetPalette( out, 0, 0, ncolors, Pg_PALSET_SOFT, 0) < 0 ) | |
492 { | |
493 fprintf(stderr,"error: PgSetPalette(..,Pg_PALSET_SOFT) failed\n"); | |
494 return 0; | |
495 } | |
496 } | |
497 return alloct_all; | |
498 } | |
499 | |
279
04351f59b051
Mike Gorchak added some QNX tweaks, including OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
500 #ifdef HAVE_OPENGL |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
501 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
502 int ph_SetupOpenGLContext(_THIS, int width, int height, int bpp, Uint32 flags) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
503 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
504 PtArg_t args[8]; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
505 PhDim_t dim; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
506 uint64_t OGLAttrib[PH_OGL_MAX_ATTRIBS]; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
507 int OGLargc; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
508 int pargc; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
509 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
510 dim.w=width; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
511 dim.h=height; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
512 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
513 if (oglctx!=NULL) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
514 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
515 PhDCSetCurrent(NULL); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
516 PhDCRelease(oglctx); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
517 oglctx=NULL; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
518 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
519 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
520 OGLargc=0; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
521 if (this->gl_config.depth_size) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
522 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
523 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_DEPTH_BITS; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
524 OGLAttrib[OGLargc++]=this->gl_config.depth_size; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
525 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
526 if (this->gl_config.stencil_size) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
527 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
528 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_STENCIL_BITS; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
529 OGLAttrib[OGLargc++]=this->gl_config.stencil_size; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
530 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
531 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FORCE_SW; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
532 if (flags & SDL_FULLSCREEN) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
533 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
534 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FULLSCREEN; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
535 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_DIRECT; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
536 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FULLSCREEN_BEST; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
537 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FULLSCREEN_CENTER; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
538 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
539 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_NONE; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
540 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
541 if (this->gl_config.double_buffer) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
542 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
543 oglctx=PdCreateOpenGLContext(2, &dim, 0, OGLAttrib); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
544 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
545 else |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
546 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
547 oglctx=PdCreateOpenGLContext(1, &dim, 0, OGLAttrib); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
548 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
549 if (oglctx==NULL) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
550 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
551 fprintf(stderr,"error: cannot create OpenGL context.\n"); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
552 return (-1); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
553 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
554 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
555 PhDCSetCurrent(oglctx); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
556 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
557 pargc=0; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
558 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
559 PtSetArg(&args[pargc++], Pt_ARG_DIM, &dim, 0); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
560 PtSetArg(&args[pargc++], Pt_ARG_RESIZE_FLAGS, Pt_FALSE, Pt_RESIZE_XY_AS_REQUIRED); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
561 PtSetArg(&args[pargc++], Pt_ARG_FILL_COLOR, Pg_BLACK, 0); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
562 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
563 if (flags & SDL_FULLSCREEN) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
564 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
565 PhPoint_t pos; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
566 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
567 pos.x=0; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
568 pos.y=0; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
569 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
570 PtSetArg(&args[pargc++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_FALSE, ~0); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
571 PtSetArg(&args[pargc++], Pt_ARG_WINDOW_MANAGED_FLAGS,Pt_TRUE, Ph_WM_FFRONT | Ph_WM_CLOSE | Ph_WM_TOFRONT | Ph_WM_CONSWITCH); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
572 PtSetArg(&args[pargc++], Pt_ARG_WINDOW_STATE, Pt_TRUE, Ph_WM_STATE_ISFRONT | Ph_WM_STATE_ISFOCUS); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
573 PtSetArg(&args[pargc++], Pt_ARG_POS, &pos, 0); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
574 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
575 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
576 if (window!=NULL) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
577 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
578 PtUnrealizeWidget(window); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
579 PtDestroyWidget(window); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
580 window=NULL; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
581 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
582 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
583 window=PtCreateWidget(PtWindow, NULL, pargc-1, args); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
584 PtRealizeWidget(window); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
585 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
586 /* disable mouse for fullscreen */ |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
587 if (flags & SDL_FULLSCREEN) |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
588 { |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
589 PhRegion_t region_info; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
590 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
591 region_info.cursor_type=Ph_CURSOR_NONE; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
592 region_info.rid=PtWidgetRid(window); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
593 PhRegionChange(Ph_REGION_CURSOR, 0, ®ion_info, NULL, NULL); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
594 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
595 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
596 PtFlush(); |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
597 |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
598 return 0; |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
599 } |
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
600 |
266
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
601 void ph_GL_SwapBuffers(_THIS) |
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
602 { |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
603 PgSetRegion(PtWidgetRid(window)); |
309
2de77f7b7a28
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
604 PdOpenGLContextSwapBuffers(oglctx); |
266
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
605 } |
0 | 606 |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
607 int ph_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value) |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
608 { |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
609 switch (attrib) |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
610 { |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
611 case SDL_GL_DOUBLEBUFFER: |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
612 *value=this->gl_config.double_buffer; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
613 break; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
614 case SDL_GL_STENCIL_SIZE: |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
615 *value=this->gl_config.stencil_size; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
616 break; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
617 case SDL_GL_DEPTH_SIZE: |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
618 *value=this->gl_config.depth_size; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
619 break; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
620 default: |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
621 *value=0; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
622 return(-1); |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
623 } |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
624 return 0; |
0 | 625 } |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
626 |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
627 #endif /* HAVE_OPENGL */ |