More cleanups, and use Scenes as a Ref<> in Application.

This commit is contained in:
Relintai 2024-01-03 14:04:22 +01:00
parent ee823eab5d
commit c6cdd2fed8
5 changed files with 12 additions and 14 deletions

View File

@ -10,11 +10,11 @@ class GameApplication : public Application {
public:
GameApplication() {
scene = new GameScene();
scene = Ref<Scene>(memnew(GameScene()));
}
~GameApplication() {
delete scene;
scene.unref();
}
};

View File

@ -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);

View File

@ -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!

View File

@ -37,9 +37,7 @@ public:
Application();
virtual ~Application();
Scene *scene;
AppWindow *window;
Ref<Scene> scene;
static Application *get_singleton();

View File

@ -5,7 +5,7 @@
class InputEvent;
class Scene : Reference {
class Scene : public Reference {
SFW_OBJECT(Scene, Reference);
public: