levelset_screen.hpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // SuperTux
  2. // Copyright (C) 2014 Ingo Ruhnke <grumbel@gmail.com>
  3. //
  4. // This program is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License
  15. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. #ifndef HEADER_SUPERTUX_SUPERTUX_LEVELSET_SCREEN_HPP
  17. #define HEADER_SUPERTUX_SUPERTUX_LEVELSET_SCREEN_HPP
  18. #include <optional>
  19. #include <string>
  20. #include "math/vector.hpp"
  21. #include "supertux/screen.hpp"
  22. #include "util/currenton.hpp"
  23. class Savegame;
  24. class LevelsetScreen final : public Screen,
  25. public Currenton<LevelsetScreen>
  26. {
  27. private:
  28. std::string m_basedir;
  29. std::string m_level_filename;
  30. Savegame& m_savegame;
  31. bool m_level_started;
  32. bool m_solved;
  33. public:
  34. LevelsetScreen(const std::string& basedir, const std::string& level_filename, Savegame& savegame,
  35. const std::optional<std::pair<std::string, Vector>>& start_pos);
  36. virtual void draw(Compositor& compositor) override;
  37. virtual void update(float dt_sec, const Controller& controller) override;
  38. virtual void setup() override;
  39. virtual void leave() override;
  40. virtual IntegrationStatus get_status() const override;
  41. void finished_level(bool win);
  42. private:
  43. std::optional<std::pair<std::string, Vector>> m_start_pos;
  44. LevelsetScreen(const LevelsetScreen&) = delete;
  45. LevelsetScreen& operator=(const LevelsetScreen&) = delete;
  46. };
  47. #endif
  48. /* EOF */