a8c4b05d2f
This commit gets creates the ObjectOriented scene and gets it working. The current test program swaps a triangle from small to large with the 1 and 2 keys on the keyboard. (1 for small and 2 for large). The small triangle is rendered by the simple scene and the large one is rendered by the object oriented one.
45 lines
793 B
C++
45 lines
793 B
C++
#include "MyApplication.h"
|
|
|
|
void MyApplication::init()
|
|
{
|
|
m_simple_scene.init();
|
|
m_object_oriented_scene.init();
|
|
|
|
m_p_current_scene = &m_simple_scene;
|
|
m_p_current_scene->use();
|
|
}
|
|
|
|
void MyApplication::update(float delta_time, clock_t clock)
|
|
{
|
|
if (m_glfw_input_manager.is_key_pressed(GLFW_KEY_1))
|
|
{
|
|
swap_scene(&m_simple_scene);
|
|
}
|
|
else if (m_glfw_input_manager.is_key_pressed(GLFW_KEY_2))
|
|
{
|
|
swap_scene(&m_object_oriented_scene);
|
|
}
|
|
m_p_current_scene->update(delta_time, clock);
|
|
}
|
|
|
|
void MyApplication::render()
|
|
{
|
|
m_p_current_scene->render();
|
|
}
|
|
|
|
void MyApplication::close()
|
|
{
|
|
m_p_current_scene->unuse();
|
|
}
|
|
|
|
void MyApplication::swap_scene(Scene* scene)
|
|
{
|
|
if (m_p_current_scene != scene)
|
|
{
|
|
m_p_current_scene->unuse();
|
|
m_p_current_scene = scene;
|
|
m_p_current_scene->use();
|
|
}
|
|
}
|
|
|