1.自定义EGE窗口创建
/*EGE窗口样式:
0 普通窗口 0x0
1 无边框窗口 0x1
2 子窗口 0x2
3 置顶窗口 0x4
4 带egelogo窗口 0x100
*/
void dr_open(bool win,int width,int height,int style){
/*dr_open参数
参数1 是否全屏模式
参数2 宽,若使用全屏,此参数可随意填写
参数3 高,若使用全屏,此参数可随意填写
参数4 窗口样式
*/
int j_width = 0;
int j_height=0;
int j_style=0;
if(win == true){
j_width=-1;j_height=-1;
}else{
j_width=width;j_height=height;
}
if(style==0){ j_style=0x0;
}else if(style==1){ j_style=0x1;
}else if(style==2){ j_style=0x2;
}else if(style==3){ j_style=0x4;
}else if(style==4){ j_style=0x100;
}
initgraph(j_width,j_height,j_style);
}2.循环取键盘鼠标
while(true){
if(keystate(key_esc)){
break;
}
else{
dr_ifkey();
}
}3.测试用的自定义函数
void dr_ifkey(){
if(keystate(key_A)){
//如果按下了a,则在窗口中显示一个helloworld
char s[]="hello,world";
outtext(s);
}
}