Minimal jMonkey app

How can I write a very minimal windowed jMonkey application that does not extend from any other class. I've been playing around with the SimpleGame, etc. classes, but I prefer not to use them. I just don't like getting too much stuff done ready for me :slight_smile: A sample code would be very much appreciated!

SimpleGame is about as simple as it gets. You it as your sample code.

nymon said:

SimpleGame is about as simple as it gets. You it as your sample code.


I agree. The reason SimpleGame exists is for you to try out some of your ideas to see if you like the engine. You should really start working with SimpleGame, since it takes care of things that are less important (like initializing the display system and crap like that) in terms of producing a game. If you're really opposed to it, open the SimpleGame and BaseSimpleGame source code, and you'll see what you need to do to get to the point that SimpleGame takes you.

SimpleGame definitely doesn't do "too much" for you. My primary project is already 10,000 lines of code and is several years away from being workable. You'll have your share of coding cut out for you.

One of my problems with SimpleGame and the other classes is that they have the display options dialog. Yes I know it can be disabled, but what if I want to customize it (more than just change the image)?

The dialog is from LWJGL rather than JME. My approach was to disable it, open up in a window and then give the user an interface to change their settings from inside the game.



But you could just crack open BaseGame and AbstractGame- they don't really do that much. Just make your own version removing the bits you don't want (probably almost all the code in AbstractGame) and replacing them with your own dialog.

A first idea :



package com.digital.game;

import com.jme.input.InputSystem;
import com.jme.system.DisplaySystem;

public class Minimal {
   
   public static void main(String[] args) {
      int freq=60;
      int width=1024;
      int height=768;
      int depth=16;
      boolean fullscreen=true;
      String renderer="LWJGL";
      
      DisplaySystem display = DisplaySystem.getDisplaySystem(renderer);
      display.createWindow(width, height, depth, freq, fullscreen);
      
      while (!display.isClosing()) {
                                             InputSystem.update();
                                             update(-1.0f);
                                             render(-1.0f);
                                             display.getRenderer().displayBackBuffer();
                                             Thread.yield();
                               }
    }

   private static void render(float f) {
      // TODO Auto-generated method stub
      
   }

   private static void update(float f) {
      // TODO Auto-generated method stub
      
   }
   
}

Yeah, you can always use Java's code itself to figure out the size of the computer's display and just set that stuff without showing the dialogue (then, of course, have an in-game menu to edit the settings):


import java.awt.*;
   public Dimension getScreenSize()
   {
      // Get the default toolkit
      Toolkit toolkit = Toolkit.getDefaultToolkit();

      // Get the current screen size
      return toolkit.getScreenSize();
   }
}