void CircleCropExample::keyDown(ci::app::KeyEvent event){
	using ci::app::KeyEvent;
	inherited::keyDown(event);
	if(event.getChar() == KeyEvent::KEY_r){ // R = reload all configs and start over without quitting app
		setupServer();
	} else if(event.getCode() == KeyEvent::KEY_d){
		moveCamera(ci::vec3(1.0f, 0.0f, 0.0f));
	} else if(event.getCode() == KeyEvent::KEY_a){
		moveCamera(ci::vec3(-1.0f, 0.0f, 0.0f));
	} else if(event.getCode() == KeyEvent::KEY_w){
		moveCamera(ci::vec3(0.0f, -1.0f, 0.0f));
	} else if(event.getCode() == KeyEvent::KEY_s){
		moveCamera(ci::vec3(0.0f, 1.0f, 0.0f));
	} else if(event.getCode() == KeyEvent::KEY_RIGHTBRACKET){
		moveCamera(ci::vec3(0.0f, 0.0f, 1.0f));
	} else if(event.getCode() == KeyEvent::KEY_LEFTBRACKET){
		moveCamera(ci::vec3(0.0f, 0.0f, -1.0f));
	} else if(event.getCode() == KeyEvent::KEY_EQUALS){
		ds::PerspCameraParams p = mEngine.getPerspectiveCamera(1);
		p.mFarPlane += 1.0f;
		std::cout << "Clip Far camera: " << p.mFarPlane << std::endl;
		mEngine.setPerspectiveCamera(1, p);
	} else if(event.getCode() == KeyEvent::KEY_MINUS){
		ds::PerspCameraParams p = mEngine.getPerspectiveCamera(1);
		p.mFarPlane -= 1.0f;
		std::cout << "Clip Far camera: " << p.mFarPlane << std::endl;
		mEngine.setPerspectiveCamera(1, p);
	} else if(event.getCode() == KeyEvent::KEY_c){
		if(mShaderCircleCrop){
			mShaderCircleCrop->setCircleCrop(!mShaderCircleCrop->getCircleCrop());
		}
	}
}
Exemplo n.º 2
0
void PanoramicVideo::keyDown(ci::app::KeyEvent event){
	using ci::app::KeyEvent;
	inherited::keyDown(event);
	if(event.getChar() == KeyEvent::KEY_r){ // R = reload all configs and start over without quitting app
		setupServer();

	// Shows all enabled sprites with a label for class type
	} else if(event.getCode() == KeyEvent::KEY_f){

		const int numRoots = mEngine.getRootCount();
		int numPlacemats = 0;
		for(int i = 0; i < numRoots - 1; i++){
			mEngine.getRootSprite(i).forEachChild([this](ds::ui::Sprite& sprite){
				if(sprite.isEnabled()){
					sprite.setTransparent(false);
					sprite.setColor(ci::Color(ci::randFloat(), ci::randFloat(), ci::randFloat()));
					sprite.setOpacity(0.95f);

					ds::ui::Text* labelly = mGlobals.getText("media_viewer:title").create(mEngine, &sprite);
					labelly->setText(typeid(sprite).name());
					labelly->enable(false);
					labelly->setColor(ci::Color::black());
				} else {

					ds::ui::Text* texty = dynamic_cast<ds::ui::Text*>(&sprite);
					if(!texty || (texty && texty->getColor() != ci::Color::black())) sprite.setTransparent(true);
				}
			}, true);
		}
	}
}
Exemplo n.º 3
0
void EditorState::keyDown(ci::app::KeyEvent event)
{
    // XXX duplicate raycast
    Vec2f pos = GG.mouse.getPos();
    Vec3f planeHit = GG.hexRender.raycastHexPlane(pos.x, pos.y);
    HexCoord selectedHex = GG.hexGrid.WorldToHex(planeHit);

    int keycode = event.getCode();

    Vec3f& cameraTo = GG.hexRender.getCameraTo();
    if (keycode == app::KeyEvent::KEY_ESCAPE) {
        mManager.setActiveState("title");
    }
    else if (keycode == app::KeyEvent::KEY_UP) {
        cameraTo += Vec3f(0, 2.0f, 0);
    }
    else if (keycode == app::KeyEvent::KEY_DOWN) {
        cameraTo += Vec3f(0, -2.0f, 0);
    }   
    else if (keycode == app::KeyEvent::KEY_LEFT) {
        cameraTo += Vec3f(-2.0f, 0, 0);
    }
    else if (keycode == app::KeyEvent::KEY_RIGHT) {
        cameraTo += Vec3f(2.0f, 0, 0);
    }
    else if (keycode == app::KeyEvent::KEY_g) {
        //  Generate hex colors
        Vec2i mapSize = GG.hexMap.getSize();
        for (int iy=0; iy < mapSize.y; ++iy) {
            for (int ix=0; ix < mapSize.x; ++ix) {
                HexCell& cell = GG.hexMap.at(HexCoord(ix, iy));
                if (cell.getLand()) {
                    int playerID = random.nextInt(0, 5);
                    cell.setOwner(playerID);
                    cell.setColor(GG.warGame.getPlayers()[playerID].getColor());
                }
            }
        }
    }
    else if (keycode == app::KeyEvent::KEY_DELETE) {
        GG.hexMap.at(selectedHex).setLand(0);
    }
    else if (keycode == app::KeyEvent::KEY_SPACE) {
        mManager.setActiveState(string("game"));
    }
    else if (keycode == app::KeyEvent::KEY_c) {
        vector<HexCoord> connected = GG.hexMap.connected(selectedHex);
        for (vector<HexCoord>::iterator it = connected.begin(); it != connected.end(); ++it) {
            HexCell& cell = GG.hexMap.at(*it);
            Color cellColor = cell.getColor();
            cellColor.r = 0.5f * cellColor.r;
            cellColor.g = 0.5f * cellColor.g;
            cellColor.b = 0.5f * cellColor.b;
            cell.setColor(cellColor);
        }
    }
}
void ImGui_ImplCinder_KeyCallback(ci::app::KeyEvent e, bool isDown)
{
    ImGuiIO& io = ImGui::GetIO();
    
    io.KeysDown[e.getCode()] = isDown;

    io.KeyCtrl = io.KeysDown[ci::app::KeyEvent::KEY_LCTRL] || io.KeysDown[ci::app::KeyEvent::KEY_RCTRL];
    io.KeyShift = io.KeysDown[ci::app::KeyEvent::KEY_LSHIFT] || io.KeysDown[ci::app::KeyEvent::KEY_RSHIFT];
    io.KeyAlt = io.KeysDown[ci::app::KeyEvent::KEY_LALT] || io.KeysDown[ci::app::KeyEvent::KEY_RALT];
}
Exemplo n.º 5
0
void https_example::keyDown(ci::app::KeyEvent event){
	using ci::app::KeyEvent;
	inherited::keyDown(event);
	if(event.getChar() == KeyEvent::KEY_r){ // R = reload all configs and start over without quitting app
		setupServer();

	} else if(event.getCode() == KeyEvent::KEY_v && event.isControlDown()){
		auto fileNameOrig = ds::Environment::getClipboard();
		mHttpsRequest.makeGetRequest("https://example.com", false, false);


	} else if(event.getCode() == KeyEvent::KEY_p){
		std::string datay = "{ \"data\": { \"type\": \"collection_links\", \"attributes\": { \"story_type\": \"Achievement\", \"story_id\": \"13\" }}}";
		std::vector<std::string> headers;
		headers.push_back("Accept: application/json");
		headers.push_back("Content-Type: application/json");
		mHttpsRequest.makePostRequest("https://example.com", datay, true, true, "", headers);

	// Shows all enabled sprites with a label for class type
	} else if(event.getCode() == KeyEvent::KEY_f){

		const int numRoots = mEngine.getRootCount();
		int numPlacemats = 0;
		for(int i = 0; i < numRoots - 1; i++){
			mEngine.getRootSprite(i).forEachChild([this](ds::ui::Sprite& sprite){
				if(sprite.isEnabled()){
					sprite.setTransparent(false);
					sprite.setColor(ci::Color(ci::randFloat(), ci::randFloat(), ci::randFloat()));
					sprite.setOpacity(0.95f);

					ds::ui::Text* labelly = mGlobals.getText("media_viewer:title").create(mEngine, &sprite);
					labelly->setText(typeid(sprite).name());
					labelly->enable(false);
					labelly->setColor(ci::Color::black());
				} else {

					ds::ui::Text* texty = dynamic_cast<ds::ui::Text*>(&sprite);
					if(!texty || (texty && texty->getColor() != ci::Color::black())) sprite.setTransparent(true);
				}
			}, true);
		}
	}
}
void XmlSettingsSetting::keyDown(ci::app::KeyEvent event){
	using ci::app::KeyEvent;
	inherited::keyDown(event);
	if(event.getChar() == KeyEvent::KEY_r){ // R = reload all configs and start over without quitting app
		setupServer();
	} else if(event.getCode() == KeyEvent::KEY_x){
		if(mSettings){
			mSettings->toggleVisibility();
		}
	}
}
Exemplo n.º 7
0
void PretzelRoot::onKeyDown(ci::app::KeyEvent &event)
{
    mGuiList[0]->keyDown( event.getChar(), event.getCode() );
    
//    for( auto it = mGuiList.begin(); it!=mGuiList.end(); ++it){
//        PretzelGui *pg = *it;
//        
//        if( pg->getGlobalBounds().contains( event.getPos() ) ){
//            (*it)->keyDown( event.getChar(), event.getCode() );
//        }
//    }
}
Exemplo n.º 8
0
void ClientState::keyDown(ci::app::KeyEvent event)
{
    // Vec3f& cameraTo = GG.hexRender.getCameraTo();

    int keycode = event.getCode();
    if (keycode == app::KeyEvent::KEY_ESCAPE) {
        mManager.setActiveState("title");
    }
    else if (keycode == app::KeyEvent::KEY_BACKQUOTE) {
        // XXX should push console to the top of the gui widget list
        GG.gui.attach(GG.console);
    }
}
Exemplo n.º 9
0
    // TODO: Fix this memory leak from new Link(...)
    bool ChatNode::keyDown(ci::app::KeyEvent event) {
        if (event.getCode() == ci::app::KeyEvent::KEY_RETURN) {
            if (active_node_identity_ != NULL && 
                active_node_identity_->object() != NULL) {
                // Finish updating by sending finished flag and deactivate
                ChatMessageNode::request_finish_update(*active_node_identity_, 
                    text_buffer_);

                active_node_ = NULL;
                text_buffer_.clear();
                active_node_identity_ = NULL;
            }
        } else {
            text_buffer_ += event.getChar();
            unsent_chars_ = true;

            if (active_node_identity_ == NULL) {
                // Request create a node, but make sure to update it
                TeteManager::instance() += ObjectController::instance()[id()];
                ID create_id_ = Utility::create_uuid();
                active_node_identity_ = Identity::create_identity(create_id_, NULL);

                LinkPtr user_link(new Link(&(Client::user_identity()),
                    LinkFlags(true, true, true)));
                
                std::deque<LinkPtr> temp_links;
                temp_links.push_back(user_link);

                if (!chat_messages_.empty()) {
                    const Identity* last_ident = Identity::get_identity_from_id(
                        chat_messages_.back()->id());
                    LinkPtr last_msg_link(new Link(last_ident, LinkFlags(true, true)));
                    temp_links.push_back(last_msg_link);
                }

                ChatMessageNode::request_create(create_id_,
                    *identity(), text_buffer_, temp_links);
            } else if (active_node_identity_ != NULL && 
                active_node_identity_->object() != NULL) {
                // Update the current node, and send an update request
                ChatMessageNode::request_update_text(*active_node_identity_,
                    text_buffer_);
                unsent_chars_ = false;
            }
        }

        return false;
    }
Exemplo n.º 10
0
void ServerState::keyDown(ci::app::KeyEvent event)
{
    static int count = 0;
    ++count;

    // Vec3f& cameraTo = GG.hexRender.getCameraTo();
    io::stream<GuiConsoleStream> cout = GG.console->output();

    int keycode = event.getCode();
    if (keycode == app::KeyEvent::KEY_ESCAPE) {
        mManager.setActiveState("title");
    }
    else if (keycode == app::KeyEvent::KEY_BACKQUOTE) {
        // XXX should push console to the top of the gui widget list
        GG.gui.attach(GG.console);
    }
    else if (keycode == app::KeyEvent::KEY_SPACE) {
        cout << "That's what I said: " << count << std::endl;
    }
}
Exemplo n.º 11
0
bool Control::isBindedToKeyEvent( ci::app::KeyEvent &event )
{
    bool useModifier = ( mKeyModifier != -1 ) ? true : false;
    bool modDown = getIsModifierDown( event );
    bool isBindedToMod = getIsBindedToModifier( event );
    bool isBindedToKey = getIsBindedToKey( event.getCode() );

    if( isBindedToKey )
    {
        if( isBindedToMod )
        {
            return true;
        }
        else if( !modDown && !useModifier )
        {
            return true;
        }
    }
    return false;
}
Exemplo n.º 12
0
void redEyeApp::keyDown(ci::app::KeyEvent event) {
	if(event.getChar()=='i') {
        mHide= !mHide;
    } else if(event.getCode()==KeyEvent::KEY_ESCAPE) {
        setFullScreen(!isFullScreen());
    } else if(event.getChar()=='f') {
        fs::path path= getOpenFilePath(mPathFrag);
        if(!path.empty()) {
			mPathFrag= path;
            loadShader();
		}
    } else if(event.getChar()=='v') {
        fs::path path= getOpenFilePath(mPathVert);
		if(!path.empty()) {
			mPathVert= path;
            loadShader();
		}
    } else if(event.getChar()=='m') {
        mMode= (mMode+1)%9;
    }
}
Exemplo n.º 13
0
Arquivo: Game.cpp Projeto: jettca/Aton
void Game::keyDown(ci::app::KeyEvent e)
{
  mEngine.keyEvent(true, e.getCode());
}
void RibbonPaint::keyDown( ci::app::KeyEvent event )
{
    if(_state != kStateNormal) return;

    char keyPressed = event.getChar();
    int colorMode;
    switch (keyPressed)
    {
    case 's':
        saveOutBrushImageAndParameters();
        break;
    case 'o':
        _drawParams = !_drawParams;
        _params.show( !_params.isVisible() );
        break;
    case 'r':
        randomizeBrush();
        break;
    case 'm':
        createBrush();
        break;
    case 'g':
        _glitchSegment = !_glitchSegment;
        break;
    case 'l':
        _useBezier = !_useBezier;
    case 'p':
        _drawPins = !_drawPins;
        break;
    case '1': // COLORMODE_HSV
    case '2': // COLORMODE_RGB
    case '3': // COLORMODE_RGBINVERSE
    case '4': // COLORMODE_RGB_B
    case '5': // COLORMODE_RGB_C
    case '6': // COLORMODE_GRAYSCALE
    case '7': // COLORMODE_ALPHABLEND_1
    case '8': // COLORMODE_ALPHABLEND_2
        colorMode = boost::lexical_cast<int>( keyPressed );
        toggleAdditiveBlending( colorMode < COLORMODE_GRAYSCALE);
        _colorMode = colorMode;
        break;
    default:
        console() << keyPressed << std::endl;
        break;
    }

    // slowdown or speed up how fast our object chases the mouse - clamp addition of speed (determined by ternary operator)
    if(event.getCode() == ci::app::KeyEvent::KEY_LEFT || event.getCode() == ci::app::KeyEvent::KEY_RIGHT) {
        if(event.getCode() == ci::app::KeyEvent::KEY_LEFT)
            _mouseChaseDamping -= 0.02;
        else if(event.getCode() == ci::app::KeyEvent::KEY_RIGHT)
            _mouseChaseDamping += 0.02;

        _mouseChaseDamping = ci::math<float>::clamp(_mouseChaseDamping, 0.02, 1.0);
        updateParams();
    }

    if(event.getCode() == ci::app::KeyEvent::KEY_UP || event.getCode() == ci::app::KeyEvent::KEY_DOWN)
    {
        _alphaWhenDrawing = ci::math<double>::clamp(_alphaWhenDrawing + ((event.getCode() == ci::app::KeyEvent::KEY_UP) ? 0.005 : -0.005), 0.0, 1.0);
        updateParams();
    }

    // exit fullscreen with escape, and toggle with F
    if ( event.getChar() == 'f' || (isFullScreen() && event.getCode() == ci::app::KeyEvent::KEY_ESCAPE) )
    {
        ci::gl::clear(_clearColor);
        setFullScreen( !isFullScreen() );
    }
}
Exemplo n.º 15
0
// ------------------------------------------------------------------------------------------------
void VisualsApp::keyDown(ci::app::KeyEvent event) {
    if (event.getCode() == 27) quit(); // quit on escape
}
Exemplo n.º 16
0
bool gen::Input::KeyUp(ci::app::KeyEvent event)
{
    switch (event.getCode())
    {
        case MOVE_UP_P1:
            g_pInputP1->m_keyState.MOVE_UP_STATE = false;
            g_pInputP1->FlyOff();
            break;

        case MOVE_LEFT_P1:
            g_pInputP1->m_keyState.MOVE_LEFT_STATE = false;
            if (g_pInputP1->m_keyState.MOVE_RIGHT_STATE == false)
            {
                g_pInputP1->m_pPlayer->m_pPhysicsData->m_pBtRigidBody->setAngularVelocity(btVector3(0,0,0));
            }
            break;

        case MOVE_RIGHT_P1:
            g_pInputP1->m_keyState.MOVE_RIGHT_STATE = false;
            if (g_pInputP1->m_keyState.MOVE_LEFT_STATE == false)
            {
                g_pInputP1->m_pPlayer->m_pPhysicsData->m_pBtRigidBody->setAngularVelocity(btVector3(0,0,0));
            }
            break;

        case SHOOT_P1:
            g_pInputP1->m_keyState.SHOOT_STATE = false;
            break;

        case MOVE_UP_P2:
            g_pInputP2->m_keyState.MOVE_UP_STATE = false;
            g_pInputP2->FlyOff();
            break;

        case MOVE_LEFT_P2:
            g_pInputP2->m_keyState.MOVE_LEFT_STATE = false;
            if (g_pInputP2->m_keyState.MOVE_RIGHT_STATE == false)
            {
                g_pInputP2->m_pPlayer->m_pPhysicsData->m_pBtRigidBody->setAngularVelocity(btVector3(0,0,0));
            }
            break;

        case MOVE_RIGHT_P2:
            g_pInputP2->m_keyState.MOVE_RIGHT_STATE = false;
            if (g_pInputP2->m_keyState.MOVE_LEFT_STATE == false)
            {
                g_pInputP2->m_pPlayer->m_pPhysicsData->m_pBtRigidBody->setAngularVelocity(btVector3(0,0,0));
            }
            break;

        case SHOOT_P2:
            g_pInputP2->m_keyState.SHOOT_STATE = false;
            break;

        default:
            return false;   // the input was not handled
            break;
    }

    return true;
}
Exemplo n.º 17
0
bool gen::Input::KeyDown(ci::app::KeyEvent event)
{
    switch (event.getCode())
    {
#ifdef _DEBUG
        case TOGGLE_STATS:
            g_pObjectManager->m_displayStats = !g_pObjectManager->m_displayStats;
            break;

        case TOGGLE_WIREFRAME:
            g_pObjectManager->m_wireframe = !g_pObjectManager->m_wireframe;
            break;

        case ADVANCE_GAME_STATE:
            switch (g_pObjectManager->m_gameState)
            {
                case TITLE:
                    g_pObjectManager->m_gameState = READY;
                    break;
                case READY:
                    g_pObjectManager->m_gameState = PLAYING;
                    break;
                case PLAYING:
                    g_pObjectManager->m_gameState = P1_WINS;
                    break;
                case P1_WINS:
                    g_pObjectManager->m_gameState = P2_WINS;
                    break;
                case P2_WINS:
                    g_pObjectManager->m_gameState = P3_WINS;
                    break;
                case P3_WINS:
                    g_pObjectManager->m_gameState = P4_WINS;
                    break;
                case P4_WINS:
                    g_pObjectManager->m_gameState = READY;
                    break;
                default:
                    break;
            }
            break;
#endif
        case TOGGLE_FULLSCREEN:
            g_pObjectManager->m_fullscreen = !g_pObjectManager->m_fullscreen;
            g_pApp->setFullScreen(g_pObjectManager->m_fullscreen);
            g_pObjectManager->m_fbo = gl::Fbo(g_pApp->getWindowWidth()*ci::app::getWindow()->getContentScale(),
                                              g_pApp->getWindowHeight()*ci::app::getWindow()->getContentScale(),
                                              g_pObjectManager->m_fboFormat);
            break;

        case TOGGLE_GUI:
            g_pObjectManager->m_displayGui = !g_pObjectManager->m_displayGui;
            break;

        case SHOOT_P1:
            if (!g_pInputP1->m_keyState.SHOOT_STATE)
            {
                g_pInputP1->Shoot();
                g_pInputP1->m_keyState.SHOOT_STATE = true;
            }
            break;

        case MOVE_UP_P1:
            if (g_pInputP1->m_keyState.MOVE_UP_STATE == false)
            {
                g_pInputP1->Fly();
            }
            g_pInputP1->m_keyState.MOVE_UP_STATE = true;
            break;

        case MOVE_LEFT_P1:
            g_pInputP1->m_keyState.MOVE_LEFT_STATE = true;
            g_pInputP1->m_keyState.MOVE_RIGHT_STATE = false;
            break;

        case MOVE_RIGHT_P1:
            g_pInputP1->m_keyState.MOVE_RIGHT_STATE = true;
            g_pInputP1->m_keyState.MOVE_LEFT_STATE = false;
            break;

        case SHOOT_P2:
            if (!g_pInputP2->m_keyState.SHOOT_STATE)
            {
                g_pInputP2->Shoot();
                g_pInputP2->m_keyState.SHOOT_STATE = true;
            }
            break;

        case MOVE_UP_P2:
            if (g_pInputP2->m_keyState.MOVE_UP_STATE == false)
            {
                g_pInputP2->Fly();
            }
            g_pInputP2->m_keyState.MOVE_UP_STATE = true;
            break;

        case MOVE_LEFT_P2:
            g_pInputP2->m_keyState.MOVE_LEFT_STATE = true;
            g_pInputP2->m_keyState.MOVE_RIGHT_STATE = false;
            break;

        case MOVE_RIGHT_P2:
            g_pInputP2->m_keyState.MOVE_RIGHT_STATE = true;
            g_pInputP2->m_keyState.MOVE_LEFT_STATE = false;
            break;

        case RESTART:
            if (g_pObjectManager->m_gameState == READY)
            {
                g_pObjectManager->Restart();
            }
            break;

        case ci::app::KeyEvent::KEY_ESCAPE:
            g_pObjectManager->m_gameState = CREDITS;
            break;

        default:
            return false;   // the input was not handled
            break;
    }

    return true;    // the input was handled
}
Exemplo n.º 18
0
void App::keyUp(const ci::app::KeyEvent Event)
{
    for (auto&& listener : m_InputListeners) {
        listener->OnKeyUp(Event.getCode(), Event);
    }
}
Exemplo n.º 19
0
void TextInput::keyDown( ci::app::KeyEvent &event )
{
	if( mClicked ) {
		if( event.getCode() == KeyEvent::KEY_v && event.isMetaDown() ) {
			if( Clipboard::hasString() ) {
				setValue( Clipboard::getString() );
				if( (int)mTrigger & (int)Trigger::CHANGE ) {
					trigger();
				}
			}
		}
		else {
			switch( event.getCode() ) {
			case KeyEvent::KEY_RIGHT: {
				if( mCursorPosition == mMaxDisplayLength && (int)mValue.substr( mStartIndex ).length() > mMaxDisplayLength ) {
					mStartIndex++;
					mDisplayValue = mValue.substr( mStartIndex, mMaxDisplayLength );
					mLabelRef->setLabel( mDisplayValue );
				}
				else if( mCursorPosition < (int)mDisplayValue.length() ) {
					mCursorPosition = mCursorPosition + 1;
				}
				setNeedsDisplay();
			} break;

			case KeyEvent::KEY_LEFT: {
				if( mCursorPosition == 0 && mStartIndex > 0 ) {
					mStartIndex--;
					mDisplayValue = mValue.substr( mStartIndex, mMaxDisplayLength );
					mLabelRef->setLabel( mDisplayValue );
				}
				else {
					mCursorPosition = mCursorPosition > 0 ? mCursorPosition - 1 : mCursorPosition;
				}
				setNeedsDisplay();
			} break;

			case KeyEvent::KEY_DELETE:
			case KeyEvent::KEY_BACKSPACE: {
				deleteCharacter();
			} break;

			case KeyEvent::KEY_UNKNOWN:
			case KeyEvent::KEY_TAB:
			case KeyEvent::KEY_CLEAR:
			case KeyEvent::KEY_KP0:
			case KeyEvent::KEY_KP1:
			case KeyEvent::KEY_KP2:
			case KeyEvent::KEY_KP3:
			case KeyEvent::KEY_KP4:
			case KeyEvent::KEY_KP5:
			case KeyEvent::KEY_KP6:
			case KeyEvent::KEY_KP7:
			case KeyEvent::KEY_KP8:
			case KeyEvent::KEY_KP9:
			case KeyEvent::KEY_KP_DIVIDE:
			case KeyEvent::KEY_KP_MULTIPLY:
			case KeyEvent::KEY_KP_PLUS:
			case KeyEvent::KEY_KP_EQUALS:
			case KeyEvent::KEY_UP:
			case KeyEvent::KEY_DOWN:
			case KeyEvent::KEY_INSERT:
			case KeyEvent::KEY_HOME:
			case KeyEvent::KEY_END:
			case KeyEvent::KEY_PAGEUP:
			case KeyEvent::KEY_PAGEDOWN:
			case KeyEvent::KEY_F1:
			case KeyEvent::KEY_F2:
			case KeyEvent::KEY_F3:
			case KeyEvent::KEY_F4:
			case KeyEvent::KEY_F5:
			case KeyEvent::KEY_F6:
			case KeyEvent::KEY_F7:
			case KeyEvent::KEY_F8:
			case KeyEvent::KEY_F9:
			case KeyEvent::KEY_F10:
			case KeyEvent::KEY_F11:
			case KeyEvent::KEY_F12:
			case KeyEvent::KEY_F13:
			case KeyEvent::KEY_F14:
			case KeyEvent::KEY_F15:
			case KeyEvent::KEY_NUMLOCK:
			case KeyEvent::KEY_CAPSLOCK:
			case KeyEvent::KEY_SCROLLOCK:
			case KeyEvent::KEY_RSHIFT:
			case KeyEvent::KEY_LSHIFT:
			case KeyEvent::KEY_RCTRL:
			case KeyEvent::KEY_LCTRL:
			case KeyEvent::KEY_RALT:
			case KeyEvent::KEY_LALT:
			case KeyEvent::KEY_RMETA:
			case KeyEvent::KEY_LMETA:
			case KeyEvent::KEY_LSUPER:
			case KeyEvent::KEY_RSUPER:
			case KeyEvent::KEY_MODE:
			case KeyEvent::KEY_COMPOSE:
			case KeyEvent::KEY_HELP:
			case KeyEvent::KEY_PRINT:
			case KeyEvent::KEY_SYSREQ:
			case KeyEvent::KEY_BREAK:
			case KeyEvent::KEY_MENU:
			case KeyEvent::KEY_POWER:
			case KeyEvent::KEY_EURO:
			case KeyEvent::KEY_UNDO:
				break;

			case KeyEvent::KEY_KP_ENTER:
			case KeyEvent::KEY_RETURN: {
				mClicked = false;
				if( (int)mTrigger & (int)Trigger::END ) {
					trigger();
					setNeedsDisplay();
				}
				if( mFormat.mAutoClear ) {
					setValue( "" );
				}
			} break;

			default: {
				if( mFormat.mNumeric ) {
					if( event.getChar() == '-' && mValue.length() == 0 ) {
						insertCharacter( string( 1, event.getChar() ) );
					}
					else if( event.getChar() == '.' && mValue.find( "." ) == string::npos ) {
						insertCharacter( string( 1, event.getChar() ) );
					}
					else if( isdigit( event.getChar() ) ) {
						insertCharacter( string( 1, event.getChar() ) );
					}
				}
				else {
					insertCharacter( string( 1, event.getChar() ) );
				}
			} break;
			}
		}
	}
}
Exemplo n.º 20
0
	virtual void onKeyUp(ci::app::KeyEvent &e) {
		if ( e.getCode() == ci::app::KeyEvent::KEY_SPACE && state != In  ) {
			state = Out;
		}
	}
Exemplo n.º 21
0
Arquivo: Game.cpp Projeto: jettca/Aton
void Game::keyUp(ci::app::KeyEvent e)
{
  mEngine.keyEvent(false, e.getCode());
}