annotate src/video/photon/SDL_ph_video.c @ 532:058d47b7a3b4

Return an error with color fills on less than 8 bpp surfaces.
author Sam Lantinga <slouken@libsdl.org>
date Tue, 15 Oct 2002 05:22:50 +0000
parents bce7171e7a85
children 8e3ce997621c
rev   line source
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
1 /*
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
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
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
4
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
6 modify it under the terms of the GNU Library General Public
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
8 version 2 of the License, or (at your option) any later version.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
9
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
13 Library General Public License for more details.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
14
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
15 You should have received a copy of the GNU Library General Public
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
16 License along with this library; if not, write to the Free
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
18
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
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
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
21 */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
22
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
23 #ifdef SAVE_RCSID
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
24 static char rcsid =
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
25 "@(#) $Id$";
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
26 #endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
27
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
28 #include <stdlib.h>
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
29 #include <stdio.h>
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
30 #include <unistd.h>
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
31 #include <string.h>
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
32 #include <sys/ioctl.h>
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
33
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
34 #include "SDL.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
35 #include "SDL_error.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
36 #include "SDL_timer.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
37 #include "SDL_thread.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
38 #include "SDL_video.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
39 #include "SDL_mouse.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
40 #include "SDL_endian.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
41 #include "SDL_sysvideo.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
42 #include "SDL_pixels_c.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
43 #include "SDL_events_c.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
44 #include "SDL_ph_video.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
45 #include "SDL_ph_modes_c.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
46 #include "SDL_ph_image_c.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
47 #include "SDL_ph_events_c.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
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
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
50 #include "SDL_phyuv_c.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
51 #include "blank_cursor.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
52
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
53 static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
54 static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current,
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
55 int width, int height, int bpp, Uint32 flags);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
56 static int ph_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
57 static void ph_VideoQuit(_THIS);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
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
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
66 static int ph_Available(void)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
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
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
79 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
80
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
81 static SDL_VideoDevice *ph_CreateDevice(int devindex)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
82 {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
83 SDL_VideoDevice *device;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
84
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
85 /* Initialize all variables that we clean on shutdown */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
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
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
88 memset(device, 0, (sizeof *device));
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
89 device->hidden = (struct SDL_PrivateVideoData *)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
90 malloc((sizeof *device->hidden));
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
91 device->gl_data = NULL;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
92 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
93 if ( (device == NULL) || (device->hidden == NULL) ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
94 SDL_OutOfMemory();
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
95 ph_DeleteDevice(device);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
96 return(0);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
97 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
98 memset(device->hidden, 0, (sizeof *device->hidden));
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
99
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
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
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
102
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
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
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
105 device->VideoInit = ph_VideoInit;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
106 device->ListModes = ph_ListModes;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
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
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
109 device->UpdateMouse = NULL;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
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
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
112 device->VideoQuit = ph_VideoQuit;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
113 device->AllocHWSurface = ph_AllocHWSurface;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
114 device->CheckHWBlit = NULL;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
115 device->FillHWRect = NULL;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
116 device->SetHWColorKey = NULL;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
117 device->SetHWAlpha = NULL;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
118 device->LockHWSurface = ph_LockHWSurface;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
119 device->UnlockHWSurface = ph_UnlockHWSurface;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
120 device->FlipHWSurface = ph_FlipHWSurface;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
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
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
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
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
127 device->FreeWMCursor = ph_FreeWMCursor;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
128 device->CreateWMCursor = ph_CreateWMCursor;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
129 device->ShowWMCursor = ph_ShowWMCursor;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
130 device->WarpWMCursor = ph_WarpWMCursor;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
131 device->CheckMouseMode = ph_CheckMouseMode;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
132 device->InitOSKeymap = ph_InitOSKeymap;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
133 device->PumpEvents = ph_PumpEvents;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
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
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
147 device->free = ph_DeleteDevice;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
148
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
149 return device;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
150 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
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 = {
315
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
153 "photon", "QNX Photon video output",
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
154 ph_Available, ph_CreateDevice
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
155 };
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
156
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
157 static void ph_DeleteDevice(SDL_VideoDevice *device)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
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
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
163 free(device->hidden);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
164 device->hidden = NULL;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
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
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
168 free(device->gl_data);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
169 device->gl_data = NULL;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
170 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
171 free(device);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
172 device = NULL;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
173 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
174 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
175
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
176 static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
177 {
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
178 PgVideoModeInfo_t my_mode_info;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
179 PgHWCaps_t my_hwcaps;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
180
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
181 window=NULL;
320
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
182 desktoppal=SDLPH_PAL_NONE;
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
183 #ifdef HAVE_OPENGL
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
184 oglctx=NULL;
320
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
185 #endif /* HAVE_OPENGL */
315
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
186
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
187 captionflag=0;
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
188 old_video_mode=-1;
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
189 old_refresh_rate=-1;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
190
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
191 if (NULL == (event = malloc(EVENT_SIZE)))
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 exit(EXIT_FAILURE);
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
194 }
380
bce7171e7a85 Date: Wed, 22 May 2002 22:30:58 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 370
diff changeset
195 memset(event, 0x00, EVENT_SIZE);
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
196
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
197 /* Create the blank cursor */
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
198 SDL_BlankCursor = this->CreateWMCursor(this, blank_cdata, blank_cmask,
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
199 (int)BLANK_CWIDTH, (int)BLANK_CHEIGHT,
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
200 (int)BLANK_CHOTX, (int)BLANK_CHOTY);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
201
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
202 if (SDL_BlankCursor == NULL)
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
203 {
380
bce7171e7a85 Date: Wed, 22 May 2002 22:30:58 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 370
diff changeset
204 printf("ph_VideoInit(): could not create blank cursor !\n");
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
205 }
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
206
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
207 if (PgGetGraphicsHWCaps(&my_hwcaps) < 0)
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
208 {
380
bce7171e7a85 Date: Wed, 22 May 2002 22:30:58 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 370
diff changeset
209 fprintf(stderr,"ph_VideoInit(): GetGraphicsHWCaps failed !\n");
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
210 }
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
211
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
212 if (PgGetVideoModeInfo(my_hwcaps.current_video_mode, &my_mode_info) < 0)
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
213 {
380
bce7171e7a85 Date: Wed, 22 May 2002 22:30:58 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 370
diff changeset
214 fprintf(stderr,"ph_VideoInit(): PgGetVideoModeInfo failed !\n");
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
215 }
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 /* We need to return BytesPerPixel as it in used by CreateRGBsurface */
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
218 vformat->BitsPerPixel = my_mode_info.bits_per_pixel;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
219 vformat->BytesPerPixel = my_mode_info.bytes_per_scanline/my_mode_info.width;
315
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
220 desktopbpp = my_mode_info.bits_per_pixel;
320
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
221
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
222 /* save current palette */
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
223 if (desktopbpp==8)
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
224 {
320
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
225 PgGetPalette(ph_palette);
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
226 }
320
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
227
19
8cc4dbfab9ab Date: Thu, 19 Apr 2001 08:36:54 +0300
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
228 currently_fullscreen = 0;
8cc4dbfab9ab Date: Thu, 19 Apr 2001 08:36:54 +0300
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
229
8cc4dbfab9ab Date: Thu, 19 Apr 2001 08:36:54 +0300
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
230 this->info.wm_available = 1;
8cc4dbfab9ab Date: Thu, 19 Apr 2001 08:36:54 +0300
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
231
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
232 return 0;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
233 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
234
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
235 static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current,
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
236 int width, int height, int bpp, Uint32 flags)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
237 {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
238 PgDisplaySettings_t settings;
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
239 int mode;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
240 PtArg_t arg[32];
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
241 PhDim_t dim;
266
c6abdda2f666 Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
242 int rtnval;
c6abdda2f666 Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
243 int i;
c6abdda2f666 Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
244 unsigned long *tempptr;
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
245 int pargc;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
246
266
c6abdda2f666 Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
247 dim.w=width;
c6abdda2f666 Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
248 dim.h=height;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
249
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
250 /* Lock the event thread, in multi-threading environments */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
251 SDL_Lock_EventThread();
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
252
320
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
253 current->flags = flags;
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
254
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
255 /* create window if no OpenGL support selected */
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
256 if ((flags & SDL_OPENGL)!=SDL_OPENGL)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
257 {
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
258 pargc=0;
370
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
259
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
260 // prevent using HWSURFACE in window mode if desktop bpp != chosen bpp
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
261 if ((flags & SDL_HWSURFACE) && (!(flags & SDL_FULLSCREEN)))
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
262 {
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
263 if (desktopbpp!=bpp)
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
264 {
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
265 fprintf(stderr, "ph_SetVideoMode(): SDL_HWSURFACE available only with chosen bpp equal desktop bpp !\n");
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
266 return NULL;
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
267 }
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
268 }
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
269
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
270 PtSetArg(&arg[pargc++], Pt_ARG_DIM, &dim, 0);
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
271 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
272
320
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
273 /* enable window minimizing */
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
274 PtSetArg(&arg[pargc++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_TRUE, Ph_WM_HIDE);
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
275
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
276 /* remove border and caption if no frame flag selected */
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
277 if ((flags & SDL_NOFRAME) == SDL_NOFRAME)
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
278 {
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
279 PtSetArg(&arg[pargc++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_FALSE, Ph_WM_RENDER_TITLE | Ph_WM_RENDER_BORDER);
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
280 }
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
281 else
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
282 {
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
283 PtSetArg(&arg[pargc++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_TRUE, Ph_WM_RENDER_TITLE | Ph_WM_RENDER_BORDER);
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
284 }
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
285
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
286 /* if window is not resizable then remove resize handles and maximize button */
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
287 if ((flags & SDL_RESIZABLE) != SDL_RESIZABLE)
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
288 {
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
289 PtSetArg(&arg[pargc++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_FALSE, Ph_WM_RENDER_RESIZE | Ph_WM_RENDER_MAX);
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
290 PtSetArg(&arg[pargc++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_FALSE, Ph_WM_RESIZE | Ph_WM_MAX);
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
291 PtSetArg(&arg[pargc++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_FALSE, Ph_WM_RESIZE | Ph_WM_MAX);
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
292 }
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
293 else
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
294 {
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
295 PtSetArg(&arg[pargc++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_TRUE, Ph_WM_RENDER_RESIZE | Ph_WM_RENDER_MAX);
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
296 /* it is need to be Pt_FALSE to allow the application to process the resize callback */
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
297 PtSetArg(&arg[pargc++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_FALSE, Ph_WM_RESIZE | Ph_WM_MAX);
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
298 PtSetArg(&arg[pargc++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_TRUE, Ph_WM_RESIZE | Ph_WM_MAX);
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
299 }
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
300
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
301 if (window!=NULL)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
302 {
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
303 PtUnrealizeWidget(window);
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
304 PtDestroyWidget(window);
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
305 window=NULL;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
306 }
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
307
320
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
308 window=PtCreateWidget(PtWindow, NULL, pargc, arg);
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
309 PtRealizeWidget(window);
315
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
310
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
311 PtFlush();
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
312 }
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
313
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
314 #ifdef HAVE_OPENGL
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
315 if (flags & SDL_OPENGL)
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
316 {
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
317 /* ph_SetupOpenGLContext creates also window as need */
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
318 if (ph_SetupOpenGLContext(this, width, height, bpp, flags)==0)
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
319 {
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
320 /* setup OGL update function ... ugly method */
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
321 ph_ResizeImage(this, current, flags);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
322 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
323 else
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
324 {
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
325 /* if context creation fail, report no OpenGL to high level */
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
326 current->flags=(flags & (~SDL_OPENGL));
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
327 }
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
328 #else
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
329 if (flags & SDL_OPENGL) /* if no built-in OpenGL support */
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
330 {
370
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
331 fprintf(stderr, "ph_SetVideoMode(): no OpenGL support, try to recompile library.\n");
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
332 current->flags=(flags & (~SDL_OPENGL));
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
333 return NULL;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
334 #endif /* HAVE_OPENGL */
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
335 }
266
c6abdda2f666 Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
336 else
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
337 {
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
338 /* Initialize the window */
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
339 if (flags & SDL_FULLSCREEN) /* Direct Context , assume SDL_HWSURFACE also set */
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 /* Get the video mode and set it */
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
342 if (flags & SDL_ANYFORMAT)
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 if ((mode = get_mode_any_format(width, height, bpp)) == 0)
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
345 {
370
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
346 fprintf(stderr,"ph_SetVideoMode(): get_mode_any_format failed !\n");
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
347 exit(1);
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
348 }
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 else
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
351 {
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
352 if ((mode = get_mode(width, height, bpp)) == 0)
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
353 {
370
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
354 fprintf(stderr,"ph_SetVideoMode(): get_mode failed !\n");
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
355 exit(1);
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
356 }
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
357 }
315
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
358
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
359 if (bpp==8)
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
360 {
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
361 desktoppal=SDLPH_PAL_SYSTEM;
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
362 }
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
363
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
364 /* save old video mode caps */
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
365 PgGetVideoMode(&settings);
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
366 old_video_mode=settings.mode;
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
367 old_refresh_rate=settings.refresh;
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
368
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
369 /* setup new video mode */
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
370 settings.mode = mode;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
371 settings.refresh = 0;
315
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
372 settings.flags = 0;
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
373
315
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
374 if (PgSetVideoMode(&settings) < 0)
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
375 {
370
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
376 fprintf(stderr,"ph_SetVideoMode(): PgSetVideoMode failed !\n");
309
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
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
379 current->flags = (flags & (~SDL_RESIZABLE)); /* no resize for Direct Context */
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 /* Begin direct mode */
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
382 ph_EnterFullScreen(this);
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
383
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
384 } /* end fullscreen flag */
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
385 else
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
386 {
320
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
387 /* Use offscreen memory iff SDL_HWSURFACE flag is set */
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
388 if (flags & SDL_HWSURFACE)
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
389 {
320
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
390 /* no stretch blit in offscreen context */
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
391 current->flags = (flags & (~SDL_RESIZABLE));
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
392 }
320
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
393
315
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
394 /* using palette emulation code in window mode */
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
395 if (bpp==8)
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
396 {
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
397 if (desktopbpp>=15)
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
398 {
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
399 desktoppal=SDLPH_PAL_EMULATE;
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
400 }
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
401 else
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
402 {
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
403 desktoppal=SDLPH_PAL_SYSTEM;
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
404 }
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
405 }
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
406 else
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
407 {
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
408 desktoppal=SDLPH_PAL_NONE;
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
409 }
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
410 }
291
68a8a8237c09 Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 283
diff changeset
411
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
412 /* 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
413 if (bpp==8)
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
414 {
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
415 current->format->palette = malloc(sizeof(SDL_Palette));
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
416 memset(current->format->palette, 0, sizeof(SDL_Palette));
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
417 current->format->palette->ncolors = 256;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
418 current->format->palette->colors = (SDL_Color *)malloc(256 *sizeof(SDL_Color));
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
419 /* fill the palette */
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
420 rtnval = PgGetPalette(ph_palette);
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 tempptr = (unsigned long *)current->format->palette->colors;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
423
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
424 for(i=0; i<256; i++)
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
425 {
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
426 *tempptr = (((unsigned long)ph_palette[i]) << 8);
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
427 tempptr++;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
428 }
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
429 }
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
430
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
431 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
432
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
433 current->w = width;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
434 current->h = height;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
435 current->format->BitsPerPixel = bpp;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
436 current->format->BytesPerPixel = (bpp+7)/8;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
437 current->pitch = SDL_CalculatePitch(current);
370
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
438
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
439 /* Must call at least once it setup image planes */
370
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
440 rtnval = ph_ResizeImage(this, current, flags);
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
441
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
442 if (rtnval==-1)
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
443 {
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
444 fprintf(stderr,"ph_SetVideoMode(): ph_ResizeImage failed !\n");
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
445 return NULL;
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
446 }
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
447
315
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
448 /* delayed set caption call */
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
449 if (captionflag)
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
450 {
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
451 ph_SetCaption(this, this->wm_title, NULL);
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
452 }
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
453
320
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
454 /* finish window drawing */
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
455 PtFlush();
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
456
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
457 SDL_Unlock_EventThread();
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
458
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
459 /* We're done! */
315
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
460 return (current);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
461 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
462
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
463 static void ph_VideoQuit(_THIS)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
464 {
320
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
465 #ifdef HAVE_OPENGL
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
466 PhRegion_t region_info;
320
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
467 #endif /* HAVE_OPENGL */
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
468
283
3d8b6b9f1e18 Date: Mon, 18 Feb 2002 16:46:59 +1200
Sam Lantinga <slouken@libsdl.org>
parents: 279
diff changeset
469 ph_DestroyImage(this, SDL_VideoSurface);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
470
279
04351f59b051 Mike Gorchak added some QNX tweaks, including OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
471 if (currently_fullscreen)
04351f59b051 Mike Gorchak added some QNX tweaks, including OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
472 {
315
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
473 ph_LeaveFullScreen(this);
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
474 }
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
475
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
476 #ifdef HAVE_OPENGL
320
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
477 /* prevent double SEGFAULT during parachute mode */
315
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
478 if (this->screen)
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
479 {
315
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
480 if (((this->screen->flags & SDL_FULLSCREEN)==SDL_FULLSCREEN) &&
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
481 ((this->screen->flags & SDL_OPENGL)==SDL_OPENGL))
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
482 {
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
483 region_info.cursor_type=Ph_CURSOR_POINTER;
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
484 region_info.rid=PtWidgetRid(window);
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
485 PhRegionChange(Ph_REGION_CURSOR, 0, &region_info, NULL, NULL);
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
486 }
279
04351f59b051 Mike Gorchak added some QNX tweaks, including OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
487 }
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
488
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
489 PtFlush();
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
490 #endif /* HAVE_OPENGL */
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
491
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
492 if (window)
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
493 {
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
494 PtUnrealizeWidget(window);
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
495 PtDestroyWidget(window);
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
496 window=NULL;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
497 }
315
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
498
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
499 /* restore palette */
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
500 if (desktoppal!=SDLPH_PAL_NONE)
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
501 {
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
502 PgSetPalette(ph_palette, 0, 0, _Pg_MAX_PALETTE, Pg_PALSET_GLOBAL | Pg_PALSET_FORCE_EXPOSE, 0);
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
503 }
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
504
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
505 #ifdef HAVE_OPENGL
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
506 if (oglctx)
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
507 {
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
508 PhDCSetCurrent(NULL);
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
509 PhDCRelease(oglctx);
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
510 oglctx=NULL;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
511 }
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
512 #endif /* HAVE_OPENGL */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
513 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
514
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
515 static int ph_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
516 {
315
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
517 int i;
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
518 PhPoint_t point={0, 0};
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
519 PgColor_t syspalph[_Pg_MAX_PALETTE];
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
520
315
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
521 /* palette emulation code, using palette of the PhImage_t struct */
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
522 if (desktoppal==SDLPH_PAL_EMULATE)
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
523 {
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
524 if ((SDL_Image) && (SDL_Image->palette))
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
525 {
315
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
526 for (i=firstcolor; i<firstcolor+ncolors; i++)
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
527 {
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
528 SDL_Image->palette[i] = 0x00000000UL;
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
529 SDL_Image->palette[i] |= colors[i-firstcolor].r<<16;
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
530 SDL_Image->palette[i] |= colors[i-firstcolor].g<<8;
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
531 SDL_Image->palette[i] |= colors[i-firstcolor].b;
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
532 }
370
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
533
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
534 /* image needs to be redrawed, very slow method */
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
535 PgDrawPhImage(&point, SDL_Image, 0);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
536 }
315
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
537 }
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
538 else
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
539 {
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
540 if (desktoppal==SDLPH_PAL_SYSTEM)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
541 {
315
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
542 for (i=firstcolor; i<firstcolor+ncolors; i++)
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
543 {
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
544 syspalph[i] = 0x00000000UL;
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
545 syspalph[i] |= colors[i-firstcolor].r<<16;
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
546 syspalph[i] |= colors[i-firstcolor].g<<8;
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
547 syspalph[i] |= colors[i-firstcolor].b;
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
548 }
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
549
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
550 if ((this->screen->flags & SDL_FULLSCREEN) != SDL_FULLSCREEN)
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
551 {
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
552 /* window mode must use soft palette */
320
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
553 PgSetPalette((PgColor_t*)&syspalph[firstcolor], 0, firstcolor, ncolors, Pg_PALSET_SOFT, 0);
315
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
554 /* image needs to be redrawed, very slow method */
370
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
555 if (SDL_Image)
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
556 {
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
557 PgDrawPhImage(&point, SDL_Image, 0);
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
558 }
315
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
559 }
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
560 else
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
561 {
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
562 /* fullscreen mode must use hardware palette */
320
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
563 PgSetPalette((PgColor_t*)&syspalph[firstcolor], 0, firstcolor, ncolors, Pg_PALSET_GLOBAL, 0);
315
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
564 }
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
565 }
315
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
566 else
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
567 {
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
568 /* SDLPH_PAL_NONE do nothing */
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
569 }
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
570 }
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
571
3333b6e68289 Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 309
diff changeset
572 return 1;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
573 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
574
279
04351f59b051 Mike Gorchak added some QNX tweaks, including OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
575 #ifdef HAVE_OPENGL
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
576
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
577 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
578 {
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
579 PtArg_t args[8];
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
580 PhDim_t dim;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
581 uint64_t OGLAttrib[PH_OGL_MAX_ATTRIBS];
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
582 int OGLargc;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
583 int pargc;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
584
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
585 dim.w=width;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
586 dim.h=height;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
587
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
588 if (oglctx!=NULL)
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
589 {
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
590 PhDCSetCurrent(NULL);
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
591 PhDCRelease(oglctx);
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
592 oglctx=NULL;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
593 }
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 OGLargc=0;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
596 if (this->gl_config.depth_size)
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 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_DEPTH_BITS;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
599 OGLAttrib[OGLargc++]=this->gl_config.depth_size;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
600 }
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
601 if (this->gl_config.stencil_size)
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
602 {
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
603 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_STENCIL_BITS;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
604 OGLAttrib[OGLargc++]=this->gl_config.stencil_size;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
605 }
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
606 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FORCE_SW;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
607 if (flags & SDL_FULLSCREEN)
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
608 {
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
609 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FULLSCREEN;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
610 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_DIRECT;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
611 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FULLSCREEN_BEST;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
612 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FULLSCREEN_CENTER;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
613 }
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
614 OGLAttrib[OGLargc++]=PHOGL_ATTRIB_NONE;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
615
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
616 if (this->gl_config.double_buffer)
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
617 {
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
618 oglctx=PdCreateOpenGLContext(2, &dim, 0, OGLAttrib);
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
619 }
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
620 else
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
621 {
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
622 oglctx=PdCreateOpenGLContext(1, &dim, 0, OGLAttrib);
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
623 }
320
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
624
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
625 if (oglctx==NULL)
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
626 {
370
ba72f259bc88 Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 320
diff changeset
627 fprintf(stderr,"ph_SetupOpenGLContext(): cannot create OpenGL context.\n");
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
628 return (-1);
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
629 }
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
630
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
631 PhDCSetCurrent(oglctx);
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
632
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
633 pargc=0;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
634
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
635 PtSetArg(&args[pargc++], Pt_ARG_DIM, &dim, 0);
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
636 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
637 PtSetArg(&args[pargc++], Pt_ARG_FILL_COLOR, Pg_BLACK, 0);
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
638
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
639 if (flags & SDL_FULLSCREEN)
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
640 {
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
641 PhPoint_t pos;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
642
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
643 pos.x=0;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
644 pos.y=0;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
645
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
646 PtSetArg(&args[pargc++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_FALSE, ~0);
320
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
647 PtSetArg(&args[pargc++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_TRUE, Ph_WM_FFRONT | Ph_WM_CLOSE | Ph_WM_TOFRONT | Ph_WM_CONSWITCH);
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
648 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
649 PtSetArg(&args[pargc++], Pt_ARG_POS, &pos, 0);
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
650 }
320
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
651 else
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
652 {
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
653 /* remove border and caption if no frame flag selected */
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
654 if ((flags & SDL_NOFRAME) == SDL_NOFRAME)
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
655 {
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
656 PtSetArg(&args[pargc++], Pt_ARG_WINDOW_RENDER_FLAGS, 0, Ph_WM_RENDER_TITLE | Ph_WM_RENDER_BORDER);
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
657 }
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
658 else
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
659 {
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
660 /* if window is not resizable then remove resize handles */
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
661 if ((flags & SDL_RESIZABLE) != SDL_RESIZABLE)
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
662 {
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
663 PtSetArg(&args[pargc++], Pt_ARG_WINDOW_RENDER_FLAGS, 0, Ph_WM_RENDER_RESIZE);
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
664 }
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
665 }
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
666 }
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
667
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
668 if (window!=NULL)
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
669 {
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
670 PtUnrealizeWidget(window);
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
671 PtDestroyWidget(window);
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
672 window=NULL;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
673 }
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
674
320
66f815c147ed Date: Thu, 28 Mar 2002 09:20:03 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 315
diff changeset
675 window=PtCreateWidget(PtWindow, NULL, pargc, args);
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
676 PtRealizeWidget(window);
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
677
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
678 /* disable mouse for fullscreen */
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
679 if (flags & SDL_FULLSCREEN)
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
680 {
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
681 PhRegion_t region_info;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
682
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
683 region_info.cursor_type=Ph_CURSOR_NONE;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
684 region_info.rid=PtWidgetRid(window);
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
685 PhRegionChange(Ph_REGION_CURSOR, 0, &region_info, NULL, NULL);
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
686 }
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
687
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
688 PtFlush();
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
689
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
690 return 0;
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
691 }
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
692
266
c6abdda2f666 Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
693 void ph_GL_SwapBuffers(_THIS)
c6abdda2f666 Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
694 {
291
68a8a8237c09 Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 283
diff changeset
695 PgSetRegion(PtWidgetRid(window));
309
2de77f7b7a28 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
696 PdOpenGLContextSwapBuffers(oglctx);
266
c6abdda2f666 Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
697 }
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
698
291
68a8a8237c09 Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 283
diff changeset
699 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
700 {
68a8a8237c09 Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 283
diff changeset
701 switch (attrib)
68a8a8237c09 Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 283
diff changeset
702 {
68a8a8237c09 Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 283
diff changeset
703 case SDL_GL_DOUBLEBUFFER:
68a8a8237c09 Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 283
diff changeset
704 *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
705 break;
68a8a8237c09 Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 283
diff changeset
706 case SDL_GL_STENCIL_SIZE:
68a8a8237c09 Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 283
diff changeset
707 *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
708 break;
68a8a8237c09 Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 283
diff changeset
709 case SDL_GL_DEPTH_SIZE:
68a8a8237c09 Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 283
diff changeset
710 *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
711 break;
68a8a8237c09 Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 283
diff changeset
712 default:
68a8a8237c09 Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 283
diff changeset
713 *value=0;
68a8a8237c09 Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 283
diff changeset
714 return(-1);
68a8a8237c09 Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 283
diff changeset
715 }
68a8a8237c09 Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 283
diff changeset
716 return 0;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
717 }
291
68a8a8237c09 Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 283
diff changeset
718
68a8a8237c09 Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 283
diff changeset
719 #endif /* HAVE_OPENGL */