blob: a8ed08784947404e451e46532881a12e8831b2aa (
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
|
#include "GUIPieChart.hpp"
#include "openvic-extension/utility/ClassBindings.hpp"
using namespace godot;
using namespace OpenVic;
using namespace OpenVic::Utilities::literals;
void GUIPieChart::_bind_methods() {
OV_BIND_METHOD(GUIPieChart::get_gfx_pie_chart_texture);
OV_BIND_METHOD(GUIPieChart::set_gfx_pie_chart_name, { "gfx_pie_chart_name" });
OV_BIND_METHOD(GUIPieChart::get_gfx_pie_chart_name);
OV_BIND_METHOD(GUIPieChart::set_slices_array, { "new_slices" });
}
Error GUIPieChart::set_gfx_pie_chart(GFX::PieChart const* gfx_pie_chart) {
const bool needs_setting = gfx_pie_chart_texture.is_null();
if (needs_setting) {
gfx_pie_chart_texture.instantiate();
ERR_FAIL_NULL_V(gfx_pie_chart_texture, FAILED);
}
const Error err = gfx_pie_chart_texture->set_gfx_pie_chart(gfx_pie_chart);
if (needs_setting) {
set_texture(gfx_pie_chart_texture);
}
return err;
}
Ref<GFXPieChartTexture> GUIPieChart::get_gfx_pie_chart_texture() const {
ERR_FAIL_NULL_V(gfx_pie_chart_texture, nullptr);
return gfx_pie_chart_texture;
}
Error GUIPieChart::set_gfx_pie_chart_name(String const& gfx_pie_chart_name) {
const bool needs_setting = gfx_pie_chart_texture.is_null();
if (needs_setting) {
gfx_pie_chart_texture.instantiate();
ERR_FAIL_NULL_V(gfx_pie_chart_texture, FAILED);
}
const Error err = gfx_pie_chart_texture->set_gfx_pie_chart_name(gfx_pie_chart_name);
if (needs_setting) {
set_texture(gfx_pie_chart_texture);
}
return err;
}
String GUIPieChart::get_gfx_pie_chart_name() const {
ERR_FAIL_NULL_V(gfx_pie_chart_texture, {});
return gfx_pie_chart_texture->get_gfx_pie_chart_name();
}
Error GUIPieChart::set_slices_array(GFXPieChartTexture::godot_pie_chart_data_t const& new_slices) const {
ERR_FAIL_NULL_V(gfx_pie_chart_texture, FAILED);
return gfx_pie_chart_texture->set_slices_array(new_slices);
}
|