💿🐜 Antkeeper source code https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
2.3 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. /*
  2. * Copyright (C) 2017 Christopher J. Howard
  3. *
  4. * This file is part of Antkeeper Source Code.
  5. *
  6. * Antkeeper Source Code is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Antkeeper Source Code is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with Antkeeper Source Code. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #include "splash-state.hpp"
  20. #include "../application.hpp"
  21. #include "title-state.hpp"
  22. SplashState::SplashState(Application* application):
  23. ApplicationState(application)
  24. {}
  25. SplashState::~SplashState()
  26. {}
  27. void SplashState::enter()
  28. {
  29. application->splashBackgroundImage->setVisible(true);
  30. application->splashImage->setVisible(true);
  31. application->splashFadeInTween->start();
  32. }
  33. void SplashState::execute()
  34. {
  35. // Listen for splash screen skip
  36. InputEvent event;
  37. application->inputManager->listen(&event);
  38. if (event.type != InputEvent::Type::NONE)
  39. {
  40. // Update control profile and input manager
  41. application->menuControlProfile->update();
  42. application->inputManager->update();
  43. // Check if application was closed
  44. if (application->inputManager->wasClosed() || application->escape.isTriggered())
  45. {
  46. application->close(EXIT_SUCCESS);
  47. return;
  48. }
  49. // Check if fullscreen was toggled
  50. else if (application->toggleFullscreen.isTriggered() && !application->toggleFullscreen.wasTriggered())
  51. {
  52. application->changeFullscreen();
  53. }
  54. else
  55. {
  56. // Clear screen
  57. glClear(GL_COLOR_BUFFER_BIT);
  58. SDL_GL_SwapWindow(application->window);
  59. // Stop splash tweens
  60. application->splashFadeInTween->stop();
  61. application->splashHangTween->stop();
  62. application->splashFadeOutTween->stop();
  63. // Change to title state
  64. application->changeState(application->titleState);
  65. return;
  66. }
  67. }
  68. }
  69. void SplashState::exit()
  70. {
  71. // Hide splash screen
  72. application->splashBackgroundImage->setVisible(false);
  73. application->splashImage->setVisible(false);
  74. }