import javax.microedition.lcdui.*; import javax.microedition.midlet.*; import javax.microedition.rms.*; import java.util.Date; import java.io.*; public class SuliMIDlet extends MIDlet implements CommandListener { private Command CmdExit; private Form LogoF; private StringItem LogoS1; private Form SzbF; private StringItem SzbS1; private Form ScoreF; private StringItem ScoreS1; private Form NyertF; private StringItem NyertS1; private Command CUJQJATEK; private Command CEREDMENYEK; private Command CTITKOSQMENU; private Command CINFORMACIO; private Command COKQ; private Command CQQQQ; private Command CTOVABB; private Canvas Cv1; private Canvas Cv2; private Graphics G2; private String label; private String Score; private int n; private int rnd; private RecordStore rs; private String rndS; private Date today = new Date(System.currentTimeMillis()); private long ido = today.getTime(); private ImageItem imageItem; private ImageItem imageItem2; public SuliMIDlet() { // MINDEN F CmdExit = new Command("Kilépés", Command.SCREEN, 1); CUJQJATEK = new Command("Új játék", Command.SCREEN, 0); CEREDMENYEK = new Command("Eredmények", Command.SCREEN, 0); CTITKOSQMENU = new Command("Titkos menü", Command.SCREEN, 0); CINFORMACIO = new Command("Információ", Command.SCREEN, 0); COKQ = new Command("OK ", Command.SCREEN, 0); CQQQQ = new Command(" ", Command.SCREEN, 0); CTOVABB = new Command("Tovább", Command.SCREEN, 0); // LOGO F LogoF = new Form("Mászkál"); LogoS1 = new StringItem(null, ""); LogoS1.setText("Üdvözöllek"); LogoF.append(LogoS1); //Image and ImageItem try { Image image = Image.createImage("/Logo2.png"); imageItem = new ImageItem("ImageItem is below:", image, ImageItem.LAYOUT_NEWLINE_BEFORE, "Alternate text for the image file"); //LogoF.append(image); // LogoF.append(imageItem); } catch (java.io.IOException e) {} LogoF.addCommand(CUJQJATEK); LogoF.addCommand(CEREDMENYEK); // LogoF.addCommand(CTITKOSQMENU); LogoF.addCommand(CINFORMACIO); LogoF.addCommand(CmdExit); // SZB F SzbF = new Form("Információ"); SzbS1 = new StringItem(null, ""); SzbS1.setText("A programot SzB készítette. \n\nVerzió: 0.1 \n\nUtolsó frissítés: \n2007. okt. 5."); SzbF.append(SzbS1); SzbF.addCommand(COKQ); SzbF.addCommand(CmdExit); // SCORE F ScoreF = new Form("Eredmények"); ScoreS1 = new StringItem(null, ""); ScoreS1.setText(Score); ScoreF.append(ScoreS1); ScoreF.addCommand(CQQQQ); ScoreF.addCommand(COKQ); // NYERT F NyertF = new Form("Nyertél!"); NyertS1 = new StringItem(null, "Sikerült teljesíteni a pályát!"); NyertF.append(NyertS1); NyertF.addCommand(CTOVABB); } public void startApp() { Display.getDisplay(this).setCurrent(SzbF); SzbF.setCommandListener(this); try{ rs = RecordStore.openRecordStore("SuliRS",true); Score = "0"; byte bytes[] = Score.getBytes(); rs.addRecord(bytes,0,bytes.length); byte b[] = rs.getRecord(1); Score = new String(b,0,b.length); rs.closeRecordStore(); } catch(RecordStoreException rse){} /*Cv1 = new LineCanvas(); Cv2 = new LineCanvas(); int width = Cv1.getWidth(); int height = Cv1.getHeight(); LogoS1.setText("Szélesség: "+width+"\nMagasság: "+height); //Cv1.addCommand(CUJQJATEK); //Cv1.addCommand(COKQ); Cv1.setFullScreenMode(true); Display.getDisplay(this).setCurrent(Cv1); Cv1.setCommandListener(this);*/ canvas3.setFullScreenMode(true); Display.getDisplay(this).setCurrent(canvas3); canvas3.setCommandListener(this); } public void pauseApp() {} public void destroyApp(boolean unconditional) {} public void commandAction(Command c, Displayable s) { label = c.getLabel(); if(label == "Kilépés"){ notifyDestroyed(); } if(label == "OK "){ label = "XLOGO"; } if(label == "Vissza"){ label = "XLOGO"; } if(label == "XLOGO"){ Display.getDisplay(this).setCurrent(LogoF); LogoF.setCommandListener(this); } if(label == "Információ"){ label = "XINFO"; } if(label == "XINFO"){ Display.getDisplay(this).setCurrent(SzbF); SzbF.setCommandListener(this); } if(label == "Eredmények"){ label = "XSCORE"; } if(label == "OK"){ label = "XSCORE"; } if(label == "Megállok"){ label = "XSCORE"; } if(label == "XSCORE"){ try{ rs = RecordStore.openRecordStore("SuliRS",true); if(Integer.parseInt(Score)