struct Palette > typedef Palette
This commit is contained in:
parent
0be723ddab
commit
119865e6e1
2 changed files with 35 additions and 37 deletions
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
// Little note: this should become the new video headerfile
|
// Little NOTE: this should become the new video headerfile
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
-- Includes
|
-- Includes
|
||||||
|
@ -37,9 +37,10 @@ Note: This new graphic object should generalize all the different objects
|
||||||
(8bit,16bit,...)
|
(8bit,16bit,...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// FIXME: not quite correct for new multiple palette version
|
||||||
/// System-Wide used colors.
|
/// System-Wide used colors.
|
||||||
enum _sys_colors_ {
|
enum _sys_colors_ {
|
||||||
ColorBlack = 0, /// usr for black
|
ColorBlack = 0, /// use for black
|
||||||
ColorDarkGreen = 149,
|
ColorDarkGreen = 149,
|
||||||
ColorBlue = 206,
|
ColorBlue = 206,
|
||||||
ColorWhite = 246,
|
ColorWhite = 246,
|
||||||
|
@ -51,37 +52,35 @@ enum _sys_colors_ {
|
||||||
ColorBlinkRed = 252,
|
ColorBlinkRed = 252,
|
||||||
ColorViolett = 253,
|
ColorViolett = 253,
|
||||||
|
|
||||||
ColorWaterCycleStart = 38,
|
// FIXME: this should some where made configurable
|
||||||
ColorWaterCycleEnd = 47,
|
ColorWaterCycleStart = 38, /// color # start for color cycling
|
||||||
ColorIconCycleStart = 240,
|
ColorWaterCycleEnd = 47, /// color # end for color cycling
|
||||||
ColorIconCycleEnd = 244
|
ColorIconCycleStart = 240, /// color # start for color cycling
|
||||||
|
ColorIconCycleEnd = 244 /// color # end for color cycling
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef enum _sys_colors_ SysColors; /// System-Wide used colors.
|
||||||
|
|
||||||
|
typedef struct _palette_ Palette; /// palette typedef
|
||||||
|
|
||||||
|
/// Palette structure.
|
||||||
|
struct _palette_ {
|
||||||
|
unsigned char r; /// RED COMPONENT
|
||||||
|
unsigned char g; /// GREEN COMPONENT
|
||||||
|
unsigned char b; /// BLUE COMPONENT
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef unsigned char GraphicData; /// generic graphic data type
|
typedef unsigned char GraphicData; /// generic graphic data type
|
||||||
|
|
||||||
/// Palette structure.
|
|
||||||
struct Palette {
|
|
||||||
/// RED COMPONENT
|
|
||||||
unsigned char r;
|
|
||||||
/// GREEN COMPONENT
|
|
||||||
unsigned char g;
|
|
||||||
/// BLUE COMPONENT
|
|
||||||
unsigned char b;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct Palette Palette;
|
|
||||||
|
|
||||||
typedef enum _sys_colors_ SysColors; /// System-Wide used colors.
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** General graphic object typedef. (forward)
|
** General graphic object typedef. (forward)
|
||||||
*/
|
*/
|
||||||
typedef struct __graphic__ Graphic;
|
typedef struct _graphic_ Graphic;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** General graphic object type.
|
** General graphic object type.
|
||||||
*/
|
*/
|
||||||
typedef struct __graphic_type__ {
|
typedef struct _graphic_type_ {
|
||||||
/**
|
/**
|
||||||
** Draw the object unclipped.
|
** Draw the object unclipped.
|
||||||
**
|
**
|
||||||
|
@ -148,10 +147,10 @@ typedef struct __graphic_type__ {
|
||||||
/**
|
/**
|
||||||
** General graphic object
|
** General graphic object
|
||||||
*/
|
*/
|
||||||
struct __graphic__ {
|
struct _graphic_ {
|
||||||
GraphicType* Type; /// Object type dependend
|
GraphicType* Type; /// Object type dependend
|
||||||
Palette* Palette; /// Loaded Palette
|
Palette* Palette; /// Loaded Palette
|
||||||
GraphicData* Pixels;
|
GraphicData* Pixels; /// Pointer to local or global palette
|
||||||
unsigned Width; /// Width of the object
|
unsigned Width; /// Width of the object
|
||||||
unsigned Height; /// Height of the object
|
unsigned Height; /// Height of the object
|
||||||
unsigned NumFrames; /// Number of frames
|
unsigned NumFrames; /// Number of frames
|
||||||
|
@ -257,7 +256,7 @@ extern void (*VideoDrawHLineClip)(SysColors color,int x,int y
|
||||||
|
|
||||||
/// Free a graphic object.
|
/// Free a graphic object.
|
||||||
#define VideoFree(o) ((o)->Type->Free)((o))
|
#define VideoFree(o) ((o)->Type->Free)((o))
|
||||||
/// Save free a graphic object.
|
/// Save (NULL) free a graphic object.
|
||||||
#define VideoSaveFree(o) \
|
#define VideoSaveFree(o) \
|
||||||
do { if( (o) ) ((o)->Type->Free)((o)); } while( 0 )
|
do { if( (o) ) ((o)->Type->Free)((o)); } while( 0 )
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,8 @@ typedef unsigned char VMemType8; /// 8 bpp modes pointer
|
||||||
/// MACRO defines speed of colorcycling
|
/// MACRO defines speed of colorcycling
|
||||||
#define COLOR_CYCLE_SPEED (FRAMES_PER_SECOND/4)
|
#define COLOR_CYCLE_SPEED (FRAMES_PER_SECOND/4)
|
||||||
|
|
||||||
|
#ifndef NEW_VIDEO // { Should be removed with new video final version
|
||||||
|
|
||||||
/**@name RleSprite */
|
/**@name RleSprite */
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
|
@ -52,7 +54,7 @@ typedef unsigned char VMemType8; /// 8 bpp modes pointer
|
||||||
struct RleSprite {
|
struct RleSprite {
|
||||||
unsigned Width; /// width of a frame
|
unsigned Width; /// width of a frame
|
||||||
unsigned Height; /// height of a frame
|
unsigned Height; /// height of a frame
|
||||||
GraphicData* Pixels; /// palette FUTURE extension
|
GraphicData* Pixels; /// pointer to local or global palette
|
||||||
int NumFrames; /// number of frames
|
int NumFrames; /// number of frames
|
||||||
IfDebug( int ByteSize; )
|
IfDebug( int ByteSize; )
|
||||||
/**
|
/**
|
||||||
|
@ -110,11 +112,8 @@ extern void DrawRleSpriteClippedX(RleSprite* sprite,unsigned frame,int x,int y);
|
||||||
extern void FreeRleSprite(RleSprite *sprite);
|
extern void FreeRleSprite(RleSprite *sprite);
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/**@name Vector graphics primitives */
|
#endif // } !NEW_VIDEO
|
||||||
|
|
||||||
// now in linedraw and vectored
|
|
||||||
|
|
||||||
//@{
|
|
||||||
/** Set clipping for nearly all vector primitives. Functions which support
|
/** Set clipping for nearly all vector primitives. Functions which support
|
||||||
clipping will be marked CLIPPED. Set system-wide clipping rectangle.
|
clipping will be marked CLIPPED. Set system-wide clipping rectangle.
|
||||||
@param left left x coordinate
|
@param left left x coordinate
|
||||||
|
@ -142,7 +141,7 @@ extern void* VideoMemory;
|
||||||
*/
|
*/
|
||||||
extern int VideoDepth;
|
extern int VideoDepth;
|
||||||
/// Sub depth 555, 565
|
/// Sub depth 555, 565
|
||||||
extern int VideoSubDepth;
|
//extern int VideoSubDepth;
|
||||||
|
|
||||||
/// 32 bpp modes video memory address
|
/// 32 bpp modes video memory address
|
||||||
#define VideoMemory32 ((VMemType32*)VideoMemory)
|
#define VideoMemory32 ((VMemType32*)VideoMemory)
|
||||||
|
@ -156,8 +155,8 @@ extern int VideoSubDepth;
|
||||||
VideoCreatePalette.
|
VideoCreatePalette.
|
||||||
@see VideoCreatePalette
|
@see VideoCreatePalette
|
||||||
*/
|
*/
|
||||||
extern VMemType8 * Pixels8; /// 8 bpp
|
extern VMemType8 * Pixels8; /// 8 bpp
|
||||||
extern VMemType16 * Pixels16; /// 16 bpp default
|
extern VMemType16 * Pixels16; /// 16 bpp
|
||||||
extern VMemType32 * Pixels32; /// 32 bpp
|
extern VMemType32 * Pixels32; /// 32 bpp
|
||||||
|
|
||||||
/** Set videomode. Tries to set choosen videomode. Only 640x480, 800x600
|
/** Set videomode. Tries to set choosen videomode. Only 640x480, 800x600
|
||||||
|
@ -167,14 +166,14 @@ extern VMemType32 * Pixels32; /// 32 bpp
|
||||||
extern int SetVideoMode(int width);
|
extern int SetVideoMode(int width);
|
||||||
|
|
||||||
/** Loaded system palette. 256-entries long, active system palette. */
|
/** Loaded system palette. 256-entries long, active system palette. */
|
||||||
extern struct Palette GlobalPalette[256];
|
extern Palette GlobalPalette[256];
|
||||||
|
|
||||||
/** Load palette from resource. Just loads palette, to set it use
|
/** Load palette from resource. Just loads palette, to set it use
|
||||||
VideoCreatePalette, which sets system palette.
|
VideoCreatePalette, which sets system palette.
|
||||||
@param pal buffer to store palette (256-entries long)
|
@param pal buffer to store palette (256-entries long)
|
||||||
@param name resource file name
|
@param name resource file name
|
||||||
*/
|
*/
|
||||||
extern void LoadRGB(struct Palette *pal, const char *name);
|
extern void LoadRGB(Palette *pal, const char *name);
|
||||||
|
|
||||||
/// Initialize Pixels[] for all players (bring Players[] in sync with Pixels[])
|
/// Initialize Pixels[] for all players (bring Players[] in sync with Pixels[])
|
||||||
extern void SetPlayersPalette(void);
|
extern void SetPlayersPalette(void);
|
||||||
|
@ -192,14 +191,14 @@ extern void CheckVideoInterrupts(void);
|
||||||
extern void ColorCycle(void);
|
extern void ColorCycle(void);
|
||||||
|
|
||||||
/** Creates a palette from a Palette struct */
|
/** Creates a palette from a Palette struct */
|
||||||
extern GraphicData * VideoCreateNewPalette(const struct Palette *palette);
|
extern GraphicData * VideoCreateNewPalette(const Palette *palette);
|
||||||
|
|
||||||
/** Initializes system palette. Also calls SetPlayersPalette to set palette for
|
/** Initializes system palette. Also calls SetPlayersPalette to set palette for
|
||||||
all players.
|
all players.
|
||||||
@param palette Palette structure
|
@param palette Palette structure
|
||||||
@see SetPlayersPalette
|
@see SetPlayersPalette
|
||||||
*/
|
*/
|
||||||
extern void VideoCreatePalette(const struct Palette *palette);
|
extern void VideoCreatePalette(const Palette *palette);
|
||||||
|
|
||||||
/// Process all system events. This function also keeps synchronization of game.
|
/// Process all system events. This function also keeps synchronization of game.
|
||||||
extern void WaitEventsAndKeepSync(void);
|
extern void WaitEventsAndKeepSync(void);
|
||||||
|
|
Loading…
Reference in a new issue