Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Active Rendering in J2ME  (Read 3970 times)
0 Members and 1 Guest are viewing this topic.
Offline paulo.carabuena

Senior Newbie





« Posted 2011-12-07 17:49:10 »

hi guys.. my problem is that idk how to implement an active rendering in J2ME..

i've tried to do so, however the application is not working.. nothing happens after I run the program..

here is my source code..

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
public StandardMobileMode(boolean suppressKeyEvents, javax.microedition.lcdui.Display display) {
      super(suppressKeyEvents);
      this.display = display;
      this.currentGraphics = new MIDletGraphics();
   }

   public Graphics getBackBuffer() {
      currentGraphics.setGraphics(this.getGraphics());
      return currentGraphics;
   }

   public boolean flip() {
      this.flushGraphics();
      return true;
   }


btw this is based from GTGE engine.. the getBackBuffer() function returns graphics object from the canvas.. the StandardMobileMode is a subclass of GameCanvas..

this is how i initialized the game canvas.. the class containing this function is a subclass of MIDlet..

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
public void setup(Game game) {
      try {
         engine.mountGame(game);
         /* Initialize File IO */
         engine.fileIO = new MobileIO();
         /* Initialize Display */
         javax.microedition.lcdui.Display display = javax.microedition.lcdui.Display.getDisplay(this);
         engine.display = new StandardMobileMode(false, display);
         /* Initialize System Time */
         engine.timer = new StandardTimer();
      } catch(Exception e) {
         System.exit(-1);
      }
   }
   


and this is how my gameloop works...

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
      while(isRunning) {
         if(!isPaused) {
            this.game.update(elapsedTime);
         }
         
         do {
            if(!isRunning) {
               break;
            }
            Graphics g = display.getBackBuffer();
            this.game.render(g);
         } while(!this.display.flip());
         
         elapsedTime = this.timer.sleep();
         if(elapsedTime > 100) {
            elapsedTime = 100;
         }
      }


i can't seem to make this run.. all i get is a blank screen.. can somebody help me? thanks in advance..Smiley
Offline SimonH
« Reply #1 - Posted 2011-12-07 18:12:20 »

It's a long time since I did any J2ME - you could try the guys over at j2me.org. IIRC they're a nice bunch.

People make games and games make people
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Riven (12 views)
2014-07-29 18:09:19

Riven (10 views)
2014-07-29 18:08:52

Dwinin (9 views)
2014-07-29 10:59:34

E.R. Fleming (26 views)
2014-07-29 03:07:13

E.R. Fleming (10 views)
2014-07-29 03:06:25

pw (40 views)
2014-07-24 01:59:36

Riven (39 views)
2014-07-23 21:16:32

Riven (27 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!