/** 开启游戏 */ public void startGame(MyIO io) { if (io.isApplet() == false) { try { setCursor( Toolkit.getDefaultToolkit() .createCustomCursor( Toolkit.getDefaultToolkit().getImage(""), new Point(0, 0), "invisible")); } catch (Exception e) { } } m_game = new GameWorld(this, io); m_game.start(); }
public void drawSelectIcon(Graphics2D g2d, int x, int y, boolean selected) { if (m_sicon == null) { g2d.setColor(Color.blue); g2d.drawRect(x, y, 32, 32); g2d.setColor(Color.yellow); if (selected) { g2d.fillRect(x + 1, y + 1, 30, 30); } else { g2d.fillRect(x, y, 32, 32); } } else { if (!selected) { Composite oldac = g2d.getComposite(); AlphaComposite ac = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f); g2d.setComposite(ac); g2d.drawImage(m_sicon, x, y, m_game.getPanel()); g2d.setComposite(oldac); } else { g2d.drawImage(m_sicon, x, y, m_game.getPanel()); } } }
/** 停止游戏 */ public void stopGame() { m_game.stop(); m_game = null; repaint(); }