EVENT.H
资源名称:C++100.rar [点击查看]
上传用户:wszmarenbt
上传日期:2013-04-26
资源大小:2552k
文件大小:1k
源码类别:
Windows编程
开发平台:
Visual C++
- //File Event.h
- #include <bios.h>
- #include "Mouse.h"
- #define MBUTTON 1
- #define KEYBD 2
- #define CR 13
- #define ESC 27
- #define BACKSP 8
- struct EventMsg
- {
- int type,mx,my,button;
- unsigned key;
- };
- int KeyEvent(void)
- {
- int key=bioskey(1);
- if (key)key=bioskey(0);
- return key;
- }
- void GetEvent(EventMsg&eventMsg)
- {
- /*while ((!mouse.Event())&&(!(eventMsg.key=KeyEvent()))){}*/
- //******************************************Corresponding The Above Line
- if((!mouse.Event())&&(!(eventMsg.key=KeyEvent()))){}
- //******************************************Corresponding The Above Line
- eventMsg.button=mouse.GetButton();
- if (eventMsg.button)
- {
- eventMsg.type=MBUTTON;
- mouse.GetXY(eventMsg.mx,eventMsg.my);
- }
- else
- {
- eventMsg.type=KEYBD;
- eventMsg.mx=-1;
- eventMsg.my=-1;
- }
- }