src/video/gem/SDL_gemvideo.h
author Patrice Mandin <patmandin@gmail.com>
Thu, 23 Feb 2006 21:51:10 +0000
changeset 1420 2405517b5eab
parent 1402 d910939febfa
child 1662 782fd950bd46
child 1857 417f2af2bd52
permissions -rw-r--r--
Added preliminary support for MiNT /dev/mouse driver (disabled atm)
slouken@281
     1
/*
slouken@281
     2
    SDL - Simple DirectMedia Layer
slouken@1312
     3
    Copyright (C) 1997-2006 Sam Lantinga
slouken@281
     4
slouken@281
     5
    This library is free software; you can redistribute it and/or
slouken@1312
     6
    modify it under the terms of the GNU Lesser General Public
slouken@281
     7
    License as published by the Free Software Foundation; either
slouken@1312
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@281
     9
slouken@281
    10
    This library is distributed in the hope that it will be useful,
slouken@281
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@281
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@1312
    13
    Lesser General Public License for more details.
slouken@281
    14
slouken@1312
    15
    You should have received a copy of the GNU Lesser General Public
slouken@1312
    16
    License along with this library; if not, write to the Free Software
slouken@1312
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@281
    18
slouken@281
    19
    Sam Lantinga
slouken@281
    20
    slouken@libsdl.org
slouken@281
    21
*/
slouken@1402
    22
#include "SDL_config.h"
slouken@281
    23
slouken@281
    24
#ifndef _SDL_gemvideo_h
slouken@281
    25
#define _SDL_gemvideo_h
slouken@281
    26
slouken@281
    27
#include "SDL_mutex.h"
slouken@1361
    28
#include "../SDL_sysvideo.h"
slouken@281
    29
slouken@281
    30
/* Hidden "this" pointer for the video functions */
slouken@281
    31
#define _THIS	SDL_VideoDevice *this
slouken@281
    32
slouken@281
    33
/* Functions prototypes */
slouken@281
    34
void GEM_wind_redraw(_THIS, int winhandle, short *inside);
slouken@281
    35
slouken@281
    36
/* Private display data */
slouken@281
    37
patmandin@736
    38
#define B2S_C2P_1TO2		(1<<0)	/* C2P convert buffer 1 to buffer 2 */
patmandin@736
    39
#define B2S_C2P_1TOS		(1<<1)	/* C2P convert buffer 1 to screen */
patmandin@736
    40
#define B2S_VROCPYFM_1TOS	(1<<2)	/* vro_cpyfm() buffer 1 to screen */
patmandin@736
    41
#define B2S_VROCPYFM_2TOS	(1<<3)	/* vro_cpyfm() buffer 2 to screen */
patmandin@736
    42
slouken@281
    43
#define SDL_NUMMODES	1		/* Fullscreen */
slouken@281
    44
slouken@281
    45
struct SDL_PrivateVideoData {
patmandin@736
    46
	Uint16	buf2scr_ops;		/* Operations to get buffer to screen */
patmandin@736
    47
    void *buffer1;				/* Our shadow buffers */
patmandin@736
    48
	void *buffer2;
patmandin@736
    49
slouken@281
    50
	/* VDI infos */
slouken@281
    51
	short vdi_handle;			/* VDI handle */
slouken@281
    52
	short full_w, full_h;		/* Fullscreen size */
patmandin@736
    53
    short bpp;					/* Colour depth */
patmandin@736
    54
	short pixelsize;			/* Bytes per pixel */
patmandin@736
    55
	short old_numcolors;		/* Number of colors in saved palette */
slouken@281
    56
	Uint16 pitch;				/* Line length */
patmandin@736
    57
	Uint16 format;				/* Screen format */
slouken@281
    58
	void *screen;				/* Screen address */
slouken@281
    59
	Uint32 red, green, blue, alpha;	/* Screen components */
slouken@281
    60
	Uint32 screensize;
patmandin@736
    61
	short	blit_coords[8];		/* Coordinates for bitblt */
slouken@281
    62
	MFDB	src_mfdb, dst_mfdb;	/* VDI MFDB for bitblt */
patmandin@736
    63
	Uint16 old_palette[256][3];	/* Saved current palette */
patmandin@1074
    64
	Uint16 cur_palette[256][3];	/* SDL application palette */
patmandin@1074
    65
								/* Function to set/restore palette */
patmandin@1074
    66
	void (*setpalette)(_THIS, Uint16 newpal[256][3]);
patmandin@736
    67
slouken@557
    68
	/* GEM infos */
slouken@281
    69
	short desk_x, desk_y;		/* Desktop properties */
slouken@281
    70
	short desk_w, desk_h;
slouken@281
    71
	short win_handle;			/* Our window handle */
slouken@281
    72
	int window_type;			/* Window type */
slouken@281
    73
	const char *title_name;		/* Window title */
slouken@281
    74
	const char *icon_name;		/* Icon title */
slouken@281
    75
	short version;				/* AES version */
slouken@281
    76
	short wfeatures;			/* AES window features */
patmandin@736
    77
	SDL_bool refresh_name;		/* Change window title ? */
slouken@281
    78
	SDL_bool window_fulled;		/* Window maximized ? */
slouken@281
    79
	SDL_bool mouse_relative;	/* Report relative mouse movement */
slouken@281
    80
	SDL_bool locked;			/* AES locked for fullscreen ? */
patmandin@964
    81
	SDL_bool lock_redraw;		/* Prevent redraw till buffers are setup */
patmandin@736
    82
	short message[8];			/* To self-send an AES message */
patmandin@1069
    83
	void *menubar;				/* Menu bar save buffer when going fullscreen */
patmandin@1420
    84
	SDL_bool use_dev_mouse;		/* Use /dev/mouse ? */
patmandin@926
    85
patmandin@926
    86
	SDL_bool fullscreen;		/* Fullscreen or windowed mode ? */
slouken@281
    87
	SDL_Rect *SDL_modelist[SDL_NUMMODES+1];	/* Mode list */
patmandin@736
    88
	SDL_Surface *icon;			/* The icon */
slouken@281
    89
};
slouken@281
    90
slouken@281
    91
/* Hidden structure -> variables names */
slouken@281
    92
#define VDI_handle			(this->hidden->vdi_handle)
slouken@281
    93
#define VDI_w				(this->hidden->full_w)
slouken@281
    94
#define VDI_h				(this->hidden->full_h)
slouken@281
    95
#define VDI_bpp				(this->hidden->bpp)
slouken@281
    96
#define VDI_pixelsize		(this->hidden->pixelsize)
slouken@281
    97
#define VDI_oldnumcolors	(this->hidden->old_numcolors)
slouken@281
    98
#define VDI_oldpalette		(this->hidden->old_palette)
patmandin@1074
    99
#define VDI_curpalette		(this->hidden->cur_palette)
patmandin@1074
   100
#define VDI_setpalette		(this->hidden->setpalette)
slouken@281
   101
#define VDI_pitch			(this->hidden->pitch)
slouken@281
   102
#define VDI_format			(this->hidden->format)
slouken@281
   103
#define VDI_screen			(this->hidden->screen)
slouken@281
   104
#define VDI_redmask			(this->hidden->red)
slouken@281
   105
#define VDI_greenmask		(this->hidden->green)
slouken@281
   106
#define VDI_bluemask		(this->hidden->blue)
slouken@281
   107
#define VDI_alphamask		(this->hidden->alpha)
slouken@281
   108
#define VDI_screensize		(this->hidden->screensize)
slouken@281
   109
#define VDI_src_mfdb		(this->hidden->src_mfdb)
slouken@281
   110
#define VDI_dst_mfdb		(this->hidden->dst_mfdb)
slouken@281
   111
#define VDI_blit_coords		(this->hidden->blit_coords)
slouken@557
   112
slouken@281
   113
#define GEM_desk_x			(this->hidden->desk_x)
slouken@281
   114
#define GEM_desk_y			(this->hidden->desk_y)
slouken@281
   115
#define GEM_desk_w			(this->hidden->desk_w)
slouken@281
   116
#define GEM_desk_h			(this->hidden->desk_h)
slouken@281
   117
#define GEM_handle			(this->hidden->win_handle)
slouken@281
   118
#define GEM_win_type		(this->hidden->window_type)
slouken@281
   119
#define GEM_title_name		(this->hidden->title_name)
slouken@281
   120
#define GEM_icon_name		(this->hidden->icon_name)
patmandin@736
   121
#define GEM_refresh_name	(this->hidden->refresh_name)
slouken@281
   122
#define GEM_version			(this->hidden->version)
slouken@281
   123
#define GEM_wfeatures		(this->hidden->wfeatures)
slouken@281
   124
#define GEM_win_fulled		(this->hidden->window_fulled)
slouken@281
   125
#define GEM_mouse_relative	(this->hidden->mouse_relative)
slouken@281
   126
#define GEM_locked			(this->hidden->locked)
patmandin@964
   127
#define GEM_lock_redraw		(this->hidden->lock_redraw)
patmandin@736
   128
#define GEM_message			(this->hidden->message)
slouken@281
   129
#define SDL_modelist		(this->hidden->SDL_modelist)
patmandin@736
   130
#define GEM_icon			(this->hidden->icon)
patmandin@926
   131
#define GEM_fullscreen		(this->hidden->fullscreen)
patmandin@1069
   132
#define GEM_menubar			(this->hidden->menubar)
patmandin@1420
   133
#define GEM_usedevmouse		(this->hidden->use_dev_mouse)
patmandin@736
   134
patmandin@736
   135
#define GEM_buffer1			(this->hidden->buffer1)
patmandin@736
   136
#define GEM_buffer2			(this->hidden->buffer2)
patmandin@736
   137
#define GEM_bufops			(this->hidden->buf2scr_ops)
patmandin@736
   138
patmandin@736
   139
#define VDI_FBMASK(amask, rmask, gmask, bmask) \
patmandin@736
   140
	VDI_alphamask = (amask); \
patmandin@736
   141
	VDI_redmask = (rmask); \
patmandin@736
   142
	VDI_greenmask = (gmask); \
patmandin@736
   143
	VDI_bluemask = (bmask);
patmandin@736
   144
patmandin@736
   145
/*
patmandin@736
   146
	Possible buffer to screen operations:
patmandin@736
   147
patmandin@736
   148
	TC: 8 (chunky),15,16,24,32 bpp
patmandin@736
   149
	8I: 8 bpp planes
patmandin@736
   150
	FB: screen framebuffer address available
patmandin@736
   151
	FS: fullscreen
patmandin@736
   152
patmandin@736
   153
	TC, FB, FS:
patmandin@736
   154
		- draw to screen
patmandin@736
   155
	8I, FB, FS:
patmandin@736
   156
		- draw to buffer 1
patmandin@736
   157
		- C2P from buffer 1 to screen
patmandin@736
   158
patmandin@736
   159
	TC, !FB, FS:
patmandin@736
   160
		- draw to buffer 1
patmandin@736
   161
		- vro_cpyfm() from buffer 1 to screen
patmandin@736
   162
	8I, !FB, FS:
patmandin@736
   163
		- draw to buffer 1
patmandin@736
   164
		- C2P from buffer 1 to buffer 2
patmandin@736
   165
		- vro_cpyfm() from buffer 2 to screen
patmandin@736
   166
patmandin@736
   167
	TC, FB, !FS:
patmandin@736
   168
		- draw to buffer 1
patmandin@736
   169
		- vro_cpyfm() from buffer 1 to screen
patmandin@736
   170
	8I, FB, !FS:
patmandin@736
   171
		- draw to buffer 1
patmandin@736
   172
		- C2P from buffer 1 to buffer 2
patmandin@736
   173
		- vro_cpyfm() from buffer 2 to screen
patmandin@736
   174
patmandin@736
   175
	TC, !FB, !FS:
patmandin@736
   176
		- draw to buffer 1
patmandin@736
   177
		- vro_cpyfm() from buffer 1 to screen
patmandin@736
   178
	8I, !FB, !FS:
patmandin@736
   179
		- draw to buffer 1
patmandin@736
   180
		- C2P from buffer 1 to buffer 2
patmandin@736
   181
		- vro_cpyfm() from buffer 2 to screen
patmandin@736
   182
*/
slouken@281
   183
slouken@281
   184
#endif /* _SDL_gemvideo_h */