SpaceCadetPinball/SpaceCadetPinball/gdrv.h

79 lines
2.4 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,
2020-11-08 16:37:59 +01:00
};
#pragma pack(push, 1)
struct __declspec(align(1)) gdrv_bitmap8
{
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;
};
#pragma pack(pop)
2020-11-13 17:04:58 +01:00
struct LOGPALETTEx256
{
WORD palVersion;
WORD palNumEntries;
PALETTEENTRY palPalEntry[256];
LOGPALETTEx256() : palVersion(0x300), palNumEntries(256), palPalEntry{}
{
}
};
2020-11-08 16:37:59 +01:00
static_assert(sizeof(gdrv_bitmap8) == 37, "Wrong size of gdrv_bitmap8");
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 LOGPALETTEx256 current_palette;
static int sequence_handle;
static HDC sequence_hdc;
static int use_wing;
static int init(HINSTANCE hInst, HWND hWnd);
static int uninit();
2020-11-08 16:37:59 +01:00
static void get_focus();
2020-11-13 17:04:58 +01:00
static BITMAPINFO* DibCreate(__int16 bpp, int width, int height);
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);
2020-11-13 17:04:58 +01:00
static int destroy_bitmap(gdrv_bitmap8* bmp);
static int display_palette(PALETTEENTRY* plt);
static UINT start_blit_sequence();
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:
static HWND hwnd;
static HINSTANCE hinst;
static int grtext_blue;
static int grtext_green;
static int grtext_red;
2020-11-07 16:41:14 +01:00
};