-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add a tab showing the production summary #145
base: master
Are you sure you want to change the base?
Conversation
Thanks for the contribution Yafc (with its serialization, etc) was made with possible plugins in mind and this is a good candidate for a plugin (as is: It doesn't change much, mostly adding new stuff) It is hard to review what has to be changed because all of the formatting noise (clearly my formatter is configured differently) |
Also, I think instead of automatically reading all the tabs, tabs should be manually added to this summary page. This way you can have multiple summaries, and also there will be no "test" tabs there, and also you can add a multiplier to a page, as in "how much of these is built". Pages have guids, guids should be persistent and can be serialized. |
Also all the calculations should be done on page activation, not on project loading. So, if this page needs all other pages to be solved, it should run these solvers in its own "solve" instead of solving all the pages on a project load. |
I guess so... 😢 I also (tried) to add the different features/fixes/steps in separate commits, to (try to) ease reviewing.
Agreed, this was/is on my to-do list, but I thought this PR is already big enough as it is. (I guess it mainly requires some UI to select pages to be included)
Makes sense, this will be more easy to do when |
By spending another 2 hours on the ImGui to figure it out to solve the issue I found above, I decided not to add the 'manually add tabs to a summary' idea. It will take me loads of time due to my struggle understanding the ImGui class. (I already found this will building this feature, and while I tried to beautify the GUI of the Summary tab). For me I can select the tabs by having them in the tab bar or not and 1 Summary is enough to align inputs and outputs of the different tabs. So for me this PR serves my (personal) purpose. And spending ~a week of my free time on this is enough... (the factory did not grow at all during this time 😞 ) So feel free to accept/deny this PR (I am still willing to fix issues, solve bugs, etc to get it accepted), but feature-wise this is my limit 😉 |
I will keep this pr open, when I'll add basic support for plugins I'll convert it to a plugin |
…not enough production
* Don't use 'weird' output of EncapsulateRect as 'lastRect', but the actual rect of the (old) state * Improve ScrollArea class names to reflect horizontal scrolling as well, including a constructor parameter to enable horizontal scrolling * Renamed some variables * Typos
…r header/title text Note that the horizontal scrollbar is not clickable (ctrl+scroll and keyboard scrolling is working)
Adding a lastContentRect which contains the (correct/out-of-window) size, fixes the contentSize calculation in BuildGui(). I did not see any glich(es) anymore, and the ScrollArea size is set correctly now (showing scrollbars if needed)
It is a bit hackish but it seems to work (after updating the UI to trigger some 'recalculation') Fixes: #2
It is a collection of changes I made for ShadowTheAge#145 to fix various things. In order to make this (big) PR adding the summary view smaller, I moved this (and some other changed) to their own PR, before submitting the PR to add the summary view. List of improvements/fixes: * _Don't use 'weird' output of `EncapsulateRect()` as 'lastRect', but the actual rect of the (old) state_ `EncapsulateRect()` changes the returned rectangle while processing it, causing rendering issues (I forgot the details, it is ages ago) * _Improve ScrollArea class names to reflect horizontal scrolling as well, including a constructor parameter to enable horizontal scrolling_ The ScrollArea is capable of having both vertical and horizontal scrollbars. The horizontal scrollbar is never used, and was not exposed. But the summary view needs it for larger factories or the user needs an ultra, mega, super wide screen 😛 * _Renamed some variables_ For clarification * Typos and some formatting
I tried to reuse the existing UI of YAFC, so I based the whole thing on a
ProjectPageContents
and aProjectPageView
, so it would be recognized and fit into theMainScreen
(tabs) and serialization.The UI of the new 'Summary' tab is ugly, I tried making it nicer, but I found it hard to understand the
ImGui
and its features and how to use them... So I guess this could be improved separately from this PR?I also fixed some issues I found while implementing the Summary tab:
DatGrid
width when header is not used (I found the header useless here)EncapsulateRect
(at least I don't understand the output of this function...) aslastRect
, but the actualrect
of the (old) state. (So theDataGrid
size can be properly propagated to theScrollArea
ScrollArea
naming and exposed the parameters to enable the horizontal scrollbar. (:warning: the horizontal scrollbar is not clickable, off by1.0f
on vertical axis in the click detection, which I was not able to fix...)Related to #123