当前位置: 首页>>代码示例>>Java>>正文


Java GLWindow.addMouseListener方法代码示例

本文整理汇总了Java中com.jogamp.newt.opengl.GLWindow.addMouseListener方法的典型用法代码示例。如果您正苦于以下问题:Java GLWindow.addMouseListener方法的具体用法?Java GLWindow.addMouseListener怎么用?Java GLWindow.addMouseListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jogamp.newt.opengl.GLWindow的用法示例。


在下文中一共展示了GLWindow.addMouseListener方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: attachInputListenerTo

import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
public void attachInputListenerTo(final GLWindow window) {
    if(null == sbcMouseListener) {
        sbcMouseListener = new SBCMouseListener();
        window.addMouseListener(sbcMouseListener);
        sbcGestureListener = new SBCGestureListener();
        window.addGestureListener(sbcGestureListener);
        pinchToZoomGesture = new PinchToZoomGesture(window.getNativeSurface(), false);
        window.addGestureHandler(pinchToZoomGesture);
    }
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:11,代码来源:SceneUIController.java

示例2: attachInputListenerTo

import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
/** Attach the input listener to the window */
public void attachInputListenerTo(final GLWindow window) {
    if ( null == keyAction ) {
        keyAction = new KeyAction();
        window.addKeyListener(keyAction);
    }
    if ( null == mouseAction ) {
        mouseAction = new MouseAction();
        window.addMouseListener(mouseAction);
    }
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:12,代码来源:UIListenerBase01.java

示例3: main

import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) {
	Logger.getLogger("").setLevel(Level.WARNING);

	// create GL canvas
	GLProfile glp = Engine.getProfile();
	GLCapabilities caps = new GLCapabilities(glp);

	// create GL window
	GLWindow glWindow = GLWindow.create(caps);
	glWindow.setTitle("EngineTest");

	// animator
	FPSAnimator animator = new FPSAnimator(glWindow, 60);

	// tdme level editor
	EngineTest engineTest = new EngineTest(glWindow, animator);
	
	// GL Window
	glWindow.addGLEventListener(engineTest);
	glWindow.setSize(800, 600);
	glWindow.setVisible(true);
	glWindow.addKeyListener(engineTest);
	glWindow.addMouseListener(engineTest);
	glWindow.addWindowListener(engineTest);
	
	// start animator
	animator.setUpdateFPSFrames(3, null);
	animator.start();
}
 
开发者ID:andreasdr,项目名称:tdme,代码行数:33,代码来源:EngineTest.java

示例4: main

import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) {
	Logger.getLogger("").setLevel(Level.WARNING);

	// create GL canvas
	GLProfile glp = Engine.getProfile();
	GLCapabilities caps = new GLCapabilities(glp);

	// create GL window
	GLWindow glWindow = GLWindow.create(caps);
	glWindow.setTitle("PhysicsTest1");

	// animator
	FPSAnimator animator = new FPSAnimator(glWindow, 60);

	// tdme level editor
	PhysicsTest1 physicsTest1 = new PhysicsTest1();
	
	// GL Window
	glWindow.addGLEventListener(physicsTest1);
	glWindow.setSize(800, 600);
	glWindow.setVisible(true);
	glWindow.addKeyListener(physicsTest1);
	glWindow.addMouseListener(physicsTest1);
	glWindow.addWindowListener(physicsTest1);
	
	// start animator
	animator.setUpdateFPSFrames(3, null);
	animator.start();
}
 
开发者ID:andreasdr,项目名称:tdme,代码行数:33,代码来源:PhysicsTest1.java

示例5: main

import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
/**
 * Main
 * @param args
 */
public static void main(String[] args) {
	Logger.getLogger("").setLevel(Level.WARNING);

	// create GL canvas
	GLProfile glp = Engine.getProfile();
	GLCapabilities caps = new GLCapabilities(glp);

	// create GL window
	GLWindow glWindow = GLWindow.create(caps);
	glWindow.setTitle("PhysicsTest2");

	// animator
	FPSAnimator animator = new FPSAnimator(glWindow, 60);

	// tdme level editor
	PhysicsTest2 physicsTest2 = new PhysicsTest2();
	
	// GL Window
	glWindow.addGLEventListener(physicsTest2);
	glWindow.setSize(800, 600);
	glWindow.setVisible(true);
	glWindow.addKeyListener(physicsTest2);
	glWindow.addMouseListener(physicsTest2);
	glWindow.addWindowListener(physicsTest2);
	
	// start animator
	animator.setUpdateFPSFrames(3, null);
	animator.start();
}
 
开发者ID:andreasdr,项目名称:tdme,代码行数:34,代码来源:PhysicsTest2.java

示例6: main

import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
/**
 * Main
 * @param args
 */
public static void main(String[] args) {
	Logger.getLogger("").setLevel(Level.WARNING);

	// create GL canvas
	GLProfile glp = Engine.getProfile();
	GLCapabilities caps = new GLCapabilities(glp);

	// create GL window
	GLWindow glWindow = GLWindow.create(caps);
	glWindow.setTitle("PhysicsTest3");

	// animator
	FPSAnimator animator = new FPSAnimator(glWindow, 60);

	// tdme level editor
	PhysicsTest3 physicsTest3 = new PhysicsTest3();
	
	// GL Window
	glWindow.addGLEventListener(physicsTest3);
	glWindow.setSize(800, 600);
	glWindow.setVisible(true);
	glWindow.addKeyListener(physicsTest3);
	glWindow.addMouseListener(physicsTest3);
	glWindow.addWindowListener(physicsTest3);
	
	// start animator
	animator.setUpdateFPSFrames(3, null);
	animator.start();
}
 
开发者ID:andreasdr,项目名称:tdme,代码行数:34,代码来源:PhysicsTest3.java

示例7: NeonNewtWindow

import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
/**
 * Constructor for this class. Sets up the window and enables common
 * features like anti-aliasing and hardware acceleration.
 * 
 * @param forceGL2ES2
 *            Force GL2ES2 support (default on), currently Unused
 * @param inputHandler
 *            A predefined InputHandler that is added as event handler for
 *            input events.
 * @param glEventListener
 *            A predefined GLEventListener that is added as event handler
 *            for openGL events.
 * @param width
 *            The initial window width.
 * @param height
 *            The initial window height.
 * @param windowTitle
 *            The window title.
 */
public NeonNewtWindow(boolean forceGL2ES2, InputHandler inputHandler, final GLEventListener glEventListener,
        int width, int height, String windowTitle) {

    GLProfile.initSingleton();

    final GLProfile glp;
    glp = GLProfile.get(GLProfile.GL3);

    // Set up the GL context
    final GLCapabilities caps = new GLCapabilities(glp);
    caps.setBackgroundOpaque(true);
    caps.setHardwareAccelerated(true);
    caps.setDoubleBuffered(true);

    // Add Anti-Aliasing
    caps.setSampleBuffers(true);
    caps.setAlphaBits(4);
    caps.setNumSamples(4);

    GLWindow window = GLWindow.create(caps);

    window.addGLEventListener(glEventListener);
    window.addWindowListener(new QuitListener());
    window.setAutoSwapBufferMode(true);
    window.setSize(width, height);
    window.setTitle(windowTitle);
    window.addMouseListener(inputHandler);
    window.addKeyListener(inputHandler);

    Animator animator = new Animator();
    animator.add(window);
    animator.start();
    animator.setUpdateFPSFrames(60, null);

    window.setVisible(true);

}
 
开发者ID:NLeSC,项目名称:Neon,代码行数:57,代码来源:NeonNewtWindow.java

示例8: InputHandler

import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
/**
 * Initializes the inputs and sets up a {@code Robot} that controls the mouse.
 * @param c
 */
public InputHandler(Controller c) {
	this.c = c;
	GLWindow win = c.getWindow();
	
	try {
		robot = new Robot();
	} catch (AWTException e) {
		throw new RuntimeException("The program will not function properly with the current permissions");
	}
	
	win.addKeyListener(this);
	win.addMouseListener(this);
	focused = false;
	
	mouseSensitivity = 1.0/45/200;
	
	//Initialize keys
	keyCode = new int[NUM_KEYS];
	keyCode[0] = KeyEvent.VK_W;
	keyCode[1] = KeyEvent.VK_S;
	keyCode[2] = KeyEvent.VK_A;
	keyCode[3] = KeyEvent.VK_D;
	keyCode[4] = KeyEvent.VK_SHIFT;
	keyCode[5] = KeyEvent.VK_Q;
	keyCode[6] = KeyEvent.VK_E;
	keyCode[7] = KeyEvent.VK_1;
	keyCode[8] = KeyEvent.VK_2;
	keyCode[9] = KeyEvent.VK_3;
	keyCode[10] = KeyEvent.VK_4;
	keyCode[11] = KeyEvent.VK_V;
	keyCode[12] = KeyEvent.VK_SPACE;
	keyCode[13] = KeyEvent.VK_R;
	keyCode[14] = KeyEvent.VK_DELETE;
	keyCode[15] = KeyEvent.VK_EQUALS;
	keyCode[16] = KeyEvent.VK_MINUS;
	keyCode[17] = KeyEvent.VK_P;
	keyCode[18] = KeyEvent.VK_O;
	keyCode[19] = KeyEvent.VK_5;
	keyCode[20] = KeyEvent.VK_6;
	keyCode[21] = KeyEvent.VK_CONTROL;
	keyCode[22] = KeyEvent.VK_F1;
	keyCode[23] = KeyEvent.VK_F2;
	
	mouseButton = new int[NUM_MOUSE_BUTTONS];
	mouseButton[0] = MouseEvent.BUTTON1;
	mouseButton[1] = MouseEvent.BUTTON3;
	
	//Initialize key and mouse control variables.
	keyDown = new boolean[NUM_KEYS];
	keyCanceled = new boolean[NUM_KEYS];
	keyPressed = new boolean[NUM_KEYS];
	keyHelper = new boolean[NUM_KEYS];
	mouseDown = new boolean[NUM_MOUSE_BUTTONS];
	mouseCanceled = new boolean[NUM_MOUSE_BUTTONS];
	mousePressed = new boolean[NUM_MOUSE_BUTTONS];
	mouseHelper = new boolean[NUM_MOUSE_BUTTONS];
	for (int i=0; i<NUM_KEYS; i++) {
		keyDown[i] = false;
		keyCanceled[i] = false;
		keyPressed[i] = false;
		keyHelper[i] = false;
	}
	
	for (int i=0; i<NUM_MOUSE_BUTTONS; i++) {
		mouseDown[i] = false;
		mouseCanceled[i] = false;
		mousePressed[i] = false;
		mouseHelper[i] = false;
	}
}
 
开发者ID:patowen,项目名称:hyperbolic-space,代码行数:75,代码来源:InputHandler.java


注:本文中的com.jogamp.newt.opengl.GLWindow.addMouseListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。