mirror of
https://github.com/Relintai/sfw.git
synced 2024-11-08 07:52:09 +01:00
More cleanups, and use Scenes as a Ref<> in Application.
This commit is contained in:
parent
ee823eab5d
commit
c6cdd2fed8
@ -10,11 +10,11 @@ class GameApplication : public Application {
|
||||
|
||||
public:
|
||||
GameApplication() {
|
||||
scene = new GameScene();
|
||||
scene = Ref<Scene>(memnew(GameScene()));
|
||||
}
|
||||
|
||||
~GameApplication() {
|
||||
delete scene;
|
||||
scene.unref();
|
||||
}
|
||||
};
|
||||
|
||||
|
14
game_scene.h
14
game_scene.h
@ -3,20 +3,22 @@
|
||||
|
||||
#include "render_core/scene.h"
|
||||
|
||||
#include "render_objects/tile_map.h"
|
||||
#include "render_objects/mesh_instance_3d.h"
|
||||
#include "render_objects/camera_3d.h"
|
||||
#include "render_objects/camera_2d.h"
|
||||
#include "render_core/color_material.h"
|
||||
#include "render_core/colored_material.h"
|
||||
#include "render_core/image.h"
|
||||
#include "render_core/mesh.h"
|
||||
#include "render_objects/sprite.h"
|
||||
#include "render_core/texture.h"
|
||||
#include "render_core/texture_material.h"
|
||||
#include "render_core/texture_material_2d.h"
|
||||
#include "render_core/image.h"
|
||||
#include "render_objects/camera_2d.h"
|
||||
#include "render_objects/camera_3d.h"
|
||||
#include "render_objects/mesh_instance_3d.h"
|
||||
#include "render_objects/sprite.h"
|
||||
#include "render_objects/tile_map.h"
|
||||
|
||||
class GameScene : public Scene {
|
||||
SFW_OBJECT(GameScene, Scene);
|
||||
|
||||
public:
|
||||
virtual void event();
|
||||
virtual void update(float delta);
|
||||
|
@ -77,8 +77,6 @@ Application::Application() {
|
||||
running = true;
|
||||
target_fps = 60;
|
||||
|
||||
scene = NULL;
|
||||
|
||||
frame_delta = 0;
|
||||
|
||||
// TODO Move these to a central place in core!
|
||||
|
@ -37,9 +37,7 @@ public:
|
||||
Application();
|
||||
virtual ~Application();
|
||||
|
||||
Scene *scene;
|
||||
|
||||
AppWindow *window;
|
||||
Ref<Scene> scene;
|
||||
|
||||
static Application *get_singleton();
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
class InputEvent;
|
||||
|
||||
class Scene : Reference {
|
||||
class Scene : public Reference {
|
||||
SFW_OBJECT(Scene, Reference);
|
||||
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user