aboutsummaryrefslogtreecommitdiff
path: root/game/menus/ButtonSubScene.h
blob: ba6d1f7c378f2291418eebc301ac75539eadafb2 (plain)
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
59
60
61
62
63
64
65
66
67
68
#pragma once

#include <crepe/api/GameObject.h>

#include <string>

namespace crepe {
class Scene;
}

class ButtonSubScene {
public:
	//script enum
	enum class ScriptSelect {
		PREVIEW,
		SHOP,
		MAINMENU,
		NEXT,
		REPLAY,
		NONE,
	};
	//icon enum
	enum class IconSelect {
		SHOP,
		COINS,
		NONE,
	};
	//icon enum
	enum class ButtonSelect {
		BACK,
		NEXT,
		LARGE,
	};
	//data struct
	struct Data {
		const std::string & text = "NODATA";
		const crepe::vec2 & text_offset = {0, 0};
		const float text_width = 200;
		const crepe::vec2 & icon_offset = {0, 0};
		const IconSelect icon_type = IconSelect::NONE;
		const crepe::vec2 & position = {0, 0};
		const ScriptSelect script_type = ScriptSelect::NONE;
		const ButtonSelect button_type = ButtonSelect::LARGE;
		const float scale = 1;
		const bool worldspace = true;
		const bool color_side = true;
		const std::string & tag = "";
		const int sorting_layer_offset = 0;
	};

public:
	void create(crepe::Scene & scn, const Data & data);

private:
	void large_btn_overlay(crepe::GameObject & button_object, const Data & data);
	void back_btn_overlay(crepe::GameObject & button_object, const Data & data);
	void next_btn_overlay(crepe::GameObject & button_object, const Data & data);
	void btn_color_side(
		crepe::GameObject & button_object, const crepe::vec2 & offset, const Data & data
	);
	void btn_text(crepe::GameObject & button_object, const Data & data);
	void set_script(crepe::GameObject & button_object, const Data & data);
	void set_icon(crepe::GameObject & button_object, const Data & data);
	void set_button_overlay(crepe::GameObject & button_object, const Data & data);

private:
	static constexpr crepe::vec2 SIDE_PANEL_OFFSET = {113, 0};
};