0
|
1 /*
|
|
2 SDL - Simple DirectMedia Layer
|
|
3 Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga
|
|
4
|
|
5 This library is free software; you can redistribute it and/or
|
|
6 modify it under the terms of the GNU Library General Public
|
|
7 License as published by the Free Software Foundation; either
|
|
8 version 2 of the License, or (at your option) any later version.
|
|
9
|
|
10 This library is distributed in the hope that it will be useful,
|
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
13 Library General Public License for more details.
|
|
14
|
|
15 You should have received a copy of the GNU Library General Public
|
|
16 License along with this library; if not, write to the Free
|
|
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
18
|
|
19 Sam Lantinga
|
|
20 slouken@devolution.com
|
|
21 */
|
|
22
|
|
23 #ifdef SAVE_RCSID
|
|
24 static char rcsid =
|
|
25 "@(#) $Id$";
|
|
26 #endif
|
|
27
|
|
28 #ifndef _SDL_cgxvideo_h
|
|
29 #define _SDL_cgxvideo_h
|
|
30
|
|
31
|
|
32 #include <stdio.h>
|
|
33 #include <stdlib.h>
|
|
34 #include <string.h>
|
|
35
|
|
36 #include <exec/exec.h>
|
|
37 #include <cybergraphx/cybergraphics.h>
|
|
38 #include <graphics/scale.h>
|
|
39 #include <graphics/gfx.h>
|
|
40 #include <intuition/intuition.h>
|
|
41 #ifdef __SASC
|
|
42 #include <proto/exec.h>
|
|
43 #include <proto/cybergraphics.h>
|
|
44 #include <proto/graphics.h>
|
|
45 #include <proto/intuition.h>
|
|
46 #include <proto/console.h>
|
|
47 #else
|
|
48 #include <inline/exec.h>
|
|
49 #include <inline/cybergraphics.h>
|
|
50 #include <inline/graphics.h>
|
|
51 #include <inline/intuition.h>
|
|
52 #include <inline/console.h>
|
|
53 #endif
|
|
54
|
|
55 #include "mydebug.h"
|
|
56 #include "SDL_mouse.h"
|
|
57 #include "SDL_sysvideo.h"
|
|
58
|
|
59 #define USE_CGX_WRITELUTPIXEL
|
|
60
|
|
61 /* Hidden "this" pointer for the video functions */
|
|
62 #define _THIS SDL_VideoDevice *this
|
|
63
|
|
64 /* Private display data */
|
|
65 struct SDL_PrivateVideoData {
|
|
66 struct Screen *Public_Display; /* Used for events and window management */
|
|
67 struct Screen *GFX_Display; /* Used for graphics and colormap stuff */
|
|
68 Uint32 SDL_VisualUnused; /* The visual used by our window */
|
|
69 struct Window *SDL_Window; /* Shared by both displays (no X security?) */
|
|
70 unsigned char *BlankCursor; /* The invisible cursor */
|
|
71
|
|
72 /* The variables used for displaying graphics */
|
|
73 Uint8 *Ximage; /* The X image for our window */
|
|
74 int swap_pixels; /* Flag: true if display is swapped endian */
|
|
75
|
|
76 /* The current width and height of the fullscreen mode */
|
|
77 int current_w;
|
|
78 int current_h;
|
|
79
|
|
80 /* Support for internal mouse warping */
|
|
81 struct {
|
|
82 int x;
|
|
83 int y;
|
|
84 } mouse_last;
|
|
85 struct {
|
|
86 int numerator;
|
|
87 int denominator;
|
|
88 int threshold;
|
|
89 } mouse_accel;
|
|
90 int mouse_relative;
|
|
91
|
|
92 /* The current list of available video modes */
|
|
93 SDL_Rect **modelist;
|
|
94
|
|
95 /* available visuals of interest to us, sorted deepest first */
|
|
96 struct {
|
|
97 Uint32 visual;
|
|
98 int depth; /* number of significant bits/pixel */
|
|
99 int bpp; /* pixel quantum in bits */
|
|
100 } visuals[5]; /* at most entries for 8, 15, 16, 24 */
|
|
101 int nvisuals;
|
|
102
|
|
103 Uint32 vis; /* current visual in use */
|
|
104 int depth; /* current visual depth (not bpp) */
|
|
105 int BytesPerPixel;
|
|
106 int currently_fullscreen,same_format,dbuffer;
|
|
107
|
|
108 /* Automatic mode switching support (entering/leaving fullscreen) */
|
|
109 Uint32 switch_waiting;
|
|
110 Uint32 switch_time;
|
|
111
|
|
112 /* Prevent too many XSync() calls */
|
|
113 int blit_queued;
|
|
114
|
|
115 /* Colormap handling */
|
|
116 LONG Pens;
|
|
117 Sint32 *XPixels; /* A list of pixels that have been allocated, the size depends on the screen format */
|
|
118 struct ScreenBuffer *SB[2];
|
|
119 struct RastPort *RP;
|
|
120 short *iconcolors; /* List of colors used by the icon */
|
|
121 };
|
|
122
|
|
123 /* Old variable names */
|
|
124 #define local_X11 (this->hidden->local_X11)
|
|
125 #define SDL_Display (this->hidden->Public_Display)
|
|
126 #define GFX_Display (this->hidden->GFX_Display)
|
|
127 #define SDL_Screen DefaultScreen(this->hidden->Public_Display)
|
|
128
|
|
129 #define SDL_Visual (this->hidden->vis)
|
|
130
|
|
131 #define SDL_Root RootWindow(SDL_Display, SDL_Screen)
|
|
132 #define WMwindow (this->hidden->WMwindow)
|
|
133 #define FSwindow (this->hidden->FSwindow)
|
|
134 #define SDL_Window (this->hidden->SDL_Window)
|
|
135 #define WM_DELETE_WINDOW (this->hidden->WM_DELETE_WINDOW)
|
|
136 #define SDL_BlankCursor (this->hidden->BlankCursor)
|
|
137 #define SDL_Ximage (this->hidden->Ximage)
|
|
138 #define SDL_GC (this->hidden->gc)
|
|
139 #define swap_pixels (this->hidden->swap_pixels)
|
|
140 #define current_w (this->hidden->current_w)
|
|
141 #define current_h (this->hidden->current_h)
|
|
142 #define mouse_last (this->hidden->mouse_last)
|
|
143 #define mouse_accel (this->hidden->mouse_accel)
|
|
144 #define mouse_relative (this->hidden->mouse_relative)
|
|
145 #define SDL_modelist (this->hidden->modelist)
|
|
146 #define SDL_RastPort (this->hidden->RP)
|
|
147 #define saved_mode (this->hidden->saved_mode)
|
|
148 #define saved_view (this->hidden->saved_view)
|
|
149 #define currently_fullscreen (this->hidden->currently_fullscreen)
|
|
150 #define blit_queued (this->hidden->blit_queued)
|
|
151 #define SDL_DisplayColormap (this->hidden->GFX_Display->ViewPort.ColorMap)
|
|
152 #define SDL_XPixels (this->hidden->XPixels)
|
|
153 #define SDL_iconcolors (this->hidden->iconcolors)
|
|
154
|
|
155 extern int CGX_CreateWindow(_THIS, SDL_Surface *screen,
|
|
156 int w, int h, int bpp, Uint32 flags);
|
|
157 extern int CGX_ResizeWindow(_THIS,
|
|
158 SDL_Surface *screen, int w, int h, Uint32 flags);
|
|
159
|
|
160 extern void CGX_DestroyWindow(_THIS, SDL_Surface *screen);
|
|
161
|
|
162 extern struct Library *CyberGfxBase;
|
|
163 extern struct IntuitionBase *IntuitionBase;
|
|
164 extern struct GfxBase *GfxBase;
|
|
165 extern struct ExecBase *SysBase;
|
|
166 extern struct DosLibrary *DOSBase;
|
|
167
|
|
168 struct private_hwdata
|
|
169 {
|
|
170 struct BitMap *bmap;
|
|
171 APTR lock;
|
|
172 struct SDL_VideoDevice *videodata;
|
|
173 APTR mask;
|
|
174 };
|
|
175
|
|
176 int CGX_CheckHWBlit(_THIS,SDL_Surface *src,SDL_Surface *dst);
|
|
177 int CGX_FillHWRect(_THIS,SDL_Surface *dst,SDL_Rect *dstrect,Uint32 color);
|
|
178 int CGX_SetHWColorKey(_THIS,SDL_Surface *surface, Uint32 key);
|
|
179 #endif /* _SDL_x11video_h */
|