Diet3DMIDlet.java.in 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /* $Id: Diet3DMIDlet.java.in,v 1.6 2009-01-12 09:46:33 rzr Exp $ */
  2. #ifndef Diet3DMIDlet_java_in_
  3. #define Diet3DMIDlet_java_in_
  4. #include "HackJavaCpp.java.in"
  5. //#define SINGLE
  6. /**
  7. * @author www.Philippe.COVAL.free.fr
  8. * Copyright and License : http://rzr.online.fr/license.htm
  9. **/
  10. final public class Diet3DMIDlet
  11. extends MIDlet
  12. implements CommandListener
  13. {
  14. Display mDisplay = null ;
  15. Command mExitCommand = null ;
  16. Command cmd = null;
  17. Diet3DCanvas mCanvas = new Diet3DCanvas();
  18. Form fmMain = null;
  19. String msg="Diet3D\n (c) \nwww.rzr.free.fr\nPress Keys to toggle rendermode, shapes etc\n";
  20. StringItem tbAction = null;
  21. boolean started = false;
  22. ChoiceGroup lrender = null;
  23. ChoiceGroup lshape = null;
  24. ChoiceGroup lanim = null;
  25. //String onoff[] = { "off", "on" };
  26. public void info()
  27. {
  28. mCanvas.stop();
  29. mDisplay.setCurrent( fmMain );
  30. }
  31. public void startApp()
  32. {
  33. mDisplay = Display.getDisplay(this);
  34. mCanvas.mDisplay = mDisplay;
  35. fmMain = new Form("www.rzr.free.fr");
  36. //msg += System.getProperty("microedition.profiles" ); //crash uemu
  37. //fmMain.append( msg );
  38. #if 0 //ndef INCLUDE_Diet3D
  39. lanim = new ChoiceGroup
  40. ( "Animation :", Choice.EXCLUSIVE, mCanvas.mRender.vanim, null);
  41. fmMain.append( lanim );
  42. lshape = new ChoiceGroup
  43. ( "Choose Shape :", Choice.EXCLUSIVE, mCanvas.mRender.vshape, null);
  44. fmMain.append( lshape);
  45. lrender = new ChoiceGroup
  46. ( "Choose Rendering mode :"
  47. , Choice.EXCLUSIVE, mCanvas.mRender.vmode, null);
  48. fmMain.append( lrender);
  49. #endif
  50. //--
  51. mExitCommand = new Command("Exit", Command.EXIT, 0);
  52. cmd = new Command("[Menu/Back]", Command.SCREEN, 2);
  53. fmMain.addCommand(mExitCommand);
  54. fmMain.addCommand(cmd);
  55. fmMain.setCommandListener(this);
  56. mCanvas.addCommand(mExitCommand);
  57. mCanvas.addCommand(cmd);
  58. mCanvas.setCommandListener(this);
  59. mCanvas.start();
  60. mDisplay.setCurrent(mCanvas);
  61. }
  62. public void pauseApp()
  63. {
  64. }
  65. public void destroyApp(boolean unconditional)
  66. {
  67. info();
  68. }
  69. public void exit()
  70. {
  71. mCanvas.stop();
  72. pauseApp();
  73. destroyApp( true );
  74. notifyDestroyed();
  75. }
  76. public void commandAction(Command c, Displayable s)
  77. {
  78. if (c.getCommandType() == Command.EXIT) {
  79. exit();
  80. } else { //if ( c == "" ) {
  81. #if 0 // ndef CONFIG_SUPPORT_API_NET_RIM
  82. mCanvas.mRender.toggleAnim( lanim.getSelectedIndex() );
  83. mCanvas.mRender.toggleShape( lshape.getSelectedIndex() );
  84. mCanvas.mRender.toggleMode( lrender.getSelectedIndex() );
  85. #endif
  86. //Form waitForm = new Form("Waiting...");
  87. //mDisplay.setCurrent(waitForm);
  88. //mCanvas.start();
  89. if ( mCanvas.isStarted_ == true) {
  90. mCanvas.stop();
  91. info();
  92. }
  93. else {
  94. mCanvas.start();
  95. mDisplay.setCurrent(mCanvas);
  96. }
  97. }
  98. }
  99. }
  100. #endif
  101. //#eof "$Id: Diet3DMIDlet.java.in,v 1.6 2009-01-12 09:46:33 rzr Exp $"