2018-08-01 16:03:16 +02:00
|
|
|
//
|
|
|
|
// Created by Wouter Groeneveld on 28/07/18.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef GBA_SPRITE_ENGINE_SCRENE_H
|
|
|
|
#define GBA_SPRITE_ENGINE_SCRENE_H
|
|
|
|
|
|
|
|
#include <vector>
|
2018-08-02 16:26:44 +02:00
|
|
|
#include <functional>
|
2018-08-01 16:03:16 +02:00
|
|
|
#include <engine/background/background.h>
|
|
|
|
#include "engine/sprites/sprite.h"
|
2018-08-05 13:35:38 +02:00
|
|
|
#include "engine/palette/palette_manager.h"
|
2018-08-01 16:03:16 +02:00
|
|
|
|
2018-08-02 16:45:44 +02:00
|
|
|
class GBAEngine;
|
|
|
|
|
2018-08-01 16:03:16 +02:00
|
|
|
class Scene {
|
2018-08-02 16:26:44 +02:00
|
|
|
protected:
|
|
|
|
std::unique_ptr<ForegroundPaletteManager> foregroundPalette;
|
|
|
|
std::unique_ptr<BackgroundPaletteManager> backgroundPalette;
|
2018-08-05 13:35:38 +02:00
|
|
|
std::shared_ptr<GBAEngine> engine;
|
2018-08-02 16:26:44 +02:00
|
|
|
|
2018-08-01 16:03:16 +02:00
|
|
|
public:
|
2018-08-02 16:26:44 +02:00
|
|
|
ForegroundPaletteManager* getForegroundPalette() { return foregroundPalette.get(); }
|
|
|
|
BackgroundPaletteManager* getBackgroundPalette() { return backgroundPalette.get(); }
|
2018-08-05 13:47:37 +02:00
|
|
|
|
|
|
|
// WHY raw pointers? they're unwrapped unique_ptrs managed by the scene implementation - will be cleaned up in engine
|
2018-08-01 16:03:16 +02:00
|
|
|
virtual std::vector<Sprite*> sprites() = 0;
|
|
|
|
virtual std::vector<Background*> backgrounds() = 0;
|
2018-08-05 13:47:37 +02:00
|
|
|
|
2018-08-01 16:03:16 +02:00
|
|
|
virtual void load() = 0;
|
2018-08-02 16:26:44 +02:00
|
|
|
virtual void tick(u16 i) = 0;
|
|
|
|
|
2018-08-05 13:35:38 +02:00
|
|
|
void setEngineForSceneSwitching(std::shared_ptr<GBAEngine> engine);
|
2018-08-01 16:03:16 +02:00
|
|
|
|
|
|
|
Scene() { }
|
2018-08-05 13:47:37 +02:00
|
|
|
virtual ~Scene() {
|
2018-08-01 16:03:16 +02:00
|
|
|
// scenes should manage their own resources - use std::unique_ptr
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif //GBA_SPRITE_ENGINE_SCRENE_H
|