⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 graphics.h

📁 vc写的源程序,是关于游戏类的程序。调用了系统的很多API
💻 H
📖 第 1 页 / 共 2 页
字号:
extern WORD font_shadow_color;      // 汉字阴影的颜色
extern WORD font_hollow_color;      // 字体边框的颜色

extern DEBUG_MESSAGE *msg_buffer[MAX_DEBUG_MSG]; // 指向信息的指针数组
extern int  msg_count;              // 当前有效的信息数

extern WORD alpha25mask;
extern WORD alpha50mask;
extern WORD alpha125mask;
extern WORD alpha50mask_2;
extern DWORD dalpha25mask;
extern DWORD dalpha50mask;
extern DWORD dalpha125mask;
extern DWORD dalpha50mask_2;

extern LPDIRECTSOUND       lpDS;         // DirectSound对象
extern LPDIRECTSOUNDBUFFER lpDSBPrimary; // 主声音缓冲区
extern WAVEFORMATEX        wf;

extern BOOL sound_init;
extern BOOL sound_on, music_on; // 音效和音乐开关
extern long sample_pan, sample_volume; // 音效的均衡和音量
extern long music_pan, music_volume; // 音乐的均衡和音量
extern STATICSOUND static_buffer[MAXSAMPLE]; // 音效缓冲区
extern STREAMSOUND stream_buffer; // 音乐缓冲区
extern HANDLE sound_event[MAXSAMPLE * 2 + 2]; // 声音缓冲区事件数组
extern HANDLE DS_Thread; // DirectSound线程
extern DWORD  DirectSoundThreadID; // DirectSound线程ID

extern LIST *ime_list; // 输入法列表
extern CODE_TYPE *entry_ime; // 当前输入法
extern LIST *entry_hz;

extern LPDIRECTPLAY4A      lpDP;     // DirectPlay对象
extern LPDIRECTPLAYLOBBY3A lpDPL;    // DirectPlayLobby对象
extern DPID                DirectPlayID;    // DirectPlay的ID
extern LPGUID              lpGUID;          // 游戏标识
extern BOOL                IsHost;  // 是否为主机
extern BOOL                NetInit; // 网络正常标志
extern LIST *ListSP; // 建立连接类型列表
extern LIST *ListSession; // 会话列表
extern LPVOID tcpip, modem, serial;

// virtual functions (set.cpp)
extern void (* bitblt_bitmap)(BMP *dest_bmp, int x, int y, BMP *src_bmp, int srcx, int srcy, int w, int h);
extern void (* draw_bitmap)(BMP *dest_bmp, int x, int y, BMP *src_bmp);
extern void (* alpha_bitblt_bitmap)(BMP *dest_bmp, int x, int y, BMP *src_bmp, int srcx, int srcy, int w, int h);
extern WORD (* true_to_hi)(DWORD color);
extern DWORD (* hi_to_true)(WORD color);
extern void ( *additive_bitblt_bitmap)(BMP *dest_bmp, int x, int y, BMP *src_bmp, int srcx, int srcy, int w, int h);
extern void ( *additive_fst)(BMP *dest_bmp, int x, int y, FST_BMP *src_fst, int srcx, int srcy, int w, int h);
extern void (* update_screen)();
extern void (* paint_C16)(BMP *bmp, int x, int y, WORD color,char *text);
extern void (* paint_C24)(BMP *bmp, int x, int y, WORD color,char *text);
extern void (* paint_ASC)(BMP *bmp, int x, int y, WORD color,char c);
extern void (* pixel)(BMP *bmp, int x, int y, WORD color);
extern BMP *(* get_win_bitmap)(char *filename);
extern BMP *(* get_bmp_file)(char *filename);
extern void *(* get_file)(char *filename);
extern SAMPLE *(* get_sample)(char *filename);
extern MUSIC *(* get_music)(char *filename);
extern void (* paint_mouse)(MOUSE_CURSOR *cur);
extern void (* alpha_pixel);

// gmain.cpp
BOOL initialize(HINSTANCE hInst, int nCmdShow);
void free_resource();
BOOL lock_screen();
void unlock_screen();
BOOL game_init();
BOOL game_loop();
void game_exit();
void restore_surface();
void calc_fps();
void *load_file(char *filename);

// set.cpp
void init_set();
void set_555();
void set_565();
BOOL set_trans_mode(BOOL trans);
int set_alpha(int alpha);
int set_update_mode(int mode);
int set_font_style(int style);
void set_shadow(int x, int y, WORD sc);
void set_hollow(WORD hc);
int set_draw_mode(int mode);
void set_data_source(int source);
int set_paint_mouse_mode(int mode);
int set_fst_alpha(int alpha);

// bitmap.cpp
BMP* create_bitmap(int w, int h, WORD c);
BMP* create_bitmap(int w, int h);
BMP *create_mirror_bitmap(BMP *src_bmp);
BMP *create_ptr_bitmap(int w, int h, WORD *p);
void swap_bitmap(BMP **bmp1, BMP **bmp2);
void free_bitmap(BMP **bmp);
WORD create_color(WORD r, WORD g, WORD b);
WORD con_555_to_565(WORD c);
WORD con_565_to_555(WORD c);
void image_to_565(BMP* bmp);
void image_to_555(BMP* bmp);
BMP *load_win_bitmap(LPSTR filename);
WORD true_to_hi_555(DWORD color);
WORD true_to_hi_565(DWORD color);
DWORD hi_to_true_555(WORD color);
DWORD hi_to_true_565(WORD color);
void write_to_file(BMP *bmp, char *filename);
BMP *load_to_file(char *filename);
void write_win_bmp(BMP *bmp, char *filename);

// update.cpp
void update_screen_normal();
void update_screen_shadow();
void update_screen_interval();

// blit.cpp
void clrscr_bitmap(BMP *bmp, WORD color);
void nomask_bitblt_bitmap(BMP *dest_bmp, int x, int y, BMP *src_bmp, int srcx, int srcy, int w, int h);
void mask_bitblt_bitmap(BMP *dest_bmp, int x, int y, BMP *src_bmp, int srcx, int srcy, int w, int h);
void nomask_draw_bitmap(BMP *dest_bmp, int x, int y, BMP *src_bmp);
void mask_draw_bitmap(BMP *dest_bmp, int x, int y, BMP *src_bmp);

// draw.cpp
void set_draw_xy(BMP *bmp, int x, int y);
void pixel_normal(BMP *bmp, int x, int y, WORD color);
void pixel_or(BMP *bmp, int x, int y, WORD color);
void pixel_xor(BMP *bmp, int x, int y, WORD color);
void pixel_not(BMP *bmp, int x, int y, WORD color);
void pixel_and(BMP *bmp, int x, int y, WORD color);
void pixel_alpha_1(BMP *bmp, int x, int y, WORD color);
void pixel_alpha_2(BMP *bmp, int x, int y, WORD color);
void pixel_alpha_3(BMP *bmp, int x, int y, WORD color);
void pixel_alpha_4(BMP *bmp, int x, int y, WORD color);
void pixel_alpha_5(BMP *bmp, int x, int y, WORD color);
void pixel_alpha_6(BMP *bmp, int x, int y, WORD color);
void pixel_alpha_7(BMP *bmp, int x, int y, WORD color);
void pixel_alpha_8(BMP *bmp, int x, int y, WORD color);
void pixel_additive_565(BMP *bmp, int x, int y, WORD color);
void pixel_additive_555(BMP *bmp, int x, int y, WORD color);
void line(BMP *bmp, int x1, int y1, int x2, int y2, WORD color);
void circle(BMP *bmp, int x0, int y0, int r, WORD color);
void circle_fill(BMP *bmp, int x0, int y0, int r, WORD color);
void rect(BMP *bmp, int x1, int y1, int x2, int y2, WORD color);
void rect_fill(BMP *bmp, int x1, int y1, int x2, int y2, WORD color);
BOOL load_hzk16(char *filename);
BOOL load_hzk24(char *filename);
BOOL load_asc16(char *filename);
void _paint_C16(BMP *bmp, int x, int y, WORD color, char *text);
void paint_C16_normal(BMP *bmp, int x, int y, WORD color, char *text);
void paint_C16_shadow(BMP *bmp, int x, int y, WORD color, char *text);
void paint_C16_hollow(BMP *bmp, int x, int y, WORD color, char *text);
void _paint_C24(BMP *bmp, int x, int y, WORD color, char *text);
void paint_C24_normal(BMP *bmp, int x, int y, WORD color, char *text);
void paint_C24_shadow(BMP *bmp, int x, int y, WORD color, char *text);
void paint_C24_hollow(BMP *bmp, int x, int y, WORD color, char *text);
void _paint_ASC(BMP *bmp, int x, int y, WORD color,char c);
void paint_ASC_normal(BMP *bmp, int x, int y, WORD color, char text);
void paint_ASC_shadow(BMP *bmp, int x, int y, WORD color, char text);
void paint_ASC_hollow(BMP *bmp, int x, int y, WORD color, char text);
void text_out(BMP *bmp, int x, int y, WORD color, char *text);
void text_printf(BMP *bmp, int x, int y, WORD color, char *format, ...);

// alphablt.cpp
void alpha_bitblt_1(BMP *dest_bmp, int x, int y, BMP *src_bmp, int srcx, int srcy, int w, int h);
void alpha_bitblt_2(BMP *dest_bmp, int x, int y, BMP *src_bmp, int srcx, int srcy, int w, int h);
void alpha_bitblt_3(BMP *dest_bmp, int x, int y, BMP *src_bmp, int srcx, int srcy, int w, int h);
void alpha_bitblt_4(BMP *dest_bmp, int x, int y, BMP *src_bmp, int srcx, int srcy, int w, int h);
void alpha_bitblt_5(BMP *dest_bmp, int x, int y, BMP *src_bmp, int srcx, int srcy, int w, int h);
void alpha_bitblt_6(BMP *dest_bmp, int x, int y, BMP *src_bmp, int srcx, int srcy, int w, int h);
void alpha_bitblt_7(BMP *dest_bmp, int x, int y, BMP *src_bmp, int srcx, int srcy, int w, int h);
void alpha_bitblt_8(BMP *dest_bmp, int x, int y, BMP *src_bmp, int srcx, int srcy, int w, int h);

void mask_alpha_bitblt_1(BMP *dest_bmp, int x, int y, BMP *src_bmp, int srcx, int srcy, int w, int h);
void mask_alpha_bitblt_2(BMP *dest_bmp, int x, int y, BMP *src_bmp, int srcx, int srcy, int w, int h);
void mask_alpha_bitblt_3(BMP *dest_bmp, int x, int y, BMP *src_bmp, int srcx, int srcy, int w, int h);
void mask_alpha_bitblt_4(BMP *dest_bmp, int x, int y, BMP *src_bmp, int srcx, int srcy, int w, int h);
void mask_alpha_bitblt_5(BMP *dest_bmp, int x, int y, BMP *src_bmp, int srcx, int srcy, int w, int h);
void mask_alpha_bitblt_6(BMP *dest_bmp, int x, int y, BMP *src_bmp, int srcx, int srcy, int w, int h);
void mask_alpha_bitblt_7(BMP *dest_bmp, int x, int y, BMP *src_bmp, int srcx, int srcy, int w, int h);
void mask_alpha_bitblt_8(BMP *dest_bmp, int x, int y, BMP *src_bmp, int srcx, int srcy, int w, int h);

// additive.cpp
void additive_bitblt_bitmap_555(BMP *dest_bmp, int x, int y, BMP *src_bmp, int srcx, int srcy, int w, int h);
void additive_bitblt_bitmap_565(BMP *dest_bmp, int x, int y, BMP *src_bmp, int srcx, int srcy, int w, int h);

// dinput.cpp
BOOL init_directinput();
BOOL key_down(BYTE scancode);
BOOL get_mouse_pos();
BOOL get_button_down();
int set_mouse_speed(int s);
void free_mousecursor(MOUSE_CURSOR **cur);
void active_directinput(BOOL active);
void free_directinput();
void wait_key(BYTE scan_code);
void create_cursor(int count, BMP *bmp, WORD tc, int hot_x = 0, int hot_y = 0, int delay = 0);
void show_mouse();
void close_mouse();
void paint_mouse_normal(MOUSE_CURSOR *cur);
void paint_mouse_additive(MOUSE_CURSOR *cur);
DWORD WINAPI DirectInputThread(LPVOID p);
int get_key();

// debug.cpp
BOOL init_debug_msg();
void add_message(char *format, ...);
void show_message();
void put_message(BOOL t, char *format, ...);
void free_debug_msg();

// alpha.cpp
void alpha_0_1(void);
void alpha_0_2(void);
void alpha_1_1(void);
void alpha_1_2(void);
void alpha_2_1(void);
void alpha_2_2(void);
void alpha_3_1(void);
void alpha_3_2(void);
void alpha_4_1(void);
void alpha_4_2(void);
void alpha_5_1(void);
void alpha_5_2(void);
void alpha_6_1(void);
void alpha_6_2(void);
void alpha_7_1(void);
void alpha_7_2(void);

// struct.cpp
LIST *create_list();
void add_point(LIST *list, void *data);
void free_list(LIST **l);
void seek_to_first(LIST *list);
void seek_to_last(LIST *list);
void seek_to_prev(LIST *list);
void seek_to_next(LIST *list);
void *get_data(LIST *list);
void delete_point(LIST *list, LIST_POINT *p);

// pack.cpp
void create_data_file(char *filename);
void open_data_file(char *filename);
void add_file(char *filename, DWORD ID, BOOL comp);
void close_data_file();
BMP *load_pack_win_bitmap(char *filename);
BMP *load_pack_bmp_file(char *filename);
void *load_pack_file(char *filename);
SAMPLE *load_pack_sample(char *filename);
MUSIC *load_pack_music(char *filename);
BOOL write_pack_file(char *filename, char *destfile);
BOOL write_all_pack_file();

// dsound.cpp
BOOL init_directsound();
void free_directsound();
SAMPLE *load_sample(char *filename);
MUSIC *load_music(char *filename);
void free_sample(SAMPLE **sample);
void free_music(MUSIC **music);
int play_sample(SAMPLE *sample, int loop = 0, long pan = sample_pan, long volume = sample_volume);
void play_music(MUSIC *music, int loop = 0, long pan = music_pan, long volume = music_volume);
BOOL static_next_data(STATICSOUND *ss, DWORD pos, DWORD size);
BOOL stream_next_data(int pos, int size);
DWORD WINAPI DirectSoundThread(LPVOID p);
void zero_static_buffer(int i);
void zero_stream_buffer();
long set_sample_pan(long pan);
long set_sample_volume(long volume);
long set_music_pan(long pan);
long set_music_volume(long volume);
void set_sample_on();
void set_sample_off();
void set_music_on();
void set_music_off();

// fstbitmap.cpp
FST_BMP *create_fst(BMP *bmp);
void write_fst_to_file(FST_BMP *fst, char *filename);
void free_fst(FST_BMP **fst);
void bitblt_fst(BMP *dest_bmp, int x, int y, FST_BMP *src_fst, int srcx, int srcy, int w, int h);
void additive_fst_565(BMP *dest_bmp, int x, int y, FST_BMP *src_fst, int srcx, int srcy, int w, int h);
void additive_fst_555(BMP *dest_bmp, int x, int y, FST_BMP *src_fst, int srcx, int srcy, int w, int h);
void alpha_fst(BMP *dest_bmp, int x, int y, FST_BMP *src_fst, int srcx, int srcy, int w, int h);

// compress.cpp
int compress(void *in, unsigned in_len, void *out);
int decompress(void *in, unsigned in_len, void *out);
BOOL compress_file(char *srcfile, char *destfile);
BOOL decompress_file(char *srcfile, char *destfile);

// net.cpp
BOOL init_directplay();
void free_directplay();
BOOL init_connect(int type);
BOOL create_session(int max_play, char *name);
BOOL enum_session();
void set_net_ip(char *address);
void set_net_phone(char *phone);
void set_net_port(int port, int speed);
BOOL create_player(char *name, char *namel, LPVOID lpdata, DWORD size);
BOOL enum_player();
extern int (* NetMessageProc)(NETMESSAGE *);
DWORD WINAPI ReceiveMessage(LPVOID p);
BOOL send_data(NETMESSAGE *netmsg);
BOOL send_chat(NETMESSAGE *netmsg);
BOOL set_player_name(char * names, char * namel);
BOOL set_session_name(char * name);

// ime.cpp
BOOL install_ime(char *filename);
BOOL active_ime(int index);
void get_hzlist(char *code);
void free_ime();
void reset_hz_list();
BOOL get_hz(char *buf);
BOOL input_panel(char *str);

// ice.cpp
BOOL init_ice();
void show_ice(BMP *dest);
void free_ice();

#endif // !defined(_GRAPHICS_H_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -