Fix uncaptureCallback
This commit is contained in:
parent
6c88bcd385
commit
6bf2e12b08
@ -112,6 +112,7 @@ KeyboardCapture captureKeyboardInput(KeyCharCallback charCallback, KeyCallback k
|
||||
|
||||
bool uncaptureKeyboardInput(KeyboardCapture capture) {
|
||||
if(capture == KEK_INVALID_ID || capture != kekData.activeKeyboardCapture.id) return false;
|
||||
kekData.activeKeyboardCapture.uncaptureCallback();
|
||||
kekData.activeKeyboardCapture = {
|
||||
KEK_INVALID_ID,
|
||||
KeyCharCallback(),
|
||||
|
@ -22,6 +22,7 @@ void mouseButtonCallback(GLFWwindow *window, int button, int action, int mods, v
|
||||
}
|
||||
|
||||
void onButtonClick(void *data) {
|
||||
button->color = Colors::RED;
|
||||
capture = Input::captureKeyboardInput(KeyCharCallback([](GLFWwindow *window, unsigned int codepoint, void *data) {
|
||||
std::u32string str = Unicode::convertStdToU32(button->text->getText());
|
||||
if(codepoint == KEK_INPUT_DELETE) {
|
||||
@ -34,7 +35,9 @@ void onButtonClick(void *data) {
|
||||
if(key == GLFW_KEY_ENTER && action == GLFW_PRESS) {
|
||||
Input::uncaptureKeyboardInput(capture);
|
||||
}
|
||||
}, nullptr), Callable());
|
||||
}, nullptr), Callable([](void *data) {
|
||||
button->color = Colors::WHITE;
|
||||
}, nullptr));
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
Loading…
Reference in New Issue
Block a user