#pragma once #include #include #include #include using namespace charcoal; using namespace charcoal::builtin; class MyPongScene : public Scene { public: MyPongScene(Application& application); void init() override; void use() override {} void unuse() override {} void update(float delta_time, clock_t clock) override; void prerender() override; void render() override; private: float random(); vec2 rand_dir(float radians_low, float radians_high); void reset_ball(); basic::Renderable m_outline_column; basic::Renderable m_outline_row; basic::Renderable m_ball; basic::Renderable m_life; basic::Renderable m_paddle; basic::Batch m_outline_column_batch; basic::Batch m_outline_row_batch; basic::Batch m_ball_batch; basic::Batch m_life_batch; basic::Batch m_paddle_batch; Poseable m_outline_top_pose; Poseable m_outline_bottom_pose; Poseable m_outline_left_pose; Poseable m_outline_right_pose; Poseable m_ball_pose; Poseable m_paddle_left_pose; Poseable m_paddle_right_pose; builtin::Camera2D m_camera; basic::Pipeline m_pipeline; float m_ball_speed; glm::vec2 m_ball_direction; int m_left_lives; int m_right_lives; };