SpaceCadetPinball/SpaceCadetPinball/gdrv.h

80 lines
2.6 KiB
C
Raw Normal View History

2020-11-07 16:41:14 +01:00
#pragma once
2020-11-08 16:37:59 +01:00
2020-11-13 17:04:58 +01:00
enum class BitmapType : char
2020-11-08 16:37:59 +01:00
{
2020-11-13 17:04:58 +01:00
None = 0,
RawBitmap = 1,
DibBitmap = 2,
Spliced = 4,
2020-11-08 16:37:59 +01:00
};
struct gdrv_bitmap8
2020-11-08 16:37:59 +01:00
{
2020-11-13 17:04:58 +01:00
BITMAPINFO* Dib;
2020-11-08 16:37:59 +01:00
char* BmpBufPtr2;
char* BmpBufPtr1;
int Width;
int Height;
int Stride;
2020-11-13 17:04:58 +01:00
BitmapType BitmapType;
2020-11-08 16:37:59 +01:00
int Color6;
int XPosition;
int YPosition;
};
2020-11-13 17:04:58 +01:00
struct LOGPALETTEx256 : LOGPALETTE
2020-11-13 17:04:58 +01:00
{
PALETTEENTRY palPalEntry2[256 - 1];
2020-11-13 17:04:58 +01:00
LOGPALETTEx256() : palPalEntry2{}
2020-11-13 17:04:58 +01:00
{
palVersion = 0x300;
palNumEntries = 256;
2020-11-13 17:04:58 +01:00
}
};
2020-11-08 16:37:59 +01:00
2020-11-07 16:41:14 +01:00
class gdrv
{
public:
2020-11-08 16:37:59 +01:00
static HPALETTE palette_handle;
2020-11-13 17:04:58 +01:00
static int sequence_handle;
static HDC sequence_hdc;
static int use_wing;
static int init(SDL_Renderer* renderer, int width, int height);
2020-11-13 17:04:58 +01:00
static int uninit();
2020-11-08 16:37:59 +01:00
static void get_focus();
static BITMAPINFO* DibCreate(int16_t bpp, int width, int height);
2020-11-13 17:04:58 +01:00
static void DibSetUsage(BITMAPINFO* dib, HPALETTE hpal, int someFlag);
2020-11-08 16:37:59 +01:00
static int create_bitmap_dib(gdrv_bitmap8* bmp, int width, int height);
static int create_bitmap(gdrv_bitmap8* bmp, int width, int height);
static int create_raw_bitmap(gdrv_bitmap8* bmp, int width, int height, int flag);
static int create_spliced_bitmap(gdrv_bitmap8* bmp, int width, int height, int size);
2020-11-13 17:04:58 +01:00
static int destroy_bitmap(gdrv_bitmap8* bmp);
static int display_palette(PALETTEENTRY* plt);
2021-02-09 16:09:44 +01:00
static void start_blit_sequence();
2020-11-13 17:04:58 +01:00
static void blit_sequence(gdrv_bitmap8* bmp, int xSrc, int ySrcOff, int xDest, int yDest, int DestWidth,
int DestHeight);
static void end_blit_sequence();
static void blit(gdrv_bitmap8* bmp, int xSrc, int ySrcOff, int xDest, int yDest, int DestWidth, int DestHeight);
static void blat(gdrv_bitmap8* bmp, int xDest, int yDest);
static void fill_bitmap(gdrv_bitmap8* bmp, int width, int height, int xOff, int yOff, char fillChar);
static void copy_bitmap(gdrv_bitmap8* dstBmp, int width, int height, int xOff, int yOff, gdrv_bitmap8* srcBmp,
int srcXOff, int srcYOff);
static void copy_bitmap_w_transparency(gdrv_bitmap8* dstBmp, int width, int height, int xOff, int yOff,
gdrv_bitmap8* srcBmp, int srcXOff, int srcYOff);
static void grtext_draw_ttext_in_box(LPCSTR text, int xOff, int yOff, int width, int height, int a6);
2020-11-08 16:37:59 +01:00
private:
2021-02-09 16:09:44 +01:00
/*COLORONCOLOR or HALFTONE*/
static const int stretchMode = COLORONCOLOR;
static SDL_Renderer* renderer;
static int grtext_blue;
static int grtext_green;
static int grtext_red;
2021-02-09 16:09:44 +01:00
static int StretchDIBitsScaled(HDC hdc, int xDest, int yDest, int DestWidth, int DestHeight, int xSrc, int ySrc,
int SrcWidth, int SrcHeight, gdrv_bitmap8* bmp, UINT iUsage,
DWORD rop);
2020-11-07 16:41:14 +01:00
};