Mercurial > sdl-ios-xcode
annotate src/video/gem/SDL_gemvideo.c @ 2866:e532417a6977
Fixed SDL 1.2 compatibility problem.
The API specifies that SDL_OpenAudio() will fill out the 'desired' audio spec
with the correct samples and size set by the driver. This value is important
since it may be used by applications that size audio buffers, etc.
However, we want to allow advanced applications to call SDL_OpenAudioDevice()
which gets passed a const 'desired' parameter, and have the correct data filled
into the 'obtained' parameter, possibly allowing or not allowing format changes.
So... 'obtained' becomes the audio format the user callback is expected to use,
and we add flags to allow the application to specify which format changes are
allowed.
Note: We really need to add a way to query the 'obtained' audio spec.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 13 Dec 2008 06:36:47 +0000 |
parents | 99210400e8b9 |
children |
rev | line source |
---|---|
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
2859 | 3 Copyright (C) 1997-2009 Sam Lantinga |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1239
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1239
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1239
diff
changeset
|
13 Lesser General Public License for more details. |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1239
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1239
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1239
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 Sam Lantinga |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 slouken@libsdl.org |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 */ |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
22 #include "SDL_config.h" |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 /* |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
25 GEM video driver |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
26 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
27 Patrice Mandin |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
28 and work from |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
29 Olivier Landemarre, Johan Klockars, Xavier Joubert, Claude Attard |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
30 */ |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 /* Mint includes */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
33 #include <gem.h> |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
34 #include <gemx.h> |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
35 #include <mint/osbind.h> |
557
0ce5a68278fd
Updated Atari port for new system headers (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
508
diff
changeset
|
36 #include <mint/cookie.h> |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
38 #include "SDL_video.h" |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
39 #include "SDL_mouse.h" |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
40 #include "../SDL_sysvideo.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
41 #include "../SDL_pixels_c.h" |
989
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
988
diff
changeset
|
42 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 #include "SDL_gemvideo.h" |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 /* Initialization/Query functions */ |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
46 static int GEM_VideoInit(_THIS); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 static void GEM_VideoQuit(_THIS); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
48 |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
49 static void GEM_GL_SwapBuffers(_THIS); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
50 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
52 static int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
53 GEM_Available(void) |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
54 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
55 /* Test if AES available */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
56 if (appl_init() == -1) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
57 return 0; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
58 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
59 appl_exit(); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
60 return 1; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
61 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
62 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
63 static void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
64 GEM_DeleteDevice(SDL_VideoDevice * device) |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
65 { |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
66 SDL_VideoData *data = (SDL_VideoData *) device->driverdata; |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
67 |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
68 SDL_free(device->driverdata); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
69 SDL_free(device); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
70 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
72 static SDL_VideoDevice * |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
73 GEM_CreateDevice(int devindex) |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
74 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
75 SDL_VideoDevice *device; |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
76 SDL_VideoData *data; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
77 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
78 /* Initialize all variables that we clean on shutdown */ |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
79 device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
80 if (device) { |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
81 data = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData)); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
82 } |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
83 if (!device || !data) { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
84 SDL_OutOfMemory(); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
85 if (device) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
86 SDL_free(device); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
87 } |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
88 return NULL; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
89 } |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
90 device->driverdata = data; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
91 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
92 /* Set the function pointers */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
93 device->VideoInit = GEM_VideoInit; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
94 device->VideoQuit = GEM_VideoQuit; |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
95 device->GetDisplayModes = GEM_GetDisplayModes; |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
96 device->SetDisplayMode = GEM_SetDisplayMode; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
97 device->PumpEvents = GEM_PumpEvents; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
98 |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
99 device->CreateWindow = GEM_CreateWindow; |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
100 device->CreateWindowFrom = GEM_CreateWindowFrom; |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
101 device->SetWindowTitle = GEM_SetWindowTitle; |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
102 device->SetWindowPosition = GEM_SetWindowPosition; |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
103 device->SetWindowSize = GEM_SetWindowSize; |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
104 device->ShowWindow = GEM_ShowWindow; |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
105 device->HideWindow = GEM_HideWindow; |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
106 device->RaiseWindow = GEM_RaiseWindow; |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
107 device->MaximizeWindow = GEM_MaximizeWindow; |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
108 device->MinimizeWindow = GEM_MinimizeWindow; |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
109 device->RestoreWindow = GEM_RestoreWindow; |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
110 device->SetWindowGrab = GEM_SetWindowGrab; |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
111 device->DestroyWindow = GEM_DestroyWindow; |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
112 device->GetWindowWMInfo = GEM_GetWindowWMInfo; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
113 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
114 #if SDL_VIDEO_OPENGL |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
115 device->GL_LoadLibrary = SDL_AtariGL_LoadLibrary; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
116 device->GL_GetProcAddress = SDL_AtariGL_GetProcAddress; |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
117 device->GL_CreateContext = SDL_AtariGL_CreateContext; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
118 device->GL_MakeCurrent = SDL_AtariGL_MakeCurrent; |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
119 device->GL_SetSwapInterval = SDL_AtariGL_SetSwapInterval; |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
120 device->GL_GetSwapInterval = SDL_AtariGL_GetSwapInterval; |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
121 device->GL_SwapWindow = GEM_GL_SwapWindow; |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
122 device->GL_DeleteContext = SDL_AtariGL_DeleteContext; |
984
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
123 #endif |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
124 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
125 device->free = GEM_DeleteDevice; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
127 return device; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
128 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
129 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
130 VideoBootStrap GEM_bootstrap = { |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
131 "gem", "Atari GEM video driver", |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
132 GEM_Available, GEM_CreateDevice |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
133 }; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
135 int |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
136 GEM_VideoInit(_THIS) |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
137 { |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
138 int i; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
139 short work_in[12], work_out[272], dummy; |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
140 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
141 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
142 /* Open AES (Application Environment Services) */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
143 if (appl_init() == -1) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
144 fprintf(stderr, "Can not open AES\n"); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
145 return 1; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
146 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
147 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
148 /* Read version and features */ |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
149 if (aes_global[0] >= 0x0410) { |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
150 short ap_gout[4]; |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
151 |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
152 data->wfeatures = 0; |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
153 if (appl_getinfo(AES_WINDOW, &ap_gout[0], &ap_gout[1], &ap_gout[2], |
2199 | 154 &ap_gout[3]) == 0) { |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
155 data->wfeatures = ap_gout[0]; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
156 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
157 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
158 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
159 /* Ask VDI physical workstation handle opened by AES */ |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
160 data->vdi_handle = graf_handle(&dummy, &dummy, &dummy, &dummy); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
161 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
162 /* Open virtual VDI workstation */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
163 work_in[0] = Getrez() + 2; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
164 for (i = 1; i < 10; i++) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
165 work_in[i] = 1; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
166 work_in[10] = 2; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
167 |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
168 v_opnvwk(work_in, &(data->vdi_handle), work_out); |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
169 if (data->vdi_handle == 0) { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
170 fprintf(stderr, "Can not open VDI virtual workstation\n"); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
171 return 1; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
172 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
173 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
174 /* Set mouse cursor to arrow */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
175 graf_mouse(ARROW, NULL); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
176 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
177 /* Setup VDI fill functions */ |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
178 vsf_color(data->vdi_handle, 0); |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
179 vsf_interior(data->vdi_handle, 1); |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
180 vsf_perimeter(data->vdi_handle, 0); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
181 |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
182 GEM_InitModes(_this); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
183 |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
184 GEM_InitKeyboard(_this); |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
185 GEM_InitMouse(_this); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
186 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
187 return (0); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
188 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
189 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
190 void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
191 GEM_VideoQuit(_THIS) |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
192 { |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
193 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; |
305
9c6613983e85
Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
194 |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
195 GEM_QuitMouse(_this); |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
196 GEM_QuitKeyboard(_this); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
197 |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
198 GEM_QuitModes(_this); |
992
0324ce32b2d9
Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents:
991
diff
changeset
|
199 |
2189
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
200 /* Close VDI workstation */ |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
201 if (data->vdi_handle) { |
f54670a477bb
Update GEM driver to new API, will have to fill the void later :)
Patrice Mandin <patmandin@gmail.com>
parents:
2120
diff
changeset
|
202 v_clsvwk(data->vdi_handle); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
203 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
204 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
205 appl_exit(); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
206 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
207 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1857
diff
changeset
|
208 /* vi: set ts=4 sw=4 expandtab: */ |