display_effect.hpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // SuperTux
  2. // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
  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_OBJECT_DISPLAY_EFFECT_HPP
  17. #define HEADER_SUPERTUX_OBJECT_DISPLAY_EFFECT_HPP
  18. #include "supertux/game_object.hpp"
  19. #include "scripting/display_effect.hpp"
  20. #include "squirrel/exposed_object.hpp"
  21. class DisplayEffect final : public GameObject,
  22. public ExposedObject<DisplayEffect, scripting::DisplayEffect>
  23. {
  24. public:
  25. DisplayEffect(const std::string& name = "");
  26. ~DisplayEffect() override;
  27. virtual void update(float dt_sec) override;
  28. virtual void draw(DrawingContext& context) override;
  29. virtual bool is_singleton() const override { return true; }
  30. virtual bool is_saveable() const override { return false; }
  31. /** @name Scriptable Methods
  32. @{ */
  33. void fade_out(float fadetime);
  34. void fade_in(float fadetime);
  35. void set_black(bool enabled);
  36. bool is_black() const;
  37. void sixteen_to_nine(float fadetime);
  38. void four_to_three(float fadetime);
  39. /** @} */
  40. private:
  41. enum class FadeType {
  42. NO_FADE, FADE_IN, FADE_OUT
  43. };
  44. private:
  45. FadeType screen_fade;
  46. float screen_fadetime;
  47. float screen_fading;
  48. FadeType border_fade;
  49. float border_fadetime;
  50. float border_fading;
  51. float border_size;
  52. bool black;
  53. bool borders;
  54. private:
  55. DisplayEffect(const DisplayEffect&) = delete;
  56. DisplayEffect& operator=(const DisplayEffect&) = delete;
  57. };
  58. #endif
  59. /* EOF */