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


Java KeyEvent.isAutoRepeat方法代码示例

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


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

示例1: keyReleased

import com.jogamp.newt.event.KeyEvent; //导入方法依赖的package包/类
@Override
public void keyReleased(final KeyEvent e) {
    if( !e.isPrintableKey() || e.isAutoRepeat() ) {
        return;
    }
    if(userInput) {
        final short k = e.getKeySymbol();
        if( KeyEvent.VK_ENTER == k ) {
            userInput = false;
            setIgnoreInput(false);
        } else if( KeyEvent.VK_BACK_SPACE == k && userString.length()>0) {
            userString.deleteCharAt(userString.length()-1);
        } else {
            final char c = e.getKeyChar();
            if( font.isPrintableChar( c ) ) {
                userString.append(c);
            }
        }
    }
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:21,代码来源:GPUTextRendererListenerBase01.java

示例2: keyPressed

import com.jogamp.newt.event.KeyEvent; //导入方法依赖的package包/类
@Override
public void keyPressed(KeyEvent e)
{
	if(e.isAutoRepeat())
	{
		for(int i = 0; i < listeners.size(); i++)
			listeners.get(i).onKey(KEY_REPEAT, e.getKeyCode());
	}
	
	EventHelper.sendEventToAll(new KeyTypedEvent(e.getKeyCode(), KEY_DOWN));
	
	for(int i = 0; i < listeners.size(); i++)
		listeners.get(i).onKey(KEY_DOWN, e.getKeyCode());
}
 
开发者ID:CUB3D,项目名称:Unknown-3,代码行数:15,代码来源:Keyboard.java

示例3: keyReleased

import com.jogamp.newt.event.KeyEvent; //导入方法依赖的package包/类
@Override
public void keyReleased(KeyEvent e)
{
	if(!e.isPrintableKey() && e.isAutoRepeat())
		return;
	
	EventHelper.sendEventToAll(new KeyTypedEvent(e.getKeyCode(), KEY_UP));

	for(int i = 0; i < listeners.size(); i++)
		listeners.get(i).onKey(KEY_UP, e.getKeyCode());
}
 
开发者ID:CUB3D,项目名称:Unknown-3,代码行数:12,代码来源:Keyboard.java

示例4: keyPressed

import com.jogamp.newt.event.KeyEvent; //导入方法依赖的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

示例5: keyReleased

import com.jogamp.newt.event.KeyEvent; //导入方法依赖的package包/类
/**
 * Updates the keys based on the event received by the component.
 */
public void keyReleased(KeyEvent e) {
	if (e.isAutoRepeat()) return;
	
	//Handle all keys
	for (int i=0; i<NUM_KEYS; i++) {
		if (e.getKeyCode() == keyCode[i]) {
			keyDown[i] = false;
			keyCanceled[i] = false;
		}
	}
}
 
开发者ID:patowen,项目名称:hyperbolic-space,代码行数:15,代码来源:InputHandler.java

示例6: keyPressed

import com.jogamp.newt.event.KeyEvent; //导入方法依赖的package包/类
@Override
public void keyPressed(KeyEvent e) {
	// TODO: Tell LEFT from RIGHT SHIFT apart.
	// I asked Xerxes Randby on twitter and he put up this:
	// https://jogamp.org/bugzilla/show_bug.cgi?id=1026
	if (!e.isAutoRepeat()) {
		PcInputCode key = PcInputCode.getKeyByCode(e.getKeyCode());
		synchronized (keyMapComp) {
			keyMapComp.press(key);
		}
	}
}
 
开发者ID:Nirei,项目名称:Tobacco,代码行数:13,代码来源:PcInputListener.java

示例7: keyReleased

import com.jogamp.newt.event.KeyEvent; //导入方法依赖的package包/类
@Override
public void keyReleased(KeyEvent e) {
	if (!e.isAutoRepeat()) {
		PcInputCode key = PcInputCode.getKeyByCode(e.getKeyCode());
		synchronized (keyMapComp) {
			keyMapComp.release(key);
		}
	}
}
 
开发者ID:Nirei,项目名称:Tobacco,代码行数:10,代码来源:PcInputListener.java

示例8: keyReleased

import com.jogamp.newt.event.KeyEvent; //导入方法依赖的package包/类
public void keyReleased(KeyEvent evt)
{
	keyEventQueue.push(evt);
	//We still use evt.isAutoRepeat() here because if you hold down a key, the system sends repeated pressed/released messages
	//If we use our own getKey() then it would pass repeats/releases that shouldnt be passed
	if(!evt.isAutoRepeat())
		Input.nextInput.put(evt.getKeySymbol(), false);
}
 
开发者ID:jacquesh,项目名称:project-grige,代码行数:9,代码来源:Input.java

示例9: keyReleased

import com.jogamp.newt.event.KeyEvent; //导入方法依赖的package包/类
public void keyReleased(KeyEvent e)
{
	//To simulated the removed keyTyped(KeyEvent e) semantics, simply apply the following constraints 
	//upfront and bail out if not matched, i.e.:
	if (!e.isPrintableKey() || e.isAutoRepeat())
	{
		return;
	}

	if (e.getKeyCode() == FAST_KEY)
	{
		runHeldDown = false;
		setTranslationChange();
	}
	else if (e.getKeyCode() == FORWARD_KEY)
	{
		walkHeldDown = false;
		setTranslationChange();
	}
	else if (e.getKeyCode() == BACK_KEY)
	{
		backHeldDown = false;
		setTranslationChange();
	}
	else if (e.getKeyCode() == LEFT_KEY)
	{
		strafLeftHeldDown = false;
		setTranslationChange();
	}
	else if (e.getKeyCode() == RIGHT_KEY)
	{
		strafRightHeldDown = false;
		setTranslationChange();
	}
	else if (isAllowVerticalMovement() && e.getKeyCode() == UP_KEY)
	{
		upHeldDown = false;
		setTranslationChange();
	}
	else if (isAllowVerticalMovement() && e.getKeyCode() == DOWN_KEY)
	{
		downHeldDown = false;
		setTranslationChange();
	}

}
 
开发者ID:philjord,项目名称:3DTools,代码行数:47,代码来源:NavigationInputNewtKey.java


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