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


Java Mouse.getDX方法代码示例

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


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

示例1: calculateFPMovement

import org.lwjgl.input.Mouse; //导入方法依赖的package包/类
/**
 * Calculates first person movement
 */
private void calculateFPMovement() {
	this.yaw = 180 - player.getRotation().y;

	if (Mouse.isButtonDown(1)) {
		float angleChange = Mouse.getDX() * 0.3f;
		yaw += angleChange;

		float pitchChange = Mouse.getDY() * 0.2f;
		pitch -= pitchChange;

		if (pitch > 90)
			pitch = 90;
	}

	player.setRotation(new Vector3f(0, 180 - yaw, 0));
}
 
开发者ID:Essentria,项目名称:Elgin-Plant-Game,代码行数:20,代码来源:Camera.java

示例2: calculateAngleAroundPlayer

import org.lwjgl.input.Mouse; //导入方法依赖的package包/类
/**
 * Calculate the angle of the camera around the player (when looking down at
 * the camera from above). Basically the yaw. Changes the yaw when the user
 * moves the mouse horizontally with the LMB down.
 */
private void calculateAngleAroundPlayer() {
	if (Mouse.isButtonDown(0)) {
		float angleChange = Mouse.getDX() * YAW_SENSITIVITY;
		angleAroundPlayer.increaseTarget(-angleChange);
	}
	angleAroundPlayer.update(1f / 60);
}
 
开发者ID:TheThinMatrix,项目名称:LowPolyWater,代码行数:13,代码来源:Camera.java

示例3: calculateAngleAroundPlayer

import org.lwjgl.input.Mouse; //导入方法依赖的package包/类
/**
 * Calculate the angle of the camera around the player (when looking down at
 * the camera from above). Basically the yaw. Changes the yaw when the user
 * moves the mouse horizontally with the LMB down.
 */
private void calculateAngleAroundPlayer() {
	if (Mouse.isButtonDown(0)) {
		float angleChange = Mouse.getDX() * YAW_SENSITIVITY;
		angleAroundPlayer.increaseTarget(-angleChange);
	}
	angleAroundPlayer.update(DisplayManager.getFrameTime());
}
 
开发者ID:TheThinMatrix,项目名称:OpenGL-Animation,代码行数:13,代码来源:Camera.java

示例4: calculateAngleAroundPlayer

import org.lwjgl.input.Mouse; //导入方法依赖的package包/类
/**
 * Calculate the angle of the camera around the player (when looking down at
 * the camera from above). Basically the yaw. Changes the yaw when the user
 * moves the mouse horizontally with the LMB down.
 */
private void calculateAngleAroundPlayer() {
    if (Mouse.isButtonDown(0) && !Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)) {
        float angleChange = Mouse.getDX() * YAW_SENSITIVITY;
        angleAroundPlayer.increaseTarget(-angleChange);
    }
    angleAroundPlayer.update(1f / 60);
}
 
开发者ID:GryPLOfficial,项目名称:EcoSystem-Official,代码行数:13,代码来源:Camera.java

示例5: calculateAngleAroundPlayer

import org.lwjgl.input.Mouse; //导入方法依赖的package包/类
private void calculateAngleAroundPlayer(){
	if(Mouse.isButtonDown(0)){
		float angleChange = Mouse.getDX() * 0.3f;
		angleAroundPlayer.increaseTarget(-angleChange);;
	}else if(Keyboard.isKeyDown(Keyboard.KEY_R)){
		angleAroundPlayer.increaseTarget(0.05f);
	}
	angleAroundPlayer.update(0.01f);
}
 
开发者ID:TheThinMatrix,项目名称:OcclusionQueries,代码行数:10,代码来源:Camera.java

示例6: mouseXYChange

import org.lwjgl.input.Mouse; //导入方法依赖的package包/类
public void mouseXYChange()
{
    this.deltaX = Mouse.getDX();
    this.deltaY = Mouse.getDY();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:6,代码来源:MouseHelper.java

示例7: calculateAngleAroundPlayer

import org.lwjgl.input.Mouse; //导入方法依赖的package包/类
private void calculateAngleAroundPlayer() {
	if (Mouse.isButtonDown(1)) {
		float angleChange = Mouse.getDX() * 0.3f;
		angleAroundPlayer -= angleChange;
	}
}
 
开发者ID:Essentria,项目名称:Elgin-Plant-Game,代码行数:7,代码来源:Camera.java

示例8: ShiftingCameraLaterally

import org.lwjgl.input.Mouse; //导入方法依赖的package包/类
private ShiftingCameraLaterally() {
    
	try {
        Display.setDisplayMode(new DisplayMode(640, 480));
        Display.setTitle("X Axis Camera Movement");
        Display.create();
    } catch (LWJGLException e) {
        e.printStackTrace();
    }
    
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, 640, 480, 0, 1, -1);
    glMatrixMode(GL_MODELVIEW);
    
    float x_cam = 0;

    while (!Display.isCloseRequested()) {
        // Render Code here
        glClear(GL_COLOR_BUFFER_BIT);
        // Put a matrix that's a clone of the original into the matrix stock
        glPushMatrix();
        // Pushes screen laterally, depending on x_cam
        glTranslatef(x_cam, 0, 0);
        
        // Move screen with the Mouse speed
        // if the mouse is in the window and space is pressed
        if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)
        		&& Mouse.getX() > 0 && Mouse.getX() < 639) {
        	x_cam += Mouse.getDX();
        }
        // True coords of the mouse
        float mousex = Mouse.getX() - x_cam;
        float mousey = 480 - Mouse.getY() - 1;
        
        System.out.println(mousex + ", " + mousey);
        
        glBegin(GL_QUADS);
        	glVertex2i(400, 400);
        	glVertex2i(450, 400);
        	glVertex2i(450, 450);
        	glVertex2i(400, 450);
        glEnd();
        
        glBegin(GL_LINES);
        	glVertex2i(400, 400);
        	glVertex2i(400, 400);
        glEnd();
        
        // Disposes of translations made to the matrix
        glPopMatrix();
        
        Display.update();
        Display.sync(60);
    }
    Display.destroy();
    System.exit(0);
}
 
开发者ID:nitrodragon,项目名称:lwjgl_collection,代码行数:59,代码来源:ShiftingCameraLaterally.java

示例9: calculatePan

import org.lwjgl.input.Mouse; //导入方法依赖的package包/类
private void calculatePan() {
    if (Mouse.isButtonDown(0) && Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)) {
        cameraPosZ += Mouse.getDY() * -PAN_SENSITIVITY;
        cameraPosX += Mouse.getDX() * PAN_SENSITIVITY;
    }
}
 
开发者ID:GryPLOfficial,项目名称:EcoSystem-Official,代码行数:7,代码来源:Camera.java


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