Each scene of a game is a class derived from tbGame::GameScene that manages the objects and some of the logic for the gameplay. The following will get you started with a blank scene, but that is pretty boring so we will spice it up after.
egg_drop_game_scene.h
#ifndef _Example_EggDropGameScene_h_
#define _Example_EggDropGameScene_h_
#include "turtle_brains/tb_game_kit.h"
{
public:
EggDropGameScene(void);
virtual ~EggDropGameScene(void);
protected:
virtual void OnUpdate(
const float deltaTime)
override;
virtual void OnRender(
void)
const override;
virtual void OnOpen(
void)
override;
virtual void OnClose(
void)
override;
private:
};
#endif _Example_EggDropGameScene_h_
egg_drop_game_scene.cpp
#include "egg_drop_game_scene.h"
#include "turtle_brains/tb_application_kit.h"
EggDropGameScene::EggDropGameScene(void)
{
}
EggDropGameScene::~EggDropGameScene(void)
{
}
void EggDropGameScene::OnSimulate(void)
{
}
void EggDropGameScene::OnUpdate(const float deltaTime)
{
if (true == tbApplication::Input::IsKeyPressed(tbApplication::tbKeyEscape))
{
}
}
void EggDropGameScene::OnRender(void) const
{
}
void EggDropGameScene::OnOpen(void)
{
}
void EggDropGameScene::OnClose(void)
{
}
Next Step