📄 pex.h
字号:
#ifndef _PEX_H_
#define _PEX_H_
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
#pragma once
#endif
#ifdef _GRAPH_LIB_BUILD_
#ifndef WINVER
#define WINVER 0x0400 // Specifies that the minimum required platform is Windows 95/NT4.
#endif
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400 // Specifies that the minimum required platform is Windows 95/NT4.
#endif
#ifndef _WIN32_WINDOWS
#define _WIN32_WINDOWS 0x0410 // Specifies that the minimum required platform is Windows 98.
#endif
#endif
#ifndef __cplusplus
#error You must use C++ compiler
#endif
#if defined(_INC_CONIO) || defined(_CONIO_H_)
#error can not include "conio.h" before "graphicsa.h"
#endif
#if !defined(_GRAPH_LIB_BUILD_) && !defined(_GRAPH_NO_LIB_)
#ifdef _MSC_VER
#if (_MSC_VER >= 1500)
#pragma comment(lib,"graphics08.lib")
#elif (_MSC_VER > 1200)
#pragma comment(lib,"graphics05.lib")
#else
#pragma comment(lib,"pex.lib")
#endif
#if _MSC_VER >= 1200
#ifdef _DEBUG
#pragma comment(linker, "/NODEFAULTLIB:libcmtd.lib")
#pragma comment(linker, "/NODEFAULTLIB:MSVCRT.lib")
#pragma comment(linker, "/NODEFAULTLIB:libcmt.lib")
#pragma comment(linker, "/NODEFAULTLIB:libc.lib")
#elif _MSC_VER < 1400
#pragma comment(linker, "/NODEFAULTLIB:libcmt.lib")
#endif
#else
#ifdef _DEBUG
#pragma comment(linker, "/NODEFAULTLIB:libc.lib")
#endif
#endif
#endif
#endif
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#ifndef _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE
#endif
#include "windows.h"
#include "math.h"
#include "tchar.h"
#ifndef PI
#define PI 3.1415926535897932
#endif
#ifndef _Cdecl
#if __STDC__
#define _Cdecl __cdecl
#else
#define _Cdecl __cdecl
#endif
#endif
// 为了兼容 Borland C++ 3.1 而做的无意义定义
enum graphics_drivers { /* define graphics drivers */
DETECT, /* requests autodetection */
CGA, MCGA, EGA, EGA64, EGAMONO, IBM8514, /* 1 - 6 */
HERCMONO, ATT400, VGA, PC3270, /* 7 - 10 */
TRUECOLOR, TRUECOLORSIZE,
CURRENT_DRIVER = -1
};
enum graphics_modes { /* graphics modes for each driver */
CGAC0 = 0, /* 320x200 palette 0; 1 page */
CGAC1 = 1, /* 320x200 palette 1; 1 page */
CGAC2 = 2, /* 320x200 palette 2: 1 page */
CGAC3 = 3, /* 320x200 palette 3; 1 page */
CGAHI = 4, /* 640x200 1 page */
MCGAC0 = 0, /* 320x200 palette 0; 1 page */
MCGAC1 = 1, /* 320x200 palette 1; 1 page */
MCGAC2 = 2, /* 320x200 palette 2; 1 page */
MCGAC3 = 3, /* 320x200 palette 3; 1 page */
MCGAMED = 4, /* 640x200 1 page */
MCGAHI = 5, /* 640x480 1 page */
EGALO = 0, /* 640x200 16 color 4 pages */
EGAHI = 1, /* 640x350 16 color 2 pages */
EGA64LO = 0, /* 640x200 16 color 1 page */
EGA64HI = 1, /* 640x350 4 color 1 page */
EGAMONOHI = 0, /* 640x350 64K on card, 1 page - 256K on card, 4 pages */
HERCMONOHI = 0, /* 720x348 2 pages */
ATT400C0 = 0, /* 320x200 palette 0; 1 page */
ATT400C1 = 1, /* 320x200 palette 1; 1 page */
ATT400C2 = 2, /* 320x200 palette 2; 1 page */
ATT400C3 = 3, /* 320x200 palette 3; 1 page */
ATT400MED = 4, /* 640x200 1 page */
ATT400HI = 5, /* 640x400 1 page */
VGALO = 0, /* 640x200 16 color 4 pages */
VGAMED = 1, /* 640x350 16 color 2 pages */
VGAHI = 2, /* 640x480 16 color 1 page */
PC3270HI = 0, /* 720x350 1 page */
IBM8514LO = 0, /* 640x480 256 colors */
IBM8514HI = 1 /*1024x768 256 colors */
};
enum graphics_errors { /* graphresult error return codes */
grOk = 0,
grNoInitGraph = -1,
grNotDetected = -2,
grFileNotFound = -3,
grInvalidDriver = -4,
grNoLoadMem = -5,
grNoScanMem = -6,
grNoFloodMem = -7,
grFontNotFound = -8,
grNoFontMem = -9,
grInvalidMode = -10,
grError = -11, /* generic error */
grIOerror = -12,
grInvalidFont = -13,
grInvalidFontNum = -14,
grInvalidVersion = -18,
grException = 0x10, /* ege error */
grParamError = 0x11,
grInvalidRegion = 0x12,
grOutOfMemory = 0x13,
grNullPointer = 0x14,
grAllocError = 0x15,
grInvalidMemory = 0xCDCDCDCD,
};
enum message_event {
MSG_EVENT_UP = 0x00,
MSG_EVENT_DOWN = 0x01,
MSG_EVENT_CLICK = 0x01,
MSG_EVENT_DBCLICK = 0x02,
MSG_EVENT_MOVE = 0x04,
MSG_EVENT_WHEEL = 0x10,
};
enum message_mouse {
MSG_MOUSE_LEFT = 0x01,
MSG_MOUSE_RIGHT = 0x02,
MSG_MOUSE_MID = 0x04,
};
// 颜色
enum COLORS {
BLACK = 0,
BLUE = 0xA80000,
GREEN = 0x00A800,
CYAN = 0xA8A800,
RED = 0x0000A8,
MAGENTA = 0xA800A8,
BROWN = 0x0054A8,
LIGHTGRAY = 0xA8A8A8,
DARKGRAY = 0x545454,
LIGHTBLUE = 0xFC5454,
LIGHTGREEN = 0x54FC54,
LIGHTCYAN = 0xFCFC54,
LIGHTRED = 0x5454FC,
LIGHTMAGENTA = 0xFC54FC,
YELLOW = 0x54FCFC,
WHITE = 0xFCFCFC
};
// 填充模式
enum fill_patterns {
EMPTY_FILL,
NULL_FILL, // 不填充
SOLID_FILL, // 用指定颜色完全填充
BDIAGONAL_FILL, // /// 填充 (普通一组)
CROSS_FILL, // +++ 填充
DIAGCROSS_FILL, // xxx 填充
DOT_FILL, // ... 填充
FDIAGONAL_FILL, // \\\ 填充
HORIZONTAL_FILL, // --- 填充
VERTICAL_FILL, // ||| 填充
BDIAGONAL2_FILL, // /// 填充 (密集一组)
CROSS2_FILL, // +++ 填充
DIAGCROSS2_FILL, // xxx 填充
DOT2_FILL, // ... 填充
FDIAGONAL2_FILL, // \\\ 填充
HORIZONTAL2_FILL, // --- 填充
VERTICAL2_FILL, // ||| 填充
BDIAGONAL3_FILL, // /// 填充 (粗线一组)
CROSS3_FILL, // +++ 填充
DIAGCROSS3_FILL, // xxx 填充
DOT3_FILL, // ... 填充
FDIAGONAL3_FILL, // \\\ 填充
HORIZONTAL3_FILL, // --- 填充
VERTICAL3_FILL, // ||| 填充
INTERLEAVE_FILL, // xxx 填充 (十分密)
PATTERN_FILL // 用指定图案填充
};
enum text_just { /* Horizontal and vertical justification
for settextjustify */
LEFT_TEXT = 0,
CENTER_TEXT = 1,
RIGHT_TEXT = 2,
BOTTOM_TEXT = 0,
/* CENTER_TEXT = 1, already defined above */
TOP_TEXT = 2
};
enum line_styles { /* Line styles for get/setlinestyle */
SOLID_LINE = 0,
DOTTED_LINE = 1,
CENTER_LINE = 2,
DASHED_LINE = 3,
USERBIT_LINE = 4, /* User defined line style */
};
enum key_msg_flag {
KEYMSG_CHAR_FLAG = 2,
KEYMSG_DOWN_FLAG = 1,
KEYMSG_UP_FLAG = 1,
KEYMSG_CHAR = 0x40000,
KEYMSG_DOWN = 0x10000,
KEYMSG_UP = 0x20000,
KEYMSG_FIRSTDOWN = 0x80000,
};
struct viewporttype {
int left;
int top;
int right;
int bottom;
int clipflag;
};
struct textsettingstype {
int font;
int direction;
int charsize;
int horiz;
int vert;
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -