aboutsummaryrefslogtreecommitdiff
path: root/extension/src/openvic-extension/classes/GUIMaskedFlag.cpp
blob: 968cebbb8078800f6490cac55334e870ed08363b (plain) (blame)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include "GUIMaskedFlag.hpp"

#include "openvic-extension/utility/ClassBindings.hpp"

using namespace godot;
using namespace OpenVic;

void GUIMaskedFlag::_bind_methods() {
   OV_BIND_METHOD(GUIMaskedFlag::get_gfx_masked_flag_texture);

   OV_BIND_METHOD(GUIMaskedFlag::set_gfx_masked_flag_name, { "gfx_masked_flag_name" });
   OV_BIND_METHOD(GUIMaskedFlag::get_gfx_masked_flag_name);

   OV_BIND_METHOD(GUIMaskedFlag::set_flag_country_name_and_type, { "flag_country_name", "flag_type" });
   OV_BIND_METHOD(GUIMaskedFlag::set_flag_country_name, { "flag_country_name" });
   OV_BIND_METHOD(GUIMaskedFlag::get_flag_country_name);
   OV_BIND_METHOD(GUIMaskedFlag::get_flag_type);
}

Error GUIMaskedFlag::set_gfx_masked_flag(GFX::MaskedFlag const* gfx_masked_flag) {
   const bool needs_setting = gfx_masked_flag_texture.is_null();

   if (needs_setting) {
      gfx_masked_flag_texture.instantiate();
      ERR_FAIL_NULL_V(gfx_masked_flag_texture, FAILED);
   }

   const Error err = gfx_masked_flag_texture->set_gfx_masked_flag(gfx_masked_flag);

   if (needs_setting) {
      set_texture(gfx_masked_flag_texture);
   }

   return err;
}

Ref<GFXMaskedFlagTexture> GUIMaskedFlag::get_gfx_masked_flag_texture() const {
   ERR_FAIL_NULL_V(gfx_masked_flag_texture, nullptr);

   return gfx_masked_flag_texture;
}

Error GUIMaskedFlag::set_gfx_masked_flag_name(String const& gfx_masked_flag_name) {
   const bool needs_setting = gfx_masked_flag_texture.is_null();

   if (needs_setting) {
      gfx_masked_flag_texture.instantiate();
      ERR_FAIL_NULL_V(gfx_masked_flag_texture, FAILED);
   }

   const Error err = gfx_masked_flag_texture->set_gfx_masked_flag_name(gfx_masked_flag_name);

   if (needs_setting) {
      set_texture(gfx_masked_flag_texture);
   }

   return err;
}

String GUIMaskedFlag::get_gfx_masked_flag_name() const {
   ERR_FAIL_NULL_V(gfx_masked_flag_texture, {});

   return gfx_masked_flag_texture->get_gfx_masked_flag_name();
}

Error GUIMaskedFlag::set_flag_country_name_and_type(String const& flag_country_name, StringName const& flag_type) const {
   ERR_FAIL_NULL_V(gfx_masked_flag_texture, FAILED);

   return gfx_masked_flag_texture->set_flag_country_name_and_type(flag_country_name, flag_type);
}

Error GUIMaskedFlag::set_flag_country_name(String const& flag_country_name) const {
   ERR_FAIL_NULL_V(gfx_masked_flag_texture, FAILED);

   return gfx_masked_flag_texture->set_flag_country_name(flag_country_name);
}

String GUIMaskedFlag::get_flag_country_name() const {
   ERR_FAIL_NULL_V(gfx_masked_flag_texture, {});

   return gfx_masked_flag_texture->get_flag_country_name();
}

String GUIMaskedFlag::get_flag_type() const {
   ERR_FAIL_NULL_V(gfx_masked_flag_texture, {});

   return gfx_masked_flag_texture->get_flag_type();
}