0 Members and 1 Guest are viewing this topic.
case EDITBOX: { CEditBox *pEditBox = static_cast<CEditBox*>(m_pFocusEnt); std::string CurrentText = pEditBox->GetText(); int CharSelected = pEditBox->GetCharSelected(); if (*pKeyPressed == sf::Key::A) { if (GetRenderWindow()->GetInput().IsKeyDown(sf::Key::LShift) || GetRenderWindow()->GetInput().IsKeyDown(sf::Key::RShift)) CurrentText.insert(CurrentText.begin()+CharSelected, 'A'); else CurrentText.insert(CurrentText.begin()+CharSelected, 'a'); } else if (*pKeyPressed == sf::Key::B) { if (GetRenderWindow()->GetInput().IsKeyDown(sf::Key::LShift) || GetRenderWindow()->GetInput().IsKeyDown(sf::Key::RShift)) CurrentText.insert(CurrentText.begin()+CharSelected, 'B'); else CurrentText.insert(CurrentText.begin()+CharSelected, 'b'); } else if (*pKeyPressed == sf::Key::C) { if (GetRenderWindow()->GetInput().IsKeyDown(sf::Key::LShift) || GetRenderWindow()->GetInput().IsKeyDown(sf::Key::RShift)) CurrentText.insert(CurrentText.begin()+CharSelected, 'C'); else CurrentText.insert(CurrentText.begin()+CharSelected, 'c'); } else if (*pKeyPressed == sf::Key::D) { if (GetRenderWindow()->GetInput().IsKeyDown(sf::Key::LShift) || GetRenderWindow()->GetInput().IsKeyDown(sf::Key::RShift)) CurrentText.insert(CurrentText.begin()+CharSelected, 'D'); else CurrentText.insert(CurrentText.begin()+CharSelected, 'd'); } else if (*pKeyPressed == sf::Key::E) { if (GetRenderWindow()->GetInput().IsKeyDown(sf::Key::LShift) || GetRenderWindow()->GetInput().IsKeyDown(sf::Key::RShift)) CurrentText.insert(CurrentText.begin()+CharSelected, 'E'); else CurrentText.insert(CurrentText.begin()+CharSelected, 'e'); } else if (*pKeyPressed == sf::Key::F) { if (GetRenderWindow()->GetInput().IsKeyDown(sf::Key::LShift) || GetRenderWindow()->GetInput().IsKeyDown(sf::Key::RShift)) CurrentText.insert(CurrentText.begin()+CharSelected, 'F'); else CurrentText.insert(CurrentText.begin()+CharSelected, 'f'); } else if (*pKeyPressed == sf::Key::G) { if (GetRenderWindow()->GetInput().IsKeyDown(sf::Key::LShift) || GetRenderWindow()->GetInput().IsKeyDown(sf::Key::RShift)) CurrentText.insert(CurrentText.begin()+CharSelected, 'G'); else CurrentText.insert(CurrentText.begin()+CharSelected, 'g'); } else if (*pKeyPressed == sf::Key::H) { if (GetRenderWindow()->GetInput().IsKeyDown(sf::Key::LShift) || GetRenderWindow()->GetInput().IsKeyDown(sf::Key::RShift)) CurrentText.insert(CurrentText.begin()+CharSelected, 'H'); else CurrentText.insert(CurrentText.begin()+CharSelected, 'h'); } else if (*pKeyPressed == sf::Key::I) { if (GetRenderWindow()->GetInput().IsKeyDown(sf::Key::LShift) || GetRenderWindow()->GetInput().IsKeyDown(sf::Key::RShift)) CurrentText.insert(CurrentText.begin()+CharSelected, 'I'); else CurrentText.insert(CurrentText.begin()+CharSelected, 'i'); } else if (*pKeyPressed == sf::Key::J) { if (GetRenderWindow()->GetInput().IsKeyDown(sf::Key::LShift) || GetRenderWindow()->GetInput().IsKeyDown(sf::Key::RShift)) CurrentText.insert(CurrentText.begin()+CharSelected, 'J'); else CurrentText.insert(CurrentText.begin()+CharSelected, 'j'); } else if (*pKeyPressed == sf::Key::K) { if (GetRenderWindow()->GetInput().IsKeyDown(sf::Key::LShift) || GetRenderWindow()->GetInput().IsKeyDown(sf::Key::RShift)) CurrentText.insert(CurrentText.begin()+CharSelected, 'K'); else CurrentText.insert(CurrentText.begin()+CharSelected, 'k'); } else if (*pKeyPressed == sf::Key::L) { if (GetRenderWindow()->GetInput().IsKeyDown(sf::Key::LShift) || GetRenderWindow()->GetInput().IsKeyDown(sf::Key::RShift)) CurrentText.insert(CurrentText.begin()+CharSelected, 'L'); else CurrentText.insert(CurrentText.begin()+CharSelected, 'l'); } else if (*pKeyPressed == sf::Key::M) { if (GetRenderWindow()->GetInput().IsKeyDown(sf::Key::LShift) || GetRenderWindow()->GetInput().IsKeyDown(sf::Key::RShift)) CurrentText.insert(CurrentText.begin()+CharSelected, 'M'); else CurrentText.insert(CurrentText.begin()+CharSelected, 'm'); } else if (*pKeyPressed == sf::Key::N) { if (GetRenderWindow()->GetInput().IsKeyDown(sf::Key::LShift) || GetRenderWindow()->GetInput().IsKeyDown(sf::Key::RShift)) CurrentText.insert(CurrentText.begin()+CharSelected, 'N'); else CurrentText.insert(CurrentText.begin()+CharSelected, 'n'); } else if (*pKeyPressed == sf::Key::O) { if (GetRenderWindow()->GetInput().IsKeyDown(sf::Key::LShift) || GetRenderWindow()->GetInput().IsKeyDown(sf::Key::RShift)) CurrentText.insert(CurrentText.begin()+CharSelected, 'O'); else CurrentText.insert(CurrentText.begin()+CharSelected, 'o'); } else if (*pKeyPressed == sf::Key::P) { if (GetRenderWindow()->GetInput().IsKeyDown(sf::Key::LShift) || GetRenderWindow()->GetInput().IsKeyDown(sf::Key::RShift)) CurrentText.insert(CurrentText.begin()+CharSelected, 'P'); else CurrentText.insert(CurrentText.begin()+CharSelected, 'p'); } else if (*pKeyPressed == sf::Key::Q) { if (GetRenderWindow()->GetInput().IsKeyDown(sf::Key::LShift) || GetRenderWindow()->GetInput().IsKeyDown(sf::Key::RShift)) CurrentText.insert(CurrentText.begin()+CharSelected, 'Q'); else CurrentText.insert(CurrentText.begin()+CharSelected, 'q'); } else if (*pKeyPressed == sf::Key::R) { if (GetRenderWindow()->GetInput().IsKeyDown(sf::Key::LShift) || GetRenderWindow()->GetInput().IsKeyDown(sf::Key::RShift)) CurrentText.insert(CurrentText.begin()+CharSelected, 'R'); else CurrentText.insert(CurrentText.begin()+CharSelected, 'r'); } else if (*pKeyPressed == sf::Key::S) { if (GetRenderWindow()->GetInput().IsKeyDown(sf::Key::LShift) || GetRenderWindow()->GetInput().IsKeyDown(sf::Key::RShift)) CurrentText.insert(CurrentText.begin()+CharSelected, 'S'); else CurrentText.insert(CurrentText.begin()+CharSelected, 's'); } else if (*pKeyPressed == sf::Key::T) { if (GetRenderWindow()->GetInput().IsKeyDown(sf::Key::LShift) || GetRenderWindow()->GetInput().IsKeyDown(sf::Key::RShift)) CurrentText.insert(CurrentText.begin()+CharSelected, 'T'); else CurrentText.insert(CurrentText.begin()+CharSelected, 't'); } else if (*pKeyPressed == sf::Key::U) { if (GetRenderWindow()->GetInput().IsKeyDown(sf::Key::LShift) || GetRenderWindow()->GetInput().IsKeyDown(sf::Key::RShift)) CurrentText.insert(CurrentText.begin()+CharSelected, 'U'); else CurrentText.insert(CurrentText.begin()+CharSelected, 'u'); } else if (*pKeyPressed == sf::Key::V) { if (GetRenderWindow()->GetInput().IsKeyDown(sf::Key::LShift) || GetRenderWindow()->GetInput().IsKeyDown(sf::Key::RShift)) CurrentText.insert(CurrentText.begin()+CharSelected, 'V'); else CurrentText.insert(CurrentText.begin()+CharSelected, 'v'); } else if (*pKeyPressed == sf::Key::W) { if (GetRenderWindow()->GetInput().IsKeyDown(sf::Key::LShift) || GetRenderWindow()->GetInput().IsKeyDown(sf::Key::RShift)) CurrentText.insert(CurrentText.begin()+CharSelected, 'W'); else CurrentText.insert(CurrentText.begin()+CharSelected, 'w'); } else if (*pKeyPressed == sf::Key::X) { if (GetRenderWindow()->GetInput().IsKeyDown(sf::Key::LShift) || GetRenderWindow()->GetInput().IsKeyDown(sf::Key::RShift)) CurrentText.insert(CurrentText.begin()+CharSelected, 'X'); else CurrentText.insert(CurrentText.begin()+CharSelected, 'x'); } else if (*pKeyPressed == sf::Key::Y) { if (GetRenderWindow()->GetInput().IsKeyDown(sf::Key::LShift) || GetRenderWindow()->GetInput().IsKeyDown(sf::Key::RShift)) CurrentText.insert(CurrentText.begin()+CharSelected, 'Y'); else CurrentText.insert(CurrentText.begin()+CharSelected, 'y'); } else if (*pKeyPressed == sf::Key::Z) { if (GetRenderWindow()->GetInput().IsKeyDown(sf::Key::LShift) || GetRenderWindow()->GetInput().IsKeyDown(sf::Key::RShift)) CurrentText.insert(CurrentText.begin()+CharSelected, 'Z'); else CurrentText.insert(CurrentText.begin()+CharSelected, 'z'); } else if (*pKeyPressed == sf::Key::Num0 || *pKeyPressed == sf::Key::Numpad0) CurrentText.insert(CurrentText.begin()+CharSelected, '0'); else if (*pKeyPressed == sf::Key::Num1 || *pKeyPressed == sf::Key::Numpad1) CurrentText.insert(CurrentText.begin()+CharSelected, '1'); else if (*pKeyPressed == sf::Key::Num2 || *pKeyPressed == sf::Key::Numpad2) CurrentText.insert(CurrentText.begin()+CharSelected, '2'); else if (*pKeyPressed == sf::Key::Num3 || *pKeyPressed == sf::Key::Numpad3) CurrentText.insert(CurrentText.begin()+CharSelected, '3'); else if (*pKeyPressed == sf::Key::Num4 || *pKeyPressed == sf::Key::Numpad4) CurrentText.insert(CurrentText.begin()+CharSelected, '4'); else if (*pKeyPressed == sf::Key::Num5 || *pKeyPressed == sf::Key::Numpad5) CurrentText.insert(CurrentText.begin()+CharSelected, '5'); else if (*pKeyPressed == sf::Key::Num6 || *pKeyPressed == sf::Key::Numpad6) CurrentText.insert(CurrentText.begin()+CharSelected, '6'); else if (*pKeyPressed == sf::Key::Num7 || *pKeyPressed == sf::Key::Numpad7) CurrentText.insert(CurrentText.begin()+CharSelected, '7'); else if (*pKeyPressed == sf::Key::Num8 || *pKeyPressed == sf::Key::Numpad8) CurrentText.insert(CurrentText.begin()+CharSelected, '8'); else if (*pKeyPressed == sf::Key::Num9 || *pKeyPressed == sf::Key::Numpad9) CurrentText.insert(CurrentText.begin()+CharSelected, '9'); else if (*pKeyPressed == sf::Key::Space) CurrentText.insert(CurrentText.begin()+CharSelected, ' '); else if (*pKeyPressed == sf::Key::Back && CurrentText.size() > 0) { std::string::iterator it = CurrentText.begin()+CharSelected-1; if (it >= CurrentText.begin()) CurrentText.erase(it); } else if (*pKeyPressed == sf::Key::Delete && CurrentText.size() > 0) { std::string::iterator it = CurrentText.begin()+CharSelected; if (it < CurrentText.end()) CurrentText.erase(it); pEditBox->SetCharSelected(CharSelected+1); } else if (*pKeyPressed == sf::Key::Left) { int CurrentCharSel = pEditBox->GetCharSelected(); CurrentCharSel--; pEditBox->SetCharSelected(CurrentCharSel); } else if (*pKeyPressed == sf::Key::Right) { int CurrentCharSel = pEditBox->GetCharSelected(); CurrentCharSel++; pEditBox->SetCharSelected(CurrentCharSel); } pEditBox->SetText(CurrentText.c_str()); } break;
No, it is not possible yet.