button.h

来自「仙剑演示版源代码」· C头文件 代码 · 共 44 行

H
44 行
字号
#define DOWN 1
#define UP   0
typedef struct
{
       int left;
       int top;
       int right;
       int bottom;
       unsigned char forecolor;
       unsigned char backcolor;
       unsigned char state;
       char *caption;
} BUTTON;
void draw3dbutton(BUTTON button,int ishz)
{
  unsigned char c1=15,c2=0;
  unsigned int  len,cx,cy;
  len=strlen(button.caption);
  cx=(button.right-button.left-len*9)/2+button.left;
  cy=(button.bottom-button.top-10)/2+button.top;
  if (!button.state)
  {
     c1=0;
     c2=15;
  }
  hline(button.left+2,button.right-2,button.bottom-2,c1);
  hline(button.left,button.right,button.bottom,c1);
  vline(button.top+2,button.bottom-2,button.right-2,c1);
  vline(button.top,button.bottom,button.right,c1);
  hline(button.left+2,button.right-2,button.top+2,c2);
  hline(button.left,button.right,button.top,c2);
  vline(button.top+2,button.bottom-2,button.left+2,c2);
  vline(button.top,button.bottom,button.left,c2);
  fill(button.left+3,button.top+3,button.right-3,button.bottom-3,button.backcolor);
  if (ishz)
     hz(cx+button.state,cy+button.state,0,button.caption);
  else
     text(cx+button.state,cy+button.state,button.caption,2,button.forecolor);
}
void novisable(BUTTON button)
{
  fill(button.left,button.top,button.right,button.bottom,BACKCOLOR);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?