Ejemplo n.º 1
0
 public GameMenu(GameMain midlet_ /*,ConnectionServer conn_,RoleDataValue roleData_*/) {
   // true->使用GameAction(boolean suppressKeyEvents) , false->不使用GameAction(boolean
   // suppressKeyEvents)
   super(false);
   // 使用全螢幕
   setFullScreenMode(true);
   midlet = midlet_;
   // music = music_;
   // roleData = roleData_;
   display = midlet.getDisplay();
   layMa = new LayerManager();
   spInterface = new Sprite(createImage("/image/gameInterface/inface.png"), bgWidth, bgHeight);
   spName = new Sprite(createImage("/image/gameInterface/Title.png"), 84, 15);
   menustate = 0;
   menuNum = 3;
   // setFullScreenMode(true);
   g = getGraphics();
   /*if(!(getWidth()<176) || !(getHeight()<208)){
   	disWidth = (getWidth()-176)/2;//抓取螢幕的中心點
   	disHeight = (getHeight()-208)/2;//抓取螢幕的中心點
   }*/
   // 設定Sprite位置
   spName.setPosition(80, 20);
   spInterface.setPosition(0, 0);
   // 加入到LayerManager
   layMa.append(spName);
   spName.setVisible(false);
   layMa.append(spInterface);
   spInterface.setFrame(0);
   System.out.println("start");
   start();
 }
Ejemplo n.º 2
0
 // 顯示畫面
 public void drawDisplay() {
   g = getGraphics();
   g.setColor(0, 0, 0);
   g.drawRect(disWidth - 1, disHeight - 1, 176 + 1, 208 + 1);
   layMa.paint(g, disWidth, disHeight);
   g.drawString(getWidth() + "|" + getHeight(), 0, 0, 0);
   flushGraphics();
 }