Mouse, Control Code

Hi



I was writing a visualisation toolkit in Java a while back (5 or 6 months ago) than stopped. I recently began development again, but some codes were changed (I was using the nightly build before with RenderThreadExecutable, RenderThreadQueue etc)  for my mouse action such as panning, zooming in. Can anyone point me to some new sample code on how these are done now ? I've looked through the Jmetest packages but can't find what I wanted.



For example my old code would be (I don't know if implement it correctly in the first place)


       

  public void mouseDragged(final MouseEvent arg0) {

RenderThreadExecutable exe = new RenderThreadExecutable() {
            public void doAction() {
              
                int difX = last.x - arg0.getX();
                int difY = last.y - arg0.getY();
                int mult = arg0.isShiftDown() ? 10 : 1;
                last.x = arg0.getX();
                last.y = arg0.getY();
               
                int mods = arg0.getModifiers();
                if ((mods & MouseEvent.BUTTON1_MASK) != 0) {
                    rotateCamera(Vector3f.UNIT_Y, difX * 0.0025f);
                    rotateCamera(impl.getRenderer().getCamera().getLeft(),
                        -difY * 0.0025f);
                }
                if ((mods & MouseEvent.BUTTON2_MASK) != 0 && difY != 0) {
                    zoomCamera(difY * mult);
                }
                if ((mods & MouseEvent.BUTTON3_MASK) != 0) {
                    panCamera(-difX, -difY);
                }
            }
        };
        RenderThreadActionQueue.addToQueue(exe);



Thanks, Dave

You want something like this:

        Callable<?> exe = new Callable() {
            public Object call() {
                // your code here...
                return null;
            }
        };
        GameTaskQueueManager.getManager().getQueue(GameTaskQueue.RENDER).enqueue(exe);



Note that you can use different built in queues or define your own.