https://github.com/yard1/hoi4-scripted-gui-pie-chart
An example way of how to implement a Scripted GUI pie chart in Hearts of Iron IV.
https://github.com/yard1/hoi4-scripted-gui-pie-chart
hearts-of-iron-4 hearts-of-iron-iv heartsofiron4 modding modding-resources paradox-interactive paradoxgame pie-chart
Last synced: 3 months ago
JSON representation
An example way of how to implement a Scripted GUI pie chart in Hearts of Iron IV.
- Host: GitHub
- URL: https://github.com/yard1/hoi4-scripted-gui-pie-chart
- Owner: Yard1
- Created: 2019-07-05T14:20:14.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-07T23:15:18.000Z (about 5 years ago)
- Last Synced: 2025-01-19T07:23:55.531Z (4 months ago)
- Topics: hearts-of-iron-4, hearts-of-iron-iv, heartsofiron4, modding, modding-resources, paradox-interactive, paradoxgame, pie-chart
- Size: 18.6 KB
- Stars: 10
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HoI4-Scripted-GUI-Pie-Chart
An example way of how to implement a Scripted GUI pie chart in Hearts of Iron 4.
A pie segment iconType equivalent to a 1/100 of the entire pie is created 100 times, each time with a 3.6 degree rotation, creating a full pie in the end. The texture contains frames - and which frame is shown is controlled by a 100 element `pie_chart` array, with each element corresponding to an iconType. The `create_pie_chart` scripted effect is used to create the `pie_chart` array, updating the pie chart. In this example, it is called daily.
The pie chart can be easily resized with `scale` argument in the .gui file. Changing the number of possible colors is also easy - one just needs to add/remove frames from the `gfx/interface/pie_chart_segment.dds` texture, and update the .gfx entry and the `create_pie_chart` scripted effect. This pie chart can be used to represent any values adding up to 100% - in this example, vanilla party popularities are used.
You may overlay a pie chart overlay onto this pie chart, to make it look nicer.
Feel free to use in your mods, but give credits to Yard1 (both in code, with comments; and on your download page).