Merge branch 'master' of gitlab.iut-clermont.uca.fr:/maribemont/projet-tut

origin/fixingSettings
Mathis RIBEMONT 3 years ago
commit 311a3f8fb3

@ -73,16 +73,16 @@ int main(int argc, char *argv[]) {
}*/
generalState = GS_Game;
gameView(&generalState, window, renderer, players, nbPlayers, &fontHandler);
//gameView(&generalState, window, renderer, players, nbPlayers, &fontHandler);
//Pour tester le endGameMenu directement
generalState = GS_EndOfGameMenu;
/*players[0].eliminationTurn = 10;
players[0].eliminationTurn = 10;
players[0].rank = 3;
players[1].eliminationTurn = 15;
players[1].rank = 2;
players[2].eliminationTurn = 0;
players[2].rank = 1;*/
players[2].rank = 1;
endGameMenu(&generalState, window, renderer, &fontHandler, players, nbPlayers);
break;

@ -10,6 +10,8 @@
#include "engine/Button.h"
#include "engine/arrayButton.h"
#include "engine/TextInput.h"
#include "engine/arrayTextInput.h"
#include "engine/InputElement.h"
/**
@ -19,6 +21,8 @@
typedef struct
{
struct array_P_Button tabButton;
struct array_TextInput tabTextInput;
TextInput* selectedTextInput;
} InputProcessor;

@ -27,7 +27,8 @@
typedef struct
{
char* value;
int cursorPosition;
Sint32 cursorPosition;
SDL_Rect size;
bool isActive;
SDL_Color textColor;

@ -0,0 +1,9 @@
#ifndef ARRAY_TEXT_INPUT_INCLUDED
#define ARRAY_TEXT_INPUT_INCLUDED
#include "engine/TextInput.h"
#include "engine/ArrayUtils.h"
GENERATE_DYNAMIC_ARRAY(TextInput)
#endif //ARRAY_TEXT_INPUT_INCLUDED

@ -2,7 +2,8 @@
InputProcessor createInputProcessor() {
InputProcessor inputProcessor = {
.tabButton = array_P_Button_Create()
.tabButton = array_P_Button_Create(),
.tabTextInput = array_TextInput_Create()
};
return inputProcessor;
}
@ -33,6 +34,22 @@ InputElement proccessInput(InputProcessor *inputProcessor)
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();
}
case SDL_MOUSEMOTION:
@ -50,6 +67,12 @@ InputElement proccessInput(InputProcessor *inputProcessor)
if (event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) {
return createInputElementResizeWindow(event.window.data1, event.window.data2);
}
break;
case SDL_TEXTINPUT:
break;
case SDL_TEXTEDITING:
break;
}

@ -36,8 +36,8 @@ struct array_P_Button createGameInterfaceButtons(SDL_Renderer* renderer, FontHan
struct array_TextLabel createGameInterfaceLabels(SDL_Renderer* renderer, FontHandler* fontHandler) {
//Postion text label
SDL_Point positonNbTurnLabel = {.x=60, .y=800};
SDL_Point positionTimeLablel = {.x=770, .y=800};
SDL_Point positonNbTurnLabel = {.x=60, .y=850};
SDL_Point positionTimeLablel = {.x=770, .y=850};
//Color labal
SDL_Color colorLabel = {0, 255, 0, 255};

Loading…
Cancel
Save