0

I have a 2.5D isometric game that I would like to add a interactive HUD to. I tried using JButtons with Icons but could not draw both the button and my game at once. I'm looking for a cost-efficient (computer resources-wise) technique in which I can draw my own images/buttons to the screen on top of my game.

James Dunn
  • 8,064
  • 13
  • 53
  • 87
Geoffroi
  • 135
  • 1
  • 7

1 Answers1

0

Most likely will require you to create your own.

First you will need a method of capturing the click event (You may be able to use Swing's existing one depending on your engine). You could for example register a single click event on the screen itself and then implement a method of "capturing" that event through to the component which was clicked on.

Next you will want to create button class which handles its state (MouseOver,Pressed,Unpressed), size and position.

Finally style or how you want your buttons to look. one possible method would be a 9-Patch, which is essentially 9 tiny images that are repeated in such a way to form a stretchable button.

9 Patch

9 Patch Resource - It's for android but the concept still applies

You can also take a look to see how other engines do it such as LibGDX.

Hope This Helps

Community
  • 1
  • 1
AbstractChaos
  • 4,211
  • 1
  • 19
  • 28