Using Slick without GameContainer

I’ve decided to implement slick as it has many features that Java2D lacks, and is simpler to use than straight up lwjgl. My issue is, I really only want to access it’s Graphics and Geom utilities (at the moment). Using the Graphics class to draw is straight foward (drawing on a Canvas), but I do this to update the image:

graphics = buffer.getDrawGraphics();
graphics.drawImage (bi, 0, 0, null);

here graphics is Java’s Graphics class. Does anyone know how to do this using slick? Do I need to? Am I thinking about this wrong?

What is your question? ???

You don’t need to create a game container. You can use your own game loop.

To use graphics it would look something like this:

... init ...
   g = new Graphics(width, height);

... render ...
   g.drawRect(...);

To use image graphics it would look like this, using the latest code:

... init ...
    //creates a new FBO and texture 
    image = Image.createOffscreenGraphics(256, 256);
    imageGraphics = image.getGraphics();    

... render ...
    imageGraphics.drawRect(...);
    imageGraphics.flush();

    //draw to screen
    g.drawImage(imageGraphics, x, y);

You should look into the code for GameContainer and AppGameContainer for more details on how Graphics is set up and used.

I understand how to use the Graphics class in slick, as I said. But, I believe you’ve actually answered my question. Thanks you.