手机按键处理,资料1

手机按键处理,资料1

    到了彩虹六号和Medieval Combat时因为在短时间内需要判断连续不同按键来发大招,所以按键处理引入了虚拟按键的概念:
    public static final int gk_UP         = 1;
    public static final int gk_DOWN       = 1<<1;
    public static final int gk_LEFT       = 1<<2;
    public static final int gk_RIGHT      = 1<<3;
    public static final int gk_NUM0       = 1<<4;
    public static final int gk_NUM1       = 1<<5;
    public static final int gk_NUM2       = 1<<6;
    public static final int gk_NUM3       = 1<<7;
    public static final int gk_NUM4       = 1<<8;
    public static final int gk_NUM5       = 1<<9;
    public static final int gk_NUM6       = 1<<10;
    public static final int gk_NUM7       = 1<<11;
    public static final int gk_NUM8       = 1<<12;
    public static final int gk_NUM9       = 1<<13;
    public static final int gk_STAR       = 1<<14;
    public static final int gk_POUND      = 1<<15;
    public static final int gk_LSOFT      = 1<<16;
    public static final int gk_RSOFT      = 1<<17;
    public static final int gk_MSOFT      = 1<<18;
   
    在一定时间内用mask对curKey做掩码就可以判断是否按下了一组特定键,时间过了就清空curKey。

Leave a Reply

Your email address will not be published. Required fields are marked *