Implementing a selection quad with border

So, whats the best way to implement it? Right now I don’t have a border on my selection Quad… The selection quad I’m looking for is similar to those found in RTS games. I’ve tried using a Texture, but it won’t work because it would require constant updating, which would slow the game down (the way I tried…). I searched the forums and found, but I wasn’t able to compile the classes for some reason…

Well, you can always add some lines around you're quad if you want something simple. There's a Line shape I think :slight_smile:

Maybe you would like something like what The Librarian did for his game.  Check out the 4th post in this thread:

I'm sure you can contact him for assistance, but he got the inspiration for that code from MonkeyWorld 3D so you might want to go straight there and poke around in the code.

I tried to implement it using simple Lines but I couldn't get the lines to work…  :frowning:

   public static void main(String[] args) {
      LineTest test = new LineTest();
   public void simpleInitGame() {
      Line line = new Line("blah");
      line.addBatch(new LineBatch());

How am I supposed to use it??

Well, your LineBatch is empty, so I am not sure what are you trying to do… Add some vertex and index information to the batch and see if it helps.

You could do this:

    public void simpleInitGame()
        Vector3f vert[] = new Vector3f[] { new Vector3f(0f, 0f, 0f), new Vector3f(10f, 10f, 0f) };
        ColorRGBA color[] = new ColorRGBA[] { new ColorRGBA(1f, 1f, 1f, 0f), new ColorRGBA(1f, 1f, 1f, 0f) };
        Vector2f tex[] = new Vector2f[] { new Vector2f(0f, 0f), new Vector2f(1f, 1f) };
        Line line = new Line( "blah", vert, null, color, tex );

Thanks, I got it working  XD

(Heh, you posted again while I was typing this, but I thought I might as well post it in case it is useful (e.g. if you want a rounded or fancy looking rectangle rather than just lines))

If you want a 3D object that can draw a nice border around a rectangular shape, my grid class should do it, I use it for drawing dialog boxes with rounded corners, but it would work fine for a nice looking rectangle. Basically it does the same effect as this flash scaling thing:

Obviously you will need a different texture that has a transparent hole in the middle, but other than that it should be identical to the way I’ve used it for solid rectangles with rounded corners. There are methods for resizing it as necessary by updating the vertex buffers.

The classes are here: The DialogBox and Grid classes are what you need. If you check out the whole thing, there is a test called TestConsole that will show you a console that uses the dialog area as a background, I use it in aircarrier as well for text dialogs. (It works in 3D as well as the 2D uses shown).