demo_level.hpp 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* License Notice:
  2. *
  3. * This program is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 3 of the License, or
  6. * (at your option) any later version.
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. * You should have received a copy of the GNU General Public License
  12. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  13. */
  14. /**
  15. * @file demo_level.hpp
  16. * @author TooOld2Rock'nRoll
  17. * @date 2023/10/03
  18. * @brief A example level for the ArcadeFighter Library.
  19. *
  20. * @todo - substitute ground level for "solid blocks" when we have impact detection implemented.
  21. * @bug player sprite seams on the wrong state when rendering starts.
  22. * @bug loading screen delta_t is being processed wrong, change regime of loop to test!
  23. */
  24. #ifndef _DEMO_LEVEL_HPP_
  25. #define _DEMO_LEVEL_HPP_
  26. /*---- Includes ----*/
  27. #include "graphics/font.hpp"
  28. #include "graphics/sprite2D.hpp"
  29. #include "graphics/text_box.hpp"
  30. #include "level.hpp"
  31. #include "demo_level_background.hpp"
  32. /*---- Class Declaration ----*/
  33. /**
  34. * @brief A example of how a level could be implemented extending the Level class.
  35. * @extends Level
  36. */
  37. class DemoLevel : public Level
  38. {
  39. private:
  40. const unsigned ui_ground_lvl = 0; ///< line in which the players walk and normally wouldn't fall under.
  41. Sprite2D _loading_animation;
  42. DemoLevelBackground *background = nullptr;
  43. Font *font_managore = nullptr;
  44. TextBox sp_textbox;
  45. Audio::MusicFile *soundtrack = nullptr;
  46. Audio::Effect *p_char_walk_step = nullptr;
  47. Audio::Effect *p_char_run_step = nullptr;
  48. Audio::Effect *p_char_land = nullptr;
  49. void _loadResourcesThread_cb ();
  50. void _joinThread ();
  51. void _updateCameraPosition ();
  52. protected:
  53. public:
  54. DemoLevel ();
  55. ~DemoLevel ();
  56. bool setState (level_state_e new_state) override;
  57. void load () override;
  58. static void highPriorityEvents_cb (DemoLevel *obj_this, const EventManager::event_s &ev);
  59. void processEvents (double delta_t) override;
  60. void update (double delta_t) override;
  61. void draw (double delta_t) override;
  62. };//END DemoLevel
  63. #endif //_DEMO_LEVEL_HPP_