1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#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(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;
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"; }
|