aboutsummaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
authorJAROWMR <jarorutjes07@gmail.com>2024-12-23 22:37:05 +0100
committerJAROWMR <jarorutjes07@gmail.com>2024-12-23 22:37:05 +0100
commit4cbd236de18446d192dd59d7c7bc4ebb78850e37 (patch)
treeea84c67e6ce8521dc151504c3e560ce0f6064f99 /game
parent225e873c8ac9c4c08720a69b8f2c817d22cf0071 (diff)
added shop scene with background
Diffstat (limited to 'game')
-rw-r--r--game/CMakeLists.txt2
-rw-r--r--game/main.cpp2
-rw-r--r--game/mainmenu/MainMenuConfig.h2
-rw-r--r--game/mainmenu/MainMenuScene.cpp6
-rw-r--r--game/mainmenu/ShopMenuScene.cpp49
-rw-r--r--game/mainmenu/ShopMenuScene.h11
6 files changed, 68 insertions, 4 deletions
diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt
index 4776d03..03bcbb0 100644
--- a/game/CMakeLists.txt
+++ b/game/CMakeLists.txt
@@ -28,6 +28,7 @@ set(SOURCES
mainmenu/ShowScript.cpp
mainmenu/ShowStartScript.cpp
mainmenu/ShowPreviewScript.cpp
+ mainmenu/ShopMenuScene.cpp
)
set(HEADERS
@@ -49,6 +50,7 @@ set(HEADERS
mainmenu/ShowScript.h
mainmenu/ShowStartScript.h
mainmenu/ShowPreviewScript.h
+ mainmenu/ShopMenuScene.h
)
add_executable(main ${SOURCES} ${HEADERS})
diff --git a/game/main.cpp b/game/main.cpp
index 5d3dbaf..62c23be 100644
--- a/game/main.cpp
+++ b/game/main.cpp
@@ -3,11 +3,13 @@
#include "GameScene.h"
#include "mainmenu/MainMenuScene.h"
+#include "mainmenu/ShopMenuScene.h"
using namespace crepe;
int main() {
Engine gameloop;
+ gameloop.add_scene<ShopMenuScene>();
gameloop.add_scene<MainMenuScene>();
gameloop.add_scene<GameScene>();
diff --git a/game/mainmenu/MainMenuConfig.h b/game/mainmenu/MainMenuConfig.h
index 75b81db..38efef2 100644
--- a/game/mainmenu/MainMenuConfig.h
+++ b/game/mainmenu/MainMenuConfig.h
@@ -10,7 +10,7 @@ struct MainMenuConfig {
static constexpr float STARTMAP_OFFSET = 50;
static constexpr crepe::vec2 MENU_OFFSET = {-400,-200};
static constexpr float MENU_BUTTON_SPACING = 10;
- static constexpr crepe::vec2 MENU_OFFSET_BACKGROUND = {0,+200};
+ static constexpr crepe::vec2 MENU_OFFSET_BACKGROUND = {0,200};
// Moving to new scene (Start and Preview)
static constexpr const char* START_SCENE = "scene1";
static constexpr const char* PREVIEW_SCENE = "scene1";
diff --git a/game/mainmenu/MainMenuScene.cpp b/game/mainmenu/MainMenuScene.cpp
index 7a86ba5..85437db 100644
--- a/game/mainmenu/MainMenuScene.cpp
+++ b/game/mainmenu/MainMenuScene.cpp
@@ -22,13 +22,13 @@ void MainMenuScene::load_scene(){
GameObject menu = this->new_object("menu_background","",MainMenuConfig::MENU_OFFSET + MainMenuConfig::MENU_OFFSET_BACKGROUND);
menu.add_component<Sprite>(
- Asset("asset/ui/itemsButtonBlankDark.png"),
+ Asset("asset/ui/background.png"),
Sprite::Data{
.sorting_in_layer = MainMenuConfig::STARTING_SORTING_IN_LAYER+0,
- .size = {300,922},
+ .size = {300,860},
});
menu.add_component<BehaviorScript>().set_script<ShowStartScript>();
-
+
ButtonSubScene button;
vec2 pos = MainMenuConfig::MENU_OFFSET;
diff --git a/game/mainmenu/ShopMenuScene.cpp b/game/mainmenu/ShopMenuScene.cpp
new file mode 100644
index 0000000..f3ca9ce
--- /dev/null
+++ b/game/mainmenu/ShopMenuScene.cpp
@@ -0,0 +1,49 @@
+
+#include "ShopMenuScene.h"
+#include "api/Camera.h"
+#include "MainMenuConfig.h"
+#include "api/Sprite.h"
+
+using namespace crepe;
+using namespace std;
+
+void ShopMenuScene::load_scene(){
+ 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");
+ menu_background.add_component<Sprite>(
+ Asset("asset/ui/background.png"),
+ Sprite::Data{
+ .sorting_in_layer = MainMenuConfig::STARTING_SORTING_IN_LAYER+0,
+ .size = {1100,860},
+ .position_offset {0},
+ });
+ GameObject menu_banner = this->new_object("menu_banner","", {0,-414});
+ menu_banner.add_component<Sprite>(
+ Asset("asset/ui/settings_container/top_middle_setting.png"),
+ Sprite::Data{
+ .sorting_in_layer = MainMenuConfig::STARTING_SORTING_IN_LAYER+1,
+ .size = {1100,88},
+ });
+ menu_banner.add_component<Sprite>(
+ Asset("asset/ui/settings_container/top_2_middle_setting.png"),
+ Sprite::Data{
+ .sorting_in_layer = MainMenuConfig::STARTING_SORTING_IN_LAYER+1,
+ .size = {1100,66},
+ .position_offset {0,77},
+ });
+ menu_banner.add_component<Sprite>(
+ Asset("asset/ui/settings_container/banner_bottom.png"),
+ Sprite::Data{
+ .sorting_in_layer = MainMenuConfig::STARTING_SORTING_IN_LAYER+1,
+ .size = {1100,7},
+ .position_offset {0,113},
+ });
+
+}
+
+string ShopMenuScene::get_name() const { return "shopmenu"; }
diff --git a/game/mainmenu/ShopMenuScene.h b/game/mainmenu/ShopMenuScene.h
new file mode 100644
index 0000000..7178372
--- /dev/null
+++ b/game/mainmenu/ShopMenuScene.h
@@ -0,0 +1,11 @@
+#pragma once
+
+#include <crepe/api/Scene.h>
+#include <string>
+
+class ShopMenuScene : public crepe::Scene {
+public:
+ void load_scene();
+
+ std::string get_name() const;
+};