Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void eventManager()
- {
- bool opened = true;
- SDL_Event event;
- SDL_PollEvent(&event);
- switch(event.type)
- {
- case SDL_QUIT:
- {
- opened = 0;
- break;
- }
- case SDL_WINDOWEVENT:
- switch(event.window.event)
- {
- case SDL_WINDOWEVENT_RESTORED:
- case SDL_WINDOWEVENT_MAXIMIZED:
- case SDL_WINDOWEVENT_RESIZED:
- {
- resizeGui();
- renderScreen(0);
- break;
- }
- }
- break;
- case SDL_KEYDOWN: // stop sound if finger remove of arrow (and not run)
- switch(event.key.keysym.sym) // escape when chat open -> close the game
- {
- case SDL_MOUSEBUTTONDOWN:
- if(event.button.button == SDL_BUTTON_RIGHT)
- {
- //getUser(USERNAME).rightClick();
- }
- break;
- case SDLK_RETURN:
- if(actualGui == "GuiGame")
- {
- if(actualGuiInGame == "")
- {
- SDL_ShowCursor(SDL_ENABLE);
- SDL_SetRelativeMouseMode(SDL_FALSE);
- setGuiInGame("GuiChat");
- }
- else
- {
- SDL_ShowCursor(SDL_DISABLE);
- SDL_SetRelativeMouseMode(SDL_TRUE);
- if(writingText.length() != 0)
- {
- sendStr(writingText);
- writingText = "";
- }
- setGuiInGame("");
- }
- }
- break;
- case SDLK_BACKSPACE:
- if(actualGuiInGame == "GuiChat")
- writingText = writingText.substr(0, writingText.length() - 1);
- break;
- case SDLK_ESCAPE:
- opened = 0;
- break;
- case SDLK_F5:
- changeF5Bool();
- break;
- case SDLK_F7:
- changeF7Bool();
- break;
- default:
- if(actualGui == "GuiGame" && actualGuiInGame == "")
- camera->OnKeyboard(event.key);
- break;
- }
- break;
- case SDL_TEXTINPUT:
- if(actualGuiInGame == "GuiChat")
- writingText.append(event.text.text);
- break;
- case SDL_KEYUP:
- if(actualGui == "GuiGame")
- camera->OnKeyboard(event.key);
- break;
- case SDL_MOUSEMOTION:
- if(actualGuiInGame == "")
- camera->OnMouseMotion(event.motion);
- break;
- case default:
- break;
- }
- free();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement