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


Java GLWindow.getY方法代码示例

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


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

示例1: readMouse

import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
/**
 * Determines how far the mouse moved from the center and resets the mouse to the center.
 * The information can be retrieved with {@code getMouseX()} and {@code getMouseY()}.
 * @see #getMouseX
 * @see #getMouseY
 */
public void readMouse() {
	GLWindow win = c.getWindow();
	
	if (win.hasFocus() && focused) {
		Point mousePos = MouseInfo.getPointerInfo().getLocation();
		int centerX = win.getX() + win.getWidth()/2;
		int centerY = win.getY() + win.getHeight()/2;
		
		mouseX = (mousePos.getX()-centerX)*mouseSensitivity;
		mouseY = (mousePos.getY()-centerY)*mouseSensitivity;
		
		robot.mouseMove(centerX, centerY);
	} else {
		setFocused(false);
		mouseX = 0;
		mouseY = 0;
	}
}
 
开发者ID:patowen,项目名称:hyperbolic-space,代码行数:25,代码来源:InputHandler.java

示例2: setFocused

import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
private void setFocused(boolean focused) {
	GLWindow win = c.getWindow();
	
	this.focused = focused;
	if (focused) {
		win.setPointerVisible(false);
		
		//Prevent sudden direction changes by resetting the mouse
		int centerX = win.getX() + win.getWidth()/2;
		int centerY = win.getY() + win.getHeight()/2;			
		robot.mouseMove(centerX, centerY);
	} else {
		win.setPointerVisible(true);
	}
}
 
开发者ID:patowen,项目名称:hyperbolic-space,代码行数:16,代码来源:InputHandler.java

示例3: keyPressed

import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
/**
 * Updates the keys based on the event received by the component.
 */
public void keyPressed(KeyEvent e) {
	if (e.isAutoRepeat()) return;
	
	if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
		c.exit();
	}
	
	if (e.getKeyCode() == KeyEvent.VK_BACK_SPACE) {
		if (focused)
			setFocused(false);
	}
	if (e.getKeyCode() == KeyEvent.VK_F11) {
		c.toggleFullscreen();
		
		if (focused) {
			//Prevent sudden direction changes by resetting the mouse
			GLWindow win = c.getWindow();
			int centerX = win.getX() + win.getWidth()/2;
			int centerY = win.getY() + win.getHeight()/2;			
			robot.mouseMove(centerX, centerY);
		}
	}
	
	//Handle keys
	for (int i=0; i<NUM_KEYS; i++) {
		if (e.getKeyCode() == keyCode[i]) {
			if (!keyDown[i]) keyHelper[i] = true;
			keyDown[i] = true;
		}
	}
}
 
开发者ID:patowen,项目名称:hyperbolic-space,代码行数:35,代码来源:InputHandler.java


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