Sign in to follow this  

Java Game Engine

This topic is 4763 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
http://grexengine.com/sections/externalgames/

click articles and pay close attention to

'space invaders 101'

Share this post


Link to post
Share on other sites

This topic is 4763 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this