?? lutils.cpp
字號:
#include <lutils.h>
#include <string.h>
#include <lkey.h>
char lg_input(char *string,short x1,short y1,short x2,short y2,uchar bcolor,short maxlen);
static void lg_input_draw(char *string,short x1,short y1,short x2,short y2,uchar bcolor,short mode);
char lg_input(char *string,short x1,short y1,short x2,short y2,uchar bcolor,short maxlen)
{ static long *_ttime=(long*)0x46cL;
char ch,cmd=0,ret=0; short code,len=strlen(string),color=ld_workColor;
if (lkpressed()) {
ch=lkgetch(&code);
if (code==KEY_BACKSPACE) string[len-1]=0,cmd=1;
else if (code==KEY_ENTER) ret=1,cmd=1;
else if (code==KEY_ESC) ret=2,cmd=1;
else if (code==KEY_UP||code==KEY_DOWN||code==KEY_LEFT||code==KEY_RIGHT) cmd=1;
if (!cmd) { string[len]=ch; if (++len>maxlen) len=maxlen; string[len]=0; }
}
lg_input_draw(string,x1,y1,x2-9,y2,bcolor,1);
lsetColor(bcolor); lbar(ld_x+1,y1,x2,y2);
if (((*_ttime)&15)<=8) lsetColor(color);
lline(ld_x,ld_y-4,ld_x,ld_y+3);
lsetColor(color);
return ret;
}
static void lg_input_draw(char *string,short x1,short y1,short x2,short y2,uchar bcolor,short mode)
{ short len=x2-x1+1,wid=y2-y1+1,x=x1,y=(y1+y2)/2;
short count=len/8,str_len=strlen(string);
uchar save_bcolor=ld_workBColor,save_color=ld_workColor;
char *p=string;
if (str_len>count) p=string+str_len-count;
ld_workBColor=bcolor;
lgotoxy(x,y);
louttext(p);
lsetColor(bcolor); lline(x,y1,x,y2);
if (mode==0) lbar(ld_x,y1,x1+(count<<3),y2);
ld_workBColor=save_bcolor;
ld_workColor=save_color;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -