Merge branch 'master' of https://bitbucket.org/omigamedev/new_engine
This commit is contained in:
@@ -59,14 +59,24 @@ kEventResult NodeTextInput::handle_event(Event* e)
|
|||||||
//}
|
//}
|
||||||
break;
|
break;
|
||||||
case kEventType::KeyChar:
|
case kEventType::KeyChar:
|
||||||
if (ke->m_char >= 32 && ke->m_char < (32 + 96))
|
if (ke->m_char == '\b') // backspace
|
||||||
{
|
|
||||||
if (ke->m_char == 0x7f)
|
|
||||||
{
|
{
|
||||||
if (!m_string.empty())
|
if (!m_string.empty())
|
||||||
|
{
|
||||||
m_string.erase(m_string.end() - 1);
|
m_string.erase(m_string.end() - 1);
|
||||||
|
m_text->set_text(m_string.c_str());
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
else if (ke->m_char == 0x7f) // DEL
|
||||||
|
{
|
||||||
|
if (!m_string.empty())
|
||||||
|
{
|
||||||
|
m_string.erase(m_string.end() - 1);
|
||||||
|
m_text->set_text(m_string.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (ke->m_char >= 32 && ke->m_char < (32 + 96))
|
||||||
|
{
|
||||||
m_string += (char)ke->m_char;
|
m_string += (char)ke->m_char;
|
||||||
m_text->set_text(m_string.c_str());
|
m_text->set_text(m_string.c_str());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user