Java Game Engine

Started by
4 comments, last by GameDev.net 19 years, 5 months ago
Hi, Im currently wanting to design and create my own little game engine in java that will display the games in a window(not applet). I know i will need to create methods that will paint the screen but i am unsure as to how I draw it to a buffer then to screen. I previously made a simple game engine using the windows GDI and from my experience I realised that the need for double buffering is required. I will have methods for things such as cleanup, initialization, drawing the game screen and also things like a game cycle. I have been looking on the net and can find some good tutorials about creating pong however these all refer to how it is done in an applet which is not really what i want.(Im not wanting to make pong BTW, I just looked at them so I could see how the drawing technique was done.) I can figure out that i think i need to use the paintComponent() method but i am unsure on how i would go about putting this in my own method that I can call when I want to draw the screen. Maybe I have got a little confused with my C++ and Java on how things have got drawn to screen?? Does anyone know of a good example on how to draw something double buffered to the screen in java? Any help would be much appreciated Thanks in advance Matt
Advertisement
here (in pdf format) is an article that describes three ways of drawing to the screen in a java application. it also shows you how to obtain information about the graphical capabilites of your/each system, and with the jsdk you'll be able to make a fully functional system very easily. most likely you'll want the last one, FSEM, or fullscreen exclusive mode. you don't need a specific paint(Graphics g) method because you'll be getting the graphics context directly from the backbuffer, which means you can spread the paint calls around. just like in GDI, you have to flip the buffer at the end of your drawing calls. (the part in the article i'm paraphrasing begins on page 17) good luck.

cheers.
- stormrunner
Quote:will display the games in a window(not applet)
For the most part, applet/window is the same thing. Conceptually differeny, different code but same result..

Essentially, you have to realise that they're fairly similar if not identical..

Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

What you could also do is take a look at how the JME engine does it. You will also have to decide on whether you are only going to use plain graphics or implement OpenGL and DirectX.
The ability to succeed is the ability to adapt
Cheers for all the help,

Ill look into that pdf doc so posted asap.

Fullscreen does sound good. Ill have a good luck at it this weekend.


Thanks again


Matt.
http://grexengine.com/sections/externalgames/

click articles and pay close attention to

'space invaders 101'

This topic is closed to new replies.

Advertisement