|
|
@ -2,7 +2,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
InputProcessor createInputProcessor() {
|
|
|
|
InputProcessor createInputProcessor() {
|
|
|
|
InputProcessor inputProcessor = {
|
|
|
|
InputProcessor inputProcessor = {
|
|
|
|
.tabButton = array_P_Button_Create()
|
|
|
|
.tabButton = array_P_Button_Create(),
|
|
|
|
|
|
|
|
.tabTextInput = array_TextInput_Create()
|
|
|
|
};
|
|
|
|
};
|
|
|
|
return inputProcessor;
|
|
|
|
return inputProcessor;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -33,6 +34,22 @@ InputElement proccessInput(InputProcessor *inputProcessor)
|
|
|
|
b->onClick(b);
|
|
|
|
b->onClick(b);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool textInputClicked = false;
|
|
|
|
|
|
|
|
for (size_t i = 0; i<inputProcessor->tabTextInput.size; ++i) {
|
|
|
|
|
|
|
|
TextInput* ti = &inputProcessor->tabTextInput.elems[i];
|
|
|
|
|
|
|
|
if (SDL_PointInRect(&mousePoint, &ti->size)) {
|
|
|
|
|
|
|
|
if (inputProcessor->selectedTextInput == NULL) {
|
|
|
|
|
|
|
|
SDL_StartTextInput();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
inputProcessor->selectedTextInput = ti;
|
|
|
|
|
|
|
|
textInputClicked = true;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!textInputClicked) {
|
|
|
|
|
|
|
|
inputProcessor->selectedTextInput = NULL;
|
|
|
|
|
|
|
|
SDL_StopTextInput();
|
|
|
|
|
|
|
|
}
|
|
|
|
return createInputElementNone();
|
|
|
|
return createInputElementNone();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case SDL_MOUSEMOTION:
|
|
|
|
case SDL_MOUSEMOTION:
|
|
|
@ -50,6 +67,12 @@ InputElement proccessInput(InputProcessor *inputProcessor)
|
|
|
|
if (event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) {
|
|
|
|
if (event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) {
|
|
|
|
return createInputElementResizeWindow(event.window.data1, event.window.data2);
|
|
|
|
return createInputElementResizeWindow(event.window.data1, event.window.data2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SDL_TEXTINPUT:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SDL_TEXTEDITING:
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|