53 lines
1.1 KiB
C
53 lines
1.1 KiB
C
|
#pragma once
|
||
|
|
||
|
#include <charcoal/Poseable.h>
|
||
|
#include <charcoal/Scene.h>
|
||
|
#include <charcoal-builtin/BuiltinCamera2D.h>
|
||
|
#include <charcoal-builtin/BasicPipeline.h>
|
||
|
|
||
|
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:
|
||
|
basic::Renderable m_outline_column;
|
||
|
basic::Renderable m_outline_row;
|
||
|
basic::Renderable m_ball;
|
||
|
basic::Renderable m_paddle;
|
||
|
|
||
|
basic::Batch m_outline_column_batch;
|
||
|
basic::Batch m_outline_row_batch;
|
||
|
basic::Batch m_ball_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;
|
||
|
};
|