本文整理汇总了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);
}
}
}
}
示例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());
}
示例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());
}
示例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;
}
}
}
示例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;
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
示例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();
}
}