⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ezcanvas.java

📁 手机上的SLG游戏
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                             return;

                        case 42: // '*'
                             if( press )
                                 keypadState |= 0x400;
                             else
                                 keypadState &= 0xfffffbff;

                             return;

                        case 35: // '#'
                             if( press )
                                 keypadState |= 0x800;
                             else
                                 keypadState &= 0xfffff7ff;

                             return;

                        default:
                             return;
                   }

         }

    }








        //----------------------------------------------------------------------
        //  setBackground
        //----------------------------------------------------------------------
        public void setBackground(int rgb)
        {
                m_g.m_bgcolor = rgb;
        }
       /*
        //----------------------------------------------------------------------
        //  commandAction                                           [interface]
        //----------------------------------------------------------------------
        public void commandAction(Command cmd, Displayable disp)
        {
                // soft key 1
                if (cmd == m_soft1[m_currentSoft1]) {
                        keypadState |= 1 << EZDisplay.KEY_SOFT1;
                }
                // soft key 2
                else if (cmd == m_soft2[m_currentSoft2]) {
                        keypadState |= 1 << EZDisplay.KEY_SOFT2;
                }



        }
       */
        //======================================================================
        //  EZDisplay class
        //======================================================================
        public final class EZDisplay
    {
            public static final int KEY_0        = 0x00;
            public static final int KEY_1        = 0x01;
            public static final int KEY_2        = 0x02;
            public static final int KEY_3        = 0x03;
            public static final int KEY_4        = 0x04;
            public static final int KEY_5        = 0x05;
            public static final int KEY_6        = 0x06;
            public static final int KEY_7        = 0x07;
            public static final int KEY_8        = 0x08;
            public static final int KEY_9        = 0x09;
            public static final int KEY_ASTERISK = 0x0A;
            public static final int KEY_POUND    = 0x0B;
            public static final int KEY_LEFT     = 0x10;
            public static final int KEY_UP       = 0x11;
            public static final int KEY_RIGHT    = 0x12;
            public static final int KEY_DOWN     = 0x13;
            public static final int KEY_SELECT   = 0x14;
            public static final int KEY_SOFT1    = 0x15;
            public static final int KEY_SOFT2    = 0x16;
    }

        //======================================================================
        //  EZGraphics class
        //======================================================================
        public final class EZGraphics
        {
                Graphics  m_g;          // 僆儕僕僫儖偺Grpahics僆僽僕僃僋僩
                public int        m_bgcolor;    // 攚宨怓 (setBackground()梡)

                //----------------------------------------------------------------------
                //  setGraphics
                //----------------------------------------------------------------------
                public void setGraphics(Graphics g)
                {
                        m_g = g;

                }

                //----------------------------------------------------------------------
                //  setOrigin
                //----------------------------------------------------------------------
                public void setOrigin(int x, int y)
                {
                        m_g.translate(x, y);
                }

                //----------------------------------------------------------------------
                //  drawImage
                //----------------------------------------------------------------------
                public void drawImage(Image img, int x, int y)
                {
                        m_g.drawImage(img, x, y, Graphics.TOP | Graphics.LEFT);
                }


                public void drawVImage(Image img, int x, int y)
                {
                        //NKG.drawImage(img, x, y, Graphics.TOP | Graphics.LEFT,NKG.FLIP_HORIZONTAL);
                }



                //----------------------------------------------------------------------
                //  drawLine
                //----------------------------------------------------------------------
                public void drawLine(int x1, int y1, int x2, int y2)
                {
                        m_g.drawLine(x1, y1, x2, y2);
                }

                //----------------------------------------------------------------------
                //  drawRect
                //----------------------------------------------------------------------
                public void drawRect(int x, int y, int w, int h)
                {
                        m_g.drawRect(x, y, w, h);
                }

                //----------------------------------------------------------------------
                //  fillRect
                //----------------------------------------------------------------------
                public void fillRect(int x, int y, int w, int h)
                {
                        m_g.fillRect(x, y, w, h);
                }

                //----------------------------------------------------------------------
                //  drawString
                //----------------------------------------------------------------------
                public void drawString(String str, int x, int y)
                {
                        //m_g.drawString(str, x, y, Graphics.TOP | Graphics.LEFT);
                        //m_g.setColor(0);
                        m_g.drawString(str, x, y,Graphics.TOP | Graphics.LEFT);
                        //m_g.setColor(0xffffff);
                        //m_g.drawString(str, x, y,0);

                }

                //----------------------------------------------------------------------
                //  setFont
                //----------------------------------------------------------------------
                public void setFont(Font f)
                {
                        m_g.setFont(f);
                }

                //----------------------------------------------------------------------
                //  setColor
                //----------------------------------------------------------------------
                public void setColor(int color)
                {
                        m_g.setColor(color);
                }

                //----------------------------------------------------------------------
                //  getColorOfRGB
                //----------------------------------------------------------------------
                public int getColorOfRGB(int r, int g, int b)
                {
                        return (r << 16) + (g << 8) + b;
                }

                //----------------------------------------------------------------------
                //  clearRect
                //----------------------------------------------------------------------
                public void clearRect(int x, int y, int w, int h)
                {
                        int currentRGB = m_g.getColor();
                        m_g.setColor(m_bgcolor);
                        m_g.fillRect(x, y, w, h);
                        m_g.setColor(currentRGB);
                }

                //----------------------------------------------------------------------
                //  drawChars
                //----------------------------------------------------------------------
                public void drawChars(char[] data, int x, int y, int off, int len)
                {
                        m_g.drawChars(data, off, len, x, y, Graphics.TOP | Graphics.LEFT);
                }

                public void lock(){}


                public void unlock(boolean redraw)
                {
                  softkeys();
                  repaint();
                  serviceRepaints();
                  try {
                    Thread.sleep(50);
                  }
                  catch (InterruptedException ex) {
                  }
                }

        }





  void setLabel(Graphics gg){
    ///*
    if(drawsk){
      drawsk=false;
    m_g.setColor(0xffffff);
    m_g.drawString(SoftkeyString_1, 2, 128-14);
    m_g.drawString(SoftkeyString_2, 128-28, 128-14);
    }
    //*/
        }
boolean cheate;
void cheat()
{
  //cheate=!cheate;
  //v7[4]++
}



    void softkeys()
      {
          m_g.setColor(0x0);
           m_g.fillRect(0,208-20,176,20);
           int xx=176-m_g.m_g.getFont().stringWidth(SoftkeyString_2);
           int yy=208-m_g.m_g.getFont().getHeight();

           m_g.setFont(Font.getFont(Font.FACE_SYSTEM,Font.STYLE_PLAIN,Font.SIZE_SMALL));

           m_g.setColor(0xffffff);
           m_g.drawString(SoftkeyString_1,4,yy);
           m_g.drawString(SoftkeyString_2,xx,yy);


  }


}

⌨️ 快捷键说明

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