00001
00002
00003
00004 #ifndef __OVGA_H
00005 #define __OVGA_H
00006
00007 #ifndef __OVGABUF_H
00008 #include <OVGABUF.H>
00009 #endif
00010
00011 #ifndef __COLOR_H
00012 #include <COLOR.H>
00013 #endif
00014
00015
00016
00017 #define VGA_WIDTH 800
00018 #define VGA_HEIGHT 600
00019 #define VGA_BPP 16
00020
00021 #define MAX_BRIGHTNESS_ADJUST_DEGREE 32
00022
00023
00024
00025 #define IF_LIGHT_BORDER_COLOR V_WHITE
00026 #define IF_DARK_BORDER_COLOR V_BLACK
00027 #define IF_UP_BRIGHTNESS_ADJUST 5
00028 #define IF_DOWN_BRIGHTNESS_ADJUST 6
00029
00030
00031
00032 #define get_bitmap_width(bitmapPtr) (*(short*)bitmapPtr)
00033 #define get_bitmap_height(bitmapPtr) (*((short*)bitmapPtr+1))
00034
00035
00036
00037 typedef unsigned char BYTE;
00038
00039 struct RGBColor;
00040 class ColorTable;
00041 class VgaCustomPalette;
00042
00044 class Vga {
00045 public:
00046 LPDIRECTDRAW4 dd_obj;
00047 LPDIRECTDRAWPALETTE dd_pal;
00048
00049 PALETTEENTRY pal_entry_buf[256];
00050
00051 ColorTable* vga_color_table;
00052 unsigned char gray_remap_table[256];
00053 int pixel_format_flag;
00054 short * default_remap_table;
00055
00056 VgaCustomPalette* back_up_pal;
00057
00058 static VgaBuf* active_buf;
00059 static char use_back_buf;
00060 static char opaque_flag;
00061
00062 public:
00063 Vga();
00064 ~Vga();
00065
00066 char dont_blt;
00067
00068 BOOL init();
00069 BOOL init_dd();
00070 BOOL set_mode(int width, int height);
00071 void deinit();
00072
00073 char is_inited() { return dd_obj!=NULL; }
00074
00075 BOOL load_pal(char* fileName);
00076 void init_gray_remap_table();
00077
00078 void activate_pal(VgaBuf*);
00079 void release_pal();
00080
00081 void d3_panel_up(int x1,int y1,int x2,int y2,int vgaFrontOnly=0,int drawBorderOnly=0);
00082 void d3_panel_down(int x1,int y1,int x2,int y2,int vgaFrontOnly=0,int drawBorderOnly=0);
00083 void d3_panel2_up(int x1,int y1,int x2,int y2,int vgaFrontOnly=0,int drawBorderOnly=0);
00084 void d3_panel2_down(int x1,int y1,int x2,int y2,int vgaFrontOnly=0,int drawBorderOnly=0);
00085 void separator(int x1, int y1, int x2, int y2);
00086
00087 void adjust_brightness(int changeValue);
00088
00089 void use_front() { use_back_buf=0; active_buf = &vga_front; }
00090 void use_back() { use_back_buf=1; active_buf = &vga_back; }
00091
00092 BOOL blt_buf(int x1, int y1, int x2, int y2, int putMouseCursor=1);
00093
00094 void disp_image_file(char* fileName,int x1=0, int y1=0);
00095 void finish_disp_image_file();
00096
00097 int translate_color(unsigned char c)
00098 { return default_remap_table[c]; }
00099
00100 int make_pixel(BYTE red, BYTE green, BYTE blue);
00101 int make_pixel(RGBColor *);
00102 void decode_pixel(int, RGBColor *);
00103
00104 private:
00105 void init_color_table();
00106 };
00107
00108 extern Vga vga;
00109 extern "C" {
00110 extern short transparent_code_w;
00111 }
00112
00113
00114 #endif