💿🐜 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.

70 lines
1.7 KiB

  1. /*
  2. * Copyright (C) 2020 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 "application-states.hpp"
  20. #include "application.hpp"
  21. #include <functional>
  22. #include <iostream>
  23. void enter_splash_state(application* app)
  24. {
  25. logger* logger = app->get_logger();
  26. logger->push_task("Entering splash state");
  27. auto fade_in = [logger]()
  28. {
  29. logger->log("cue logo fade-in\n");
  30. };
  31. auto fade_out = [logger]()
  32. {
  33. logger->log("cue logo fade-out\n");
  34. };
  35. auto change_state = [app]()
  36. {
  37. app->get_state_machine()->change_state(app->get_title_state());
  38. };
  39. // Get timeline
  40. timeline* timeline = app->get_timeline();
  41. // Create splash sequence
  42. float t = timeline->get_position();
  43. timeline::sequence splash_sequence =
  44. {
  45. {t + 0.0f, fade_in},
  46. {t + 3.0f, fade_out},
  47. {t + 8.0f, change_state}
  48. };
  49. // Add splash sequence to timeline
  50. timeline->add_sequence(splash_sequence);
  51. logger->pop_task(EXIT_SUCCESS);
  52. }
  53. void exit_splash_state(application* app)
  54. {
  55. logger* logger = app->get_logger();
  56. logger->push_task("Exiting splash state");
  57. logger->pop_task(EXIT_SUCCESS);
  58. }