diff --git a/src/sj/Game.d b/src/sj/Game.d index b084246..89be4fd 100644 --- a/src/sj/Game.d +++ b/src/sj/Game.d @@ -2,6 +2,8 @@ module sj.Game; import sj.AbstractGame, + sj.LobbyWorld, + sj.ProgramSet, sj.TitleScene; /// @@ -9,12 +11,28 @@ class Game : AbstractGame { public: /// this() { - title_ = new TitleScene; - title_.Initialize(title_); // TODO: specify proper next scene + programs_ = new ProgramSet; + + lobby_ = new LobbyWorld(programs_); + + title_ = new TitleScene(lobby_); + title_.SetupSceneDependency(title_); // TODO: specify proper next scene super(title_); } + ~this() { + title_.destroy(); + + lobby_.destroy(); + + programs_.destroy(); + } + private: + ProgramSet programs_; + + LobbyWorld lobby_; + TitleScene title_; } diff --git a/src/sj/LobbyWorld.d b/src/sj/LobbyWorld.d new file mode 100644 index 0000000..6dfddbc --- /dev/null +++ b/src/sj/LobbyWorld.d @@ -0,0 +1,28 @@ +/// License: MIT +module sj.LobbyWorld; + +import sjplayer.Background; + +import sj.ProgramSet; + +/// +class LobbyWorld { + public: + /// + this(ProgramSet programs) { + background_ = new Background(programs.forPlayers.Get!BackgroundProgram); + } + + /// + void Draw() { + background_.Draw(); + } + + /// + @property Background background() { + return background_; + } + + private: + Background background_; +} diff --git a/src/sj/ProgramSet.d b/src/sj/ProgramSet.d new file mode 100644 index 0000000..97cae71 --- /dev/null +++ b/src/sj/ProgramSet.d @@ -0,0 +1,24 @@ +/// License: MIT +module sj.ProgramSet; + +static import sjplayer = sjplayer.ProgramSet; + +/// +class ProgramSet { + public: + /// + this() { + for_players_ = new sjplayer.ProgramSet; + } + ~this() { + for_players_.destroy(); + } + + /// + @property sjplayer.ProgramSet forPlayers() { + return for_players_; + } + + private: + sjplayer.ProgramSet for_players_; +} diff --git a/src/sj/TitleScene.d b/src/sj/TitleScene.d index e6b4223..b3c8c45 100644 --- a/src/sj/TitleScene.d +++ b/src/sj/TitleScene.d @@ -3,25 +3,35 @@ module sj.TitleScene; import sj.AbstractScene, sj.KeyInput, + sj.LobbyWorld, sj.SceneInterface; /// class TitleScene : AbstractScene { public: /// - this() { + this(LobbyWorld lobby) { + lobby_ = lobby; + + // TODO: test + import gl4d; + lobby_.background.outer_color = vec4(0.8, 0.8, 0.8, 1); + lobby_.background.inner_color = vec4(1, 1, 1, 1); } /// - void Initialize(SceneInterface next_scene) { + void SetupSceneDependency(SceneInterface next_scene) { next_scene_ = next_scene; } override void Update(KeyInput input) { } override void Draw() { + lobby_.Draw(); } private: SceneInterface next_scene_; + + LobbyWorld lobby_; }