aboutsummaryrefslogtreecommitdiff
path: root/extension/src/openvic-extension/classes/GFXPieChartTexture.hpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-08-29 00:16:24 +0200
committer hop311 <hop3114@gmail.com>2024-08-29 23:04:30 +0200
commitbdc2ba527bc02e7cdf977f6040f2ca85aa4f9a94 (patch)
tree4627ad955ac60f5c66b94dfc3106bd8442b58302 /extension/src/openvic-extension/classes/GFXPieChartTexture.hpp
parent88acb31bd43f0e163522837bb1d0dd7da2977c4a (diff)
Add tooltips for buttons, labels, icons, pie charts, sliders, and progress barstooltip
Diffstat (limited to 'extension/src/openvic-extension/classes/GFXPieChartTexture.hpp')
-rw-r--r--extension/src/openvic-extension/classes/GFXPieChartTexture.hpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/extension/src/openvic-extension/classes/GFXPieChartTexture.hpp b/extension/src/openvic-extension/classes/GFXPieChartTexture.hpp
index 9642f4e..3610efb 100644
--- a/extension/src/openvic-extension/classes/GFXPieChartTexture.hpp
+++ b/extension/src/openvic-extension/classes/GFXPieChartTexture.hpp
@@ -10,11 +10,17 @@ namespace OpenVic {
class GFXPieChartTexture : public godot::ImageTexture {
GDCLASS(GFXPieChartTexture, godot::ImageTexture)
- using slice_t = std::pair<godot::Color, float>;
+ public:
+ struct slice_t {
+ godot::String name;
+ godot::Color colour;
+ float weight;
+ };
+ private:
GFX::PieChart const* PROPERTY(gfx_pie_chart);
std::vector<slice_t> slices;
- float total_weight;
+ float PROPERTY(total_weight);
godot::Ref<godot::Image> pie_chart_image;
static godot::StringName const& _slice_identifier_key();
@@ -29,6 +35,9 @@ namespace OpenVic {
public:
GFXPieChartTexture();
+ // Position must be centred and normalised so that coords are in [-1, 1].
+ slice_t const* get_slice(godot::Vector2 const& position) const;
+
using godot_pie_chart_data_t = godot::TypedArray<godot::Dictionary>;
/* Set slices given an Array of Dictionaries, each with the following key-value entries: