📄 mouse.h
字号:
#ifndef MY_MOUSE_H
#define MY_MOUSE_H
/* file: mouse.h
*/
#include <graphics.h>
#include <stdlib.h>
#include <dos.h>
#include "point.h"
#define MOUSE_INT 0x33
/*鼠标光标位图(十字形状)*/
static unsigned short Cursor[320]=
{
0x000f,0x000f,000000,000000,0x0001,000000,000000,000000,0x0001,000000,000000,000000,0x0001,000000,000000,000000,
0x0001,000000,000000,000000,0x0001,000000,000000,000000,000000,000000,000000,000000,000000,000000,000000,000000,
0x3ef9,000000,000000,000000,000000,000000,000000,000000,000000,000000,000000,000000,0x0001,000000,000000,000000,
0x0001,000000,000000,000000,0x0001,000000,000000,000000,0x0001,000000,000000,000000,0x0001,000000,000000,000000,
000000,000000,0x0d3f,0xffd4,0x0498,0x0d3f,0xffdc,0x05ba,0x0002,0x0009,0xffe8,0x011d,0x0001,0xffe6,0x0f64,0xffea,
000000,0x3a43,0x545c,0x4152,0x4e49,0x545c,0x4152,0x4e49,0x452e,0x4558,000000,0x00fb,000000,000000,0x7554,0x6272,
0x2d6f,0x2043,0x202d,0x6f43,0x7970,0x6972,0x6867,0x2074,0x6328,0x2029,0x3931,0x3838,0x4220,0x726f,0x616c,0x646e,
0x4920,0x746e,0x2e6c,0x4e00,0x6c75,0x206c,0x6f70,0x6e69,0x6574,0x2072,0x7361,0x6973,0x6e67,0x656d,0x746e,0x0a0d,
0x6944,0x6976,0x6564,0x6520,0x7272,0x726f
};
/* 设置鼠标X方向运动范围 */
static void SetCursorXRange(int MinX, int MaxX)
{
union REGS inregs;
union REGS outregs;
inregs.x.ax=0x0007;
inregs.x.cx=MinX;
inregs.x.dx=MaxX;
/* 调用鼠标中断 */
int86(MOUSE_INT,&inregs,&outregs);
}/*end SetCursorXRange*/
/* 设置鼠标Y方向运动范围 */
static void SetCursorYRange(int MinY, int MaxY)
{
union REGS inregs;
union REGS outregs;
inregs.x.ax=0x0008;
inregs.x.cx=MinY;
inregs.x.dx=MaxY;
/* 调用鼠标中断 */
int86(MOUSE_INT,&inregs,&outregs);
}/*end SetCursorYRange*/
/* 设置鼠标运动范围 */
static void SetCursorRange(int MinX, int MaxX, int MinY, int MaxY)
{
SetCursorXRange(MinX,MaxX);
SetCursorYRange(MinY,MaxY);
}/*end SetCursorRange*/
/* 绘制鼠标 */
static void ShowCursor(POINT* ppoint)
{
putimage(ppoint->x-7,ppoint->y-7,Cursor,XOR_PUT);
}/*end ShowCursor*/
/* 获取鼠标按键状态和位置 */
static int GetMouseState(POINT* pMousePos)
{
union REGS inregs;
union REGS outregs;
inregs.x.ax=3;
/* 调用鼠标中断 */
int86(MOUSE_INT,&inregs,&outregs);
if( pMousePos != NULL )
{
pMousePos->x=outregs.x.cx;
pMousePos->y=outregs.x.dx;
}/*end if*/
return outregs.x.bx;
}/*end GetMouseState*/
/* 初始化鼠标 */
static void InitMouse(void)
{
union REGS regs;
regs.x.ax=0x0000;
/* 调用鼠标中断 */
int86(MOUSE_INT,®s,®s);
}/*end InitMouse*/
#endif /*define MY_MOUSE_H*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -