Search in sources :

Example 6 with GUIMouseEvent

use of net.drewke.tdme.gui.events.GUIMouseEvent in project tdme by andreasdr.

the class GUI method mousePressed.

/*
	 * (non-Javadoc)
	 * @see com.jogamp.newt.event.MouseListener#mousePressed(com.jogamp.newt.event.MouseEvent)
	 */
public void mousePressed(MouseEvent event) {
    lockEvents();
    GUIMouseEvent guiMouseEvent = mouseEventsPool.allocate();
    guiMouseEvent.setTime(System.currentTimeMillis());
    guiMouseEvent.setType(Type.MOUSE_PRESSED);
    guiMouseEvent.setX(event.getX());
    guiMouseEvent.setY(event.getY());
    guiMouseEvent.setButton(event.getButton());
    guiMouseEvent.setWheelX(event.getRotation()[0] * event.getRotationScale());
    guiMouseEvent.setWheelY(event.getRotation()[1] * event.getRotationScale());
    guiMouseEvent.setWheelZ(event.getRotation()[2] * event.getRotationScale());
    guiMouseEvent.setProcessed(false);
    mouseEvents.add(guiMouseEvent);
    unlockEvents();
}
Also used : GUIMouseEvent(net.drewke.tdme.gui.events.GUIMouseEvent)

Example 7 with GUIMouseEvent

use of net.drewke.tdme.gui.events.GUIMouseEvent in project tdme by andreasdr.

the class GUI method fakeMouseMovedEvent.

/**
	 * Fake mouse moved event
	 */
private void fakeMouseMovedEvent() {
    lockEvents();
    GUIMouseEvent guiMouseEvent = mouseEventsPool.allocate();
    guiMouseEvent.setTime(System.currentTimeMillis());
    guiMouseEvent.setType(Type.MOUSE_MOVED);
    guiMouseEvent.setX(-10000);
    guiMouseEvent.setY(-10000);
    guiMouseEvent.setButton(0);
    guiMouseEvent.setWheelX(0f);
    guiMouseEvent.setWheelY(0f);
    guiMouseEvent.setWheelZ(0f);
    guiMouseEvent.setProcessed(false);
    mouseEvents.add(guiMouseEvent);
    unlockEvents();
}
Also used : GUIMouseEvent(net.drewke.tdme.gui.events.GUIMouseEvent)

Example 8 with GUIMouseEvent

use of net.drewke.tdme.gui.events.GUIMouseEvent in project tdme by andreasdr.

the class GUI method mouseReleased.

/*
	 * (non-Javadoc)
	 * @see com.jogamp.newt.event.MouseListener#mouseReleased(com.jogamp.newt.event.MouseEvent)
	 */
public void mouseReleased(MouseEvent event) {
    lockEvents();
    GUIMouseEvent guiMouseEvent = mouseEventsPool.allocate();
    guiMouseEvent.setTime(System.currentTimeMillis());
    guiMouseEvent.setType(Type.MOUSE_RELEASED);
    guiMouseEvent.setX(event.getX());
    guiMouseEvent.setY(event.getY());
    guiMouseEvent.setButton(event.getButton());
    guiMouseEvent.setWheelX(event.getRotation()[0] * event.getRotationScale());
    guiMouseEvent.setWheelY(event.getRotation()[1] * event.getRotationScale());
    guiMouseEvent.setWheelZ(event.getRotation()[2] * event.getRotationScale());
    guiMouseEvent.setProcessed(false);
    mouseEvents.add(guiMouseEvent);
    unlockEvents();
    // add additional mouse moved event
    mouseMoved(event);
}
Also used : GUIMouseEvent(net.drewke.tdme.gui.events.GUIMouseEvent)

Example 9 with GUIMouseEvent

use of net.drewke.tdme.gui.events.GUIMouseEvent in project tdme by andreasdr.

the class GUI method mouseWheelMoved.

/*
	 * (non-Javadoc)
	 * @see com.jogamp.newt.event.MouseListener#mouseWheelMoved(com.jogamp.newt.event.MouseEvent)
	 */
public void mouseWheelMoved(MouseEvent event) {
    lockEvents();
    GUIMouseEvent guiMouseEvent = mouseEventsPool.allocate();
    guiMouseEvent.setTime(System.currentTimeMillis());
    guiMouseEvent.setType(Type.MOUSE_WHEEL_MOVED);
    guiMouseEvent.setX(event.getX());
    guiMouseEvent.setY(event.getY());
    guiMouseEvent.setButton(0);
    guiMouseEvent.setWheelX(event.getRotation()[0] * event.getRotationScale());
    guiMouseEvent.setWheelY(event.getRotation()[1] * event.getRotationScale());
    guiMouseEvent.setWheelZ(event.getRotation()[2] * event.getRotationScale());
    guiMouseEvent.setProcessed(false);
    mouseEvents.add(guiMouseEvent);
    unlockEvents();
}
Also used : GUIMouseEvent(net.drewke.tdme.gui.events.GUIMouseEvent)

Aggregations

GUIMouseEvent (net.drewke.tdme.gui.events.GUIMouseEvent)9 GUIKeyboardEvent (net.drewke.tdme.gui.events.GUIKeyboardEvent)3 ArrayList (java.util.ArrayList)1 Camera (net.drewke.tdme.engine.Camera)1 Entity (net.drewke.tdme.engine.Entity)1 Rotation (net.drewke.tdme.engine.Rotation)1 FacesEntity (net.drewke.tdme.engine.model.FacesEntity)1 Vector3 (net.drewke.tdme.math.Vector3)1 LevelEditorEntity (net.drewke.tdme.tools.shared.model.LevelEditorEntity)1 LevelEditorObject (net.drewke.tdme.tools.shared.model.LevelEditorObject)1