-
大小: 26KB文件类型: .rar金币: 1下载: 0 次发布日期: 2021-05-10
- 语言: C/C++
- 标签: graphics.h winbgi.cpp
资源简介
由于TC中的graphics.h不是C语言中的标准函数,而是由Borland公司自行开发的,而且是面向DOS的16位,无法直接在VC++中使用;
出于此目的,设计了面向VC++的graphics.h头文件,以及包含一些链接函数的C++程序winbgi.cpp和winbgi.lib;
如何使用?第一种方法——创建工程之后,在Source Files中导入winbgi.cpp文件,在Header Files中导入graphics.h文件,并且将这两个文件和winbgi.lib拷贝至该工程所在的目录下。
第二种方法——添加路径法,选中Tools-Options-Directories,分别在Include Files和Library Files添加图形包winbgi的路径,然后在Source Files中导入winbgi.cpp文件,在Header Files中导入graphics.h文件。
代码片段和文件信息
#include
#include
#include
#include
#include “graphics.h“
#define MAX_PAGES 16
static HDC hdc[4];
static HPEN hPen;
static HRGN hRgn;
static HFONT hFont;
static NPLOGPALETTE pPalette;
static PAINTSTRUCT ps;
static HWND hWnd;
static HBRUSH hBrush[USER_FILL+1];
static HBRUSH hBackgroundBrush;
static HPALETTE hPalette;
static HBITMAP hBitmap[MAX_PAGES];
static HBITMAP hPutimageBitmap;
static int timeout_expired;
#define PEN_CACHE_SIZE 8
#define FONT_CACHE_SIZE 8
#define BG 16
#define TIMER_ID 1
//
// When XOR or NOT write modes are used for drawing high BG bit is cleared so
// drawing colors should be adjusted to preserve this bit
//
#define ADJUSTED_MODE(mode) ((mode) == XOR_PUT || (mode) == NOT_PUT)
int bgiemu_handle_redraw = TRUE;
int bgiemu_default_mode = VGAHI; //VGAMAX;
static int screen_width;
static int screen_height;
static int window_width;
static int window_height;
static int line_style_cnv[] = {
PS_SOLID PS_DOT PS_DASHDOT PS_DASH
PS_DASHDOTDOT /* if user style lines are not supported */
};
static int write_mode_cnv[] =
{R2_COPYPEN R2_XORPEN R2_MERGEPEN R2_MASKPEN R2_NOTCOPYPEN};
static int bitblt_mode_cnv[] =
{SRCCOPY SRCINVERT SRCPAINT SRCAND NOTSRCCOPY};
static int font_weight[] =
{
FW_BOLD // DefaultFont
FW_NORMAL // TriplexFont
FW_NORMAL // SmallFont
FW_NORMAL // SansSerifFont
FW_NORMAL // GothicFont
FW_NORMAL // scriptFont
FW_NORMAL // SimplexFont
FW_NORMAL // TriplexscriptFont
FW_NORMAL // ComplexFont
FW_NORMAL // EuropeanFont
FW_BOLD // BoldFont
};
static int font_family[] =
{
FIXED_PITCH|FF_DONTCARE // DefaultFont
VARIABLE_PITCH|FF_ROMAN // TriplexFont
VARIABLE_PITCH|FF_MODERN // SmallFont
VARIABLE_PITCH|FF_DONTCARE // SansSerifFont
VARIABLE_PITCH|FF_SWISS // GothicFont
VARIABLE_PITCH|FF_script // scriptFont
VARIABLE_PITCH|FF_DONTCARE // SimplexFont
VARIABLE_PITCH|FF_script // TriplexscriptFont
VARIABLE_PITCH|FF_DONTCARE // ComplexFont
VARIABLE_PITCH|FF_DONTCARE // EuropeanFont
VARIABLE_PITCH|FF_DONTCARE // BoldFont
};
static char* font_name[] =
{
“Console“ // DefaultFont
“Times New Roman“ // TriplexFont
“Small Fonts“ // SmallFont
“MS Sans Serif“ // SansSerifFont
“Arial“ // GothicFont
“script“ // scriptFont
“Times New Roman“ // SimplexFont
“script“ // TriplexscriptFont
“Courier New“ // ComplexFont
“Times New Roman“ // EuropeanFont
“Courier New Bold“ // BoldFont
};
static int text_halign_cnv[] = {TA_LEFT TA_CENTER TA_RIGHT};
static int text_valign_cnv[] = {TA_BOTTOM TA_baseLINE TA_TOP};
static palettetype current_palette;
static struct { int width
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 7626 2008-09-03 11:05 winbgi\graphics.h
文件 583 2008-09-03 11:05 winbgi\readme.txt
文件 47535 2008-09-03 11:05 winbgi\winbgi.cpp
文件 50556 2008-09-03 11:05 winbgi\winbgi.lib
目录 0 2008-09-03 11:05 winbgi
----------- --------- ---------- ----- ----
106300 5
评论
共有 条评论