keyboard
This commit is contained in:
parent
ec449cc337
commit
9195096bcb
@ -138,6 +138,7 @@ protected:
|
||||
|
||||
boost::mutex WidgetListMutex;
|
||||
|
||||
bool KeyboardIsOnScreen;
|
||||
public:
|
||||
|
||||
boost::signal<void(int)> KeyPressedSignal;
|
||||
@ -169,6 +170,10 @@ public:
|
||||
|
||||
void OnMove(vec2 shift);
|
||||
|
||||
void ShowKeyboard();
|
||||
void HideKeyboard();
|
||||
|
||||
|
||||
void PrintWidgetList();
|
||||
|
||||
std::shared_ptr<boost::signal<void (TSignalParam)>> GetOnClickSignal(const std::string& widgetName);
|
||||
|
@ -640,7 +640,10 @@ void TEdit::OnTapDown(vec2 pos)
|
||||
{
|
||||
ResourceManager->GUIManager.KeyPressedSignal.disconnect_all_slots();
|
||||
InputConnection = ResourceManager->GUIManager.KeyPressedSignal.connect(boost::bind(&TEdit::OnKeyPress, this, _1));
|
||||
|
||||
}
|
||||
|
||||
ResourceManager->GUIManager.ShowKeyboard();
|
||||
}
|
||||
|
||||
void TEdit::OnKeyPress(int key)
|
||||
|
@ -10,6 +10,7 @@ const std::string CONST_DRAG_SIGNAL_NAME = "OnDrag";
|
||||
|
||||
|
||||
TGUIManager::TGUIManager()
|
||||
: KeyboardIsOnScreen(false)
|
||||
{
|
||||
|
||||
}
|
||||
@ -369,6 +370,26 @@ void TGUIManager::OnMove(vec2 shift)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TGUIManager::ShowKeyboard()
|
||||
{
|
||||
if (!KeyboardIsOnScreen)
|
||||
{
|
||||
MoveWidget("Keyboard", vec2(0, 216));
|
||||
KeyboardIsOnScreen = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TGUIManager::HideKeyboard()
|
||||
{
|
||||
if (KeyboardIsOnScreen)
|
||||
{
|
||||
MoveWidget("Keyboard", vec2(0, -216));
|
||||
KeyboardIsOnScreen = false;
|
||||
}
|
||||
}
|
||||
|
||||
void TGUIManager::PrintWidgetList()
|
||||
{
|
||||
TWidgetArr::iterator i;
|
||||
|
@ -4,19 +4,6 @@ namespace SE
|
||||
{
|
||||
|
||||
|
||||
/*
|
||||
struct TKeyboardWidget : public TInstancingWidgetAncestor
|
||||
{
|
||||
|
||||
|
||||
TKeyboardWidget();
|
||||
|
||||
virtual bool CheckClick(vec2 mousePos);
|
||||
virtual void OnTapDown(vec2 pos);
|
||||
virtual void OnTapUp(vec2 pos);
|
||||
|
||||
};*/
|
||||
|
||||
TKeyboardWidget::TKeyboardWidget()
|
||||
: Shifted(false)
|
||||
{
|
||||
@ -160,6 +147,12 @@ struct TKeyboardWidget : public TInstancingWidgetAncestor
|
||||
ResourceManager->GUIManager.KeyPressedSignal(std::get<1>(visualKeyElement));
|
||||
}
|
||||
}
|
||||
|
||||
if (pos.v[0] >= 280 - 74/2 && pos.v[0] <= 280 + 74/2 &&
|
||||
pos.v[1] >= 23 - 38/2 && pos.v[1] <= 23 + 38/2)
|
||||
{
|
||||
ResourceManager->GUIManager.HideKeyboard();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user