Hey everyone, I’ve been reading through the forums for the last few weeks and would like to sap some of your knowledge.
I want to write a simple online 2D game that (for now) doesn’t run in full screen mode, but is dynamic so it adapts to the user resizing the window (they aren’t allowed to make it too small). I have the online bit worked out and so far it is working well, I have a multithreaded socket-based server that can handle several clients. Data can be passed between the client and server in a satisfactory way.
Anyway on to the 2D graphics…
Here’s the basic plan for my GUI:
http://aycu11.webshots.com/image/35130/2000003063749521856_rs.jpg
I first made this using Swing and it worked well, but I couldn’t figure out how to customise the Swing components. What I would like is to have my own images for the border of the components (such as JTextField) and my own images for the background in the box, etc. Is this possible with Swing or any thing similar?
Another thought was to take control of this all myself. I set up a thread which renders the screen in a buffer and then paints the image straight to the JPanel. I could then draw what I want. I would have to code everything such as changing the mouse to the Cursor.TEXT_CURSOR when they go over the area that I designate as being the text area, then handle keyboard input and display the appropriate characters, etc. I’m assuming this isn’t the way to go as there’s so much work involved, all of which has been done before. Below is a screenshot of my first attempt at this method, where I draw the text and lines:
How can I get the custom graphics in the GUI how I want, but still have all the nitty-gritty bits done for me, like with Swing? Is using one of the freely available Graphics API’s the answer?
I hope this makes sense, sorry for the long post!
Cheers.