• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java NiftyInputConsumer类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中de.lessvoid.nifty.NiftyInputConsumer的典型用法代码示例。如果您正苦于以下问题:Java NiftyInputConsumer类的具体用法?Java NiftyInputConsumer怎么用?Java NiftyInputConsumer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

NiftyInputConsumer类属于de.lessvoid.nifty包,在下文中一共展示了NiftyInputConsumer类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onKeyEventQueued

点赞 3

import de.lessvoid.nifty.NiftyInputConsumer; //导入依赖的package包/类
private void onKeyEventQueued(KeyInputEvent evt, NiftyInputConsumer nic) {
    int code = evt.getKeyCode();

    if (code == KeyInput.KEY_LSHIFT || code == KeyInput.KEY_RSHIFT) {
        shiftDown = evt.isPressed();
    } else if (code == KeyInput.KEY_LCONTROL || code == KeyInput.KEY_RCONTROL) {
        ctrlDown = evt.isPressed();
    }
    
    KeyboardInputEvent keyEvt = new KeyboardInputEvent(code,
                                                       evt.getKeyChar(),
                                                       evt.isPressed(),
                                                       shiftDown,
                                                       ctrlDown);

    if (nic.processKeyboardEvent(keyEvt)){
        evt.setConsumed();
    }
}
 

开发者ID:mleoking,
项目名称:PhET,
代码行数:20,
代码来源:InputSystemJme.java

示例2: forwardEvents

点赞 3

import de.lessvoid.nifty.NiftyInputConsumer; //导入依赖的package包/类
public void forwardEvents(NiftyInputConsumer nic) {
    int queueSize = inputQueue.size();

    for (int i = 0; i < queueSize; i++){
        InputEvent evt = inputQueue.get(i);
        if (evt instanceof MouseMotionEvent){
            onMouseMotionEventQueued( (MouseMotionEvent)evt, nic);
        }else if (evt instanceof MouseButtonEvent){
            onMouseButtonEventQueued( (MouseButtonEvent)evt, nic);
        }else if (evt instanceof KeyInputEvent){
            onKeyEventQueued( (KeyInputEvent)evt, nic);
        }
    }

    inputQueue.clear();
}
 

开发者ID:mleoking,
项目名称:PhET,
代码行数:17,
代码来源:InputSystemJme.java

示例3: onMouseMotionEventQueued

点赞 2

import de.lessvoid.nifty.NiftyInputConsumer; //导入依赖的package包/类
private void onMouseMotionEventQueued(MouseMotionEvent evt, NiftyInputConsumer nic) {
        x = evt.getX();
        y = height - evt.getY();
        nic.processMouseEvent(x, y, evt.getDeltaWheel(), buttonIndex, pressed);
        //MouseInputEvent niftyEvt = new MouseInputEvent(x, y, pressed);
//        if (nic.processMouseEvent(niftyEvt) /*|| nifty.getCurrentScreen().isMouseOverElement()*/){
            // Do not consume motion events
            //evt.setConsumed();
//        }
    }
 

开发者ID:mleoking,
项目名称:PhET,
代码行数:11,
代码来源:InputSystemJme.java

示例4: onMouseButtonEventQueued

点赞 2

import de.lessvoid.nifty.NiftyInputConsumer; //导入依赖的package包/类
private void onMouseButtonEventQueued(MouseButtonEvent evt, NiftyInputConsumer nic) {
    buttonIndex = evt.getButtonIndex();
    pressed = evt.isPressed();

    if (nic.processMouseEvent(x, y, 0, buttonIndex, pressed)){
        evt.setConsumed();
    }
}
 

开发者ID:mleoking,
项目名称:PhET,
代码行数:9,
代码来源:InputSystemJme.java

示例5: onForwardKeyDown

点赞 2

import de.lessvoid.nifty.NiftyInputConsumer; //导入依赖的package包/类
/**
 * <p>Forward {@link InputKeyboard#EVENT_KEY_DOWN}</p>
 */
private void onForwardKeyDown(NiftyInputConsumer consumer, InputKey key, boolean isShift, boolean isControl) {
    mKeyboardInputEvent.setData(nativeToNifty(key), '\0', true, isShift, isControl);

    if (!consumer.processKeyboardEvent(mKeyboardInputEvent) && mListener != null) {
        mListener.onKeyboardKeyDown(key);
    }
}
 

开发者ID:Wolftein,
项目名称:Quark-Engine,
代码行数:11,
代码来源:NiftyInputSystem.java

示例6: onForwardKeyUp

点赞 2

import de.lessvoid.nifty.NiftyInputConsumer; //导入依赖的package包/类
/**
 * <p>Forward {@link InputKeyboard#EVENT_KEY_UP}</p>
 */
private void onForwardKeyUp(NiftyInputConsumer consumer, InputKey key, boolean isShift, boolean isControl) {
    mKeyboardInputEvent.setData(nativeToNifty(key), '\0', false, isShift, isControl);

    if (!consumer.processKeyboardEvent(mKeyboardInputEvent) && mListener != null) {
        mListener.onKeyboardKeyUp(key);
    }
}
 

开发者ID:Wolftein,
项目名称:Quark-Engine,
代码行数:11,
代码来源:NiftyInputSystem.java

示例7: onForwardKeyType

点赞 2

import de.lessvoid.nifty.NiftyInputConsumer; //导入依赖的package包/类
/**
 * <p>Forward {@link InputKeyboard#EVENT_KEY_TYPE}</p>
 */
private void onForwardKeyType(NiftyInputConsumer consumer, char key, boolean isShift, boolean isControl) {
    mKeyboardInputEvent.setData(-1, key, true, isShift, isControl);

    if (!consumer.processKeyboardEvent(mKeyboardInputEvent) && mListener != null) {
        mListener.onKeyboardKeyType(key);
    }
}
 

开发者ID:Wolftein,
项目名称:Quark-Engine,
代码行数:11,
代码来源:NiftyInputSystem.java

示例8: forwardEvents

点赞 2

import de.lessvoid.nifty.NiftyInputConsumer; //导入依赖的package包/类
@Override
public void forwardEvents(NiftyInputConsumer inputConsumer)
{
	//Mouse Events
	//Mouse Position
	inputConsumer.processMouseEvent(mouseLoc.x, mouseLoc.y, 0, -1, false);
	
	//Mouse Buttons
	for(int i=0; i<currentMouseButtons.length; i++)
	{
		if(getMouseButtonDown(i))
		{
			if(inputConsumer.processMouseEvent(mouseLoc.x, mouseLoc.y, 0, i, true))
			{	consumeMouseButtonDown(i); }
		}
		
		else if(getMouseButtonUp(i))
		{
			if(inputConsumer.processMouseEvent(mouseLoc.x, mouseLoc.y, 0, i, false))
			{	consumeMouseButtonUp(i); }
		}
	}
	
	//Keyboard events, for this we need the event queue because we need more than just the keyCode or Symbol, we need the entire event
	while(!keyEventQueue.isEmpty())
	{
		KeyEvent kEvt = keyEventQueue.pollLast();
		boolean pressed = (kEvt.getEventType() == KeyEvent.EVENT_KEY_PRESSED);
		KeyboardInputEvent newEvent = new KeyboardInputEvent(converter.convertToNiftyKeyCode(kEvt.getKeyCode(), 0), kEvt.getKeyChar(), pressed, kEvt.isShiftDown(), kEvt.isControlDown());
		
		if(inputConsumer.processKeyboardEvent(newEvent))
		{
			if(pressed)
				consumeKeyDown(kEvt.getKeyCode());
			else
				consumeKeyUp(kEvt.getKeyCode());
		}
	}
}
 

开发者ID:jacquesh,
项目名称:project-grige,
代码行数:40,
代码来源:Input.java

示例9: onMouseMotionEventQueued

点赞 2

import de.lessvoid.nifty.NiftyInputConsumer; //导入依赖的package包/类
private void onMouseMotionEventQueued(MouseMotionEvent evt, NiftyInputConsumer nic) {
        x = evt.getX();
        y = height - evt.getY();
        nic.processMouseEvent(x, y, evt.getDeltaWheel(), buttonIndex, pressed);
//        if (nic.processMouseEvent(niftyEvt) /*|| nifty.getCurrentScreen().isMouseOverElement()*/){
            // Do not consume motion events
            //evt.setConsumed();
//        }
    }
 

开发者ID:chototsu,
项目名称:MikuMikuStudio,
代码行数:10,
代码来源:InputSystemJme.java

示例10: onMouseButtonEventQueued

点赞 2

import de.lessvoid.nifty.NiftyInputConsumer; //导入依赖的package包/类
private void onMouseButtonEventQueued(MouseButtonEvent evt, NiftyInputConsumer nic) {
    boolean wasPressed = pressed;
    boolean forwardToNifty = true;
    
    buttonIndex = evt.getButtonIndex();
    pressed = evt.isPressed();
    
    // Mouse button raised. End dragging
    if (wasPressed && !pressed){
        if (!niftyOwnsDragging){
            forwardToNifty = false;
        }
        isDragging = false;
        niftyOwnsDragging = false;
    }

    boolean consumed = false;
    if (forwardToNifty){
        consumed = nic.processMouseEvent(x, y, 0, buttonIndex, pressed);
        if (consumed){
            evt.setConsumed();
        }
    }
    
    // Mouse button pressed. Begin dragging
    if (!wasPressed && pressed){
        isDragging = true;
        niftyOwnsDragging = consumed;
    }
}
 

开发者ID:chototsu,
项目名称:MikuMikuStudio,
代码行数:31,
代码来源:InputSystemJme.java

示例11: forwardEvents

点赞 2

import de.lessvoid.nifty.NiftyInputConsumer; //导入依赖的package包/类
public synchronized void forwardEvents(NiftyInputConsumer nic) {
    for (Iterator<MouseInputEvent> it = mouseEvents.iterator(); it.hasNext();) {
        MouseInputEvent mouseInputEvent = it.next();
        nic.processMouseEvent(mouseInputEvent.x, mouseInputEvent.y, mouseInputEvent.button, mouseInputEvent.huh, mouseInputEvent.pressed);
        it.remove();
    }
    for (Iterator<KeyboardInputEvent> it = keyEvents.iterator(); it.hasNext();) {
        KeyboardInputEvent keyInputEvent = it.next();
        nic.processKeyboardEvent(keyInputEvent);
        it.remove();
    }
}
 

开发者ID:chototsu,
项目名称:MikuMikuStudio,
代码行数:13,
代码来源:NiftyPreviewInputHandler.java

示例12: forwardEvents

点赞 2

import de.lessvoid.nifty.NiftyInputConsumer; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public synchronized void forwardEvents(NiftyInputConsumer consumer) {
    mInput.flip();
    {
        while (mInput.hasRemaining()) {
            switch (mInput.read()) {
                //!
                //! KEYBOARD
                //!
                case InputKeyboard.EVENT_KEY_UP:
                    onForwardKeyUp(consumer, InputKey.VALUES[mInput.read()],
                            mInput.read() > 0,
                            mInput.read() > 0);
                    break;
                case InputKeyboard.EVENT_KEY_DOWN:
                    onForwardKeyDown(consumer, InputKey.VALUES[mInput.read()],
                            mInput.read() > 0,
                            mInput.read() > 0);
                    break;
                case InputKeyboard.EVENT_KEY_TYPE:
                    onForwardKeyType(consumer, (char) mInput.read(), false, false);
                    break;

                //!
                //! MOUSE
                //!
                case InputMouse.EVENT_MOVE:
                    onForwardMove(consumer, mInput.read(), mInput.read(),
                            mInput.read(),
                            mInput.read());
                    break;
                case InputMouse.EVENT_BUTTON_UP:
                    onForwardButtonUp(consumer, InputMouseButton.VALUES[mInput.read()],
                            mInput.read(),
                            mInput.read());
                    break;
                case InputMouse.EVENT_BUTTON_DOWN:
                    onForwardButtonDown(consumer, InputMouseButton.VALUES[mInput.read()],
                            mInput.read(),
                            mInput.read());
                    break;
                case InputMouse.EVENT_WHEEL:
                    onForwardWheel(consumer, mInput.read(), mInput.read(), mInput.read());
                    break;
            }
        }
    }
    mInput.clear();
}
 

开发者ID:Wolftein,
项目名称:Quark-Engine,
代码行数:53,
代码来源:NiftyInputSystem.java

示例13: onForwardMove

点赞 2

import de.lessvoid.nifty.NiftyInputConsumer; //导入依赖的package包/类
/**
 * <p>Forward {@link InputMouse#EVENT_MOVE}</p>
 */
private void onForwardMove(NiftyInputConsumer consumer, int x, int y, int dx, int dy) {
    if (!consumer.processMouseEvent(x, y, 0, -1, false) && mListener != null) {
        mListener.onMouseMove(x, y, dx, dy);
    }
}
 

开发者ID:Wolftein,
项目名称:Quark-Engine,
代码行数:9,
代码来源:NiftyInputSystem.java

示例14: onForwardButtonDown

点赞 2

import de.lessvoid.nifty.NiftyInputConsumer; //导入依赖的package包/类
/**
 * <p>Forward {@link InputMouse#EVENT_BUTTON_DOWN}</p>
 */
private void onForwardButtonDown(NiftyInputConsumer consumer, InputMouseButton button, int x, int y) {
    if (!consumer.processMouseEvent(x, y, 0, nativeToNifty(button), true) && mListener != null) {
        mListener.onMouseButtonDown(x, y, button);
    }
}
 

开发者ID:Wolftein,
项目名称:Quark-Engine,
代码行数:9,
代码来源:NiftyInputSystem.java

示例15: onForwardButtonUp

点赞 2

import de.lessvoid.nifty.NiftyInputConsumer; //导入依赖的package包/类
/**
 * <p>Forward {@link InputMouse#EVENT_BUTTON_UP}</p>
 */
private void onForwardButtonUp(NiftyInputConsumer consumer, InputMouseButton button, int x, int y) {
    if (!consumer.processMouseEvent(x, y, 0, nativeToNifty(button), false) && mListener != null) {
        mListener.onMouseButtonUp(x, y, button);
    }
}
 

开发者ID:Wolftein,
项目名称:Quark-Engine,
代码行数:9,
代码来源:NiftyInputSystem.java

示例16: onForwardWheel

点赞 2

import de.lessvoid.nifty.NiftyInputConsumer; //导入依赖的package包/类
/**
 * <p>Forward {@link InputMouse#EVENT_WHEEL}</p>
 */
private void onForwardWheel(NiftyInputConsumer consumer, int delta, int x, int y) {
    if (!consumer.processMouseEvent(x, y, delta, -1, false) && mListener != null) {
        mListener.onMouseWheel(x, y, delta);
    }
}
 

开发者ID:Wolftein,
项目名称:Quark-Engine,
代码行数:9,
代码来源:NiftyInputSystem.java

示例17: processMouseEvents

点赞 2

import de.lessvoid.nifty.NiftyInputConsumer; //导入依赖的package包/类
public void processMouseEvents(final NiftyInputConsumer inputEventConsumer) {
	handled = inputEventConsumer.processMouseEvent(mouseX, mouseY, mouseWheel, button, buttonDown);
}
 

开发者ID:oberien,
项目名称:Oberien,
代码行数:4,
代码来源:MouseEvent.java

示例18: processKeyboardEvent

点赞 2

import de.lessvoid.nifty.NiftyInputConsumer; //导入依赖的package包/类
public void processKeyboardEvent(final NiftyInputConsumer inputEventConsumer) {
	handled = inputEventConsumer.processKeyboardEvent(inputEventCreator.createEvent(key, c, pressed));
}
 

开发者ID:oberien,
项目名称:Oberien,
代码行数:4,
代码来源:KeyboardEvent.java

示例19: processMouseEvents

点赞 2

import de.lessvoid.nifty.NiftyInputConsumer; //导入依赖的package包/类
public void processMouseEvents(
		final NiftyInputConsumer inputEventConsumer) {
	inputEventConsumer.processMouseEvent(mouseX, mouseY, mouseWheel,
			button, buttonDown);
}
 

开发者ID:oberien,
项目名称:Oberien,
代码行数:6,
代码来源:MyNiftySlickGame.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)