aboutsummaryrefslogtreecommitdiff
path: root/game/mainmenu/MainMenuScene.cpp
diff options
context:
space:
mode:
authorJAROWMR <jarorutjes07@gmail.com>2024-12-22 00:11:56 +0100
committerJAROWMR <jarorutjes07@gmail.com>2024-12-22 00:11:56 +0100
commit7bcee4f662b20b8e2e7183bb6bd4cb061fa14e12 (patch)
treecb7976922b3cc6070dc9c14d0ffcaea48b3efee6 /game/mainmenu/MainMenuScene.cpp
parent5a2f6a14803885b7c53bab7d43208476d2e1bd5b (diff)
added menu buttons + scene switching
Diffstat (limited to 'game/mainmenu/MainMenuScene.cpp')
-rw-r--r--game/mainmenu/MainMenuScene.cpp42
1 files changed, 40 insertions, 2 deletions
diff --git a/game/mainmenu/MainMenuScene.cpp b/game/mainmenu/MainMenuScene.cpp
index bc8ea86..4067681 100644
--- a/game/mainmenu/MainMenuScene.cpp
+++ b/game/mainmenu/MainMenuScene.cpp
@@ -2,19 +2,57 @@
#include "MainMenuScene.h"
#include "ButtonSubScene.h"
#include "api/Camera.h"
+#include "../StartSubScene.h"
+#include "MainMenuConfig.h"
+#include "api/GameObject.h"
+#include "api/Rigidbody.h"
+#include "api/Sprite.h"
using namespace crepe;
using namespace std;
void MainMenuScene::load_scene(){
- GameObject camera_object = this->new_object("camera");
+ GameObject camera_object = this->new_object(MainMenuConfig::CAMERA_NAME);
camera_object.add_component<Camera>(ivec2(990, 720), vec2(1100, 800),
Camera::Data{
.bg_color = Color::RED,
});
+
+ GameObject menu_background = this->new_object("menu_background","",MainMenuConfig::MENU_OFFSET + MainMenuConfig::MENU_OFFSET_BACKGROUND);
+ menu_background.add_component<Sprite>(
+ Asset("asset/ui/itemsButtonBlankDark.png"),
+ Sprite::Data{
+ .sorting_in_layer = MainMenuConfig::STARTING_SORTING_IN_LAYER+0,
+ .size = {300,922},
+ });
ButtonSubScene button;
- button.create(*this);
+ vec2 pos = MainMenuConfig::MENU_OFFSET;
+
+ //Start btn
+ button.create(*this,ButtonSubScene::Data{
+ .text = "START",
+ .text_size = vec2{200,80},
+ .position = pos,
+ .script = ButtonSubScene::ScriptSelect::START,
+ });
+
+ //Preview btn
+ pos.y += MainMenuConfig::MENU_BUTTON_SPACING + MainMenuConfig::LARGE_OVERLAY_SIZE.y;
+ button.create(*this,ButtonSubScene::Data{
+ .text = "PREVIEW",
+ .text_size = vec2{200,80},
+ .position = pos,
+ .script = ButtonSubScene::ScriptSelect::PREVIEW,
+ });
+
+ //Shop btn
+ // pos.y += MainMenuConfig::MENU_BUTTON_SPACING + MainMenuConfig::LARGE_OVERLAY_SIZE.y;
+ // button.create(*this,"SHOP",vec2{0,0},vec2{200,80},pos);
+
+ //Start of map
+ StartSubScene start;
+ start.create(*this, MainMenuConfig::STARTMAP_OFFSET);
}
string MainMenuScene::get_name() const { return "mainmenu"; }