Mercurial > sdl-ios-xcode
comparison src/video/cocoa/SDL_cocoavideo.m @ 1931:103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Note that SDLmain is no longer necessary on Mac OS X. :)
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 23 Jul 2006 09:11:10 +0000 |
parents | |
children | 7ee5297340f7 |
comparison
equal
deleted
inserted
replaced
1930:9483df98e011 | 1931:103c6fec2a60 |
---|---|
1 /* | |
2 SDL - Simple DirectMedia Layer | |
3 Copyright (C) 1997-2006 Sam Lantinga | |
4 | |
5 This library is free software; you can redistribute it and/or | |
6 modify it under the terms of the GNU Lesser General Public | |
7 License as published by the Free Software Foundation; either | |
8 version 2.1 of the License, or (at your option) any later version. | |
9 | |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 Lesser General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU Lesser General Public | |
16 License along with this library; if not, write to the Free Software | |
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
18 | |
19 Sam Lantinga | |
20 slouken@libsdl.org | |
21 */ | |
22 #include "SDL_config.h" | |
23 | |
24 #include "SDL_cocoavideo.h" | |
25 | |
26 /* Initialization/Query functions */ | |
27 static int Cocoa_VideoInit(_THIS); | |
28 static void Cocoa_VideoQuit(_THIS); | |
29 | |
30 /* Cocoa driver bootstrap functions */ | |
31 | |
32 static int | |
33 Cocoa_Available(void) | |
34 { | |
35 return (1); | |
36 } | |
37 | |
38 static void | |
39 Cocoa_DeleteDevice(SDL_VideoDevice * device) | |
40 { | |
41 SDL_VideoData *data = (SDL_VideoData *) device->driverdata; | |
42 | |
43 SDL_free(device->driverdata); | |
44 SDL_free(device); | |
45 } | |
46 | |
47 static SDL_VideoDevice * | |
48 Cocoa_CreateDevice(int devindex) | |
49 { | |
50 SDL_VideoDevice *device; | |
51 SDL_VideoData *data; | |
52 | |
53 Cocoa_RegisterApp(); | |
54 | |
55 /* Initialize all variables that we clean on shutdown */ | |
56 device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); | |
57 if (device) { | |
58 data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData)); | |
59 } | |
60 if (!device || !data) { | |
61 SDL_OutOfMemory(); | |
62 if (device) { | |
63 SDL_free(device); | |
64 } | |
65 return NULL; | |
66 } | |
67 device->driverdata = data; | |
68 | |
69 /* Set the function pointers */ | |
70 device->VideoInit = Cocoa_VideoInit; | |
71 device->VideoQuit = Cocoa_VideoQuit; | |
72 device->GetDisplayModes = Cocoa_GetDisplayModes; | |
73 device->SetDisplayMode = Cocoa_SetDisplayMode; | |
74 device->PumpEvents = Cocoa_PumpEvents; | |
75 | |
76 /* | |
77 device->CreateWindow = Cocoa_CreateWindow; | |
78 device->CreateWindowFrom = Cocoa_CreateWindowFrom; | |
79 device->SetWindowTitle = Cocoa_SetWindowTitle; | |
80 device->SetWindowPosition = Cocoa_SetWindowPosition; | |
81 device->SetWindowSize = Cocoa_SetWindowSize; | |
82 device->ShowWindow = Cocoa_ShowWindow; | |
83 device->HideWindow = Cocoa_HideWindow; | |
84 device->RaiseWindow = Cocoa_RaiseWindow; | |
85 device->MaximizeWindow = Cocoa_MaximizeWindow; | |
86 device->MinimizeWindow = Cocoa_MinimizeWindow; | |
87 device->RestoreWindow = Cocoa_RestoreWindow; | |
88 device->SetWindowGrab = Cocoa_SetWindowGrab; | |
89 device->DestroyWindow = Cocoa_DestroyWindow; | |
90 device->GetWindowWMInfo = Cocoa_GetWindowWMInfo; | |
91 #ifdef SDL_VIDEO_OPENGL | |
92 device->GL_LoadLibrary = Cocoa_GL_LoadLibrary; | |
93 device->GL_GetProcAddress = Cocoa_GL_GetProcAddress; | |
94 device->GL_GetWindowAttribute = Cocoa_GL_GetWindowAttribute; | |
95 device->GL_CreateContext = Cocoa_GL_CreateContext; | |
96 device->GL_MakeCurrent = Cocoa_GL_MakeCurrent; | |
97 device->GL_SetSwapInterval = Cocoa_GL_SetSwapInterval; | |
98 device->GL_GetSwapInterval = Cocoa_GL_GetSwapInterval; | |
99 device->GL_SwapWindow = Cocoa_GL_SwapWindow; | |
100 device->GL_DeleteContext = Cocoa_GL_DeleteContext; | |
101 #endif | |
102 */ | |
103 | |
104 device->free = Cocoa_DeleteDevice; | |
105 | |
106 return device; | |
107 } | |
108 | |
109 VideoBootStrap COCOA_bootstrap = { | |
110 "cocoa", "SDL Cocoa video driver", | |
111 Cocoa_Available, Cocoa_CreateDevice | |
112 }; | |
113 | |
114 | |
115 int | |
116 Cocoa_VideoInit(_THIS) | |
117 { | |
118 Cocoa_InitModes(_this); | |
119 Cocoa_InitKeyboard(_this); | |
120 Cocoa_InitMouse(_this); | |
121 return 0; | |
122 } | |
123 | |
124 void | |
125 Cocoa_VideoQuit(_THIS) | |
126 { | |
127 Cocoa_QuitModes(_this); | |
128 Cocoa_QuitKeyboard(_this); | |
129 Cocoa_QuitMouse(_this); | |
130 } | |
131 | |
132 /* vim: set ts=4 sw=4 expandtab: */ |