forkserf / forkserf

a continuation of "FreeSerf"

Home Page:https://forkserf.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

idea - allow permanent popup windows, and make them moveable

tlongstretch opened this issue · comments

With the huge screen area available to modern PCs, it seems desireable to allow popups to become permanent fixtures of the game UI. Right now popups are not moveable, changing that is the largest effort

this used to be in one of the projects - they went back to the standard solution, I don't know why

it looks like it wil require an overhaul to the core functionality as the windows are all linked together with parent-child relationships and the code that manages them is full over recursion, overloads, Virtual functions, etc. Messy. I will get to it at some point

I have this nearly complete! You can drag popup windows around and once they are moved from their original spot they "free" the panelbar buttons so more popups can be opened. It works but I need to make it auto-update the popups every so often, and check for bugs with edge cases.
movable_pinnable_popups_prototype

minimap needs a close button, I'm thinking of making the corner a tiny close button, or making right clicking with the mouse pointer over a pinned popup will close it

one issue I ran into is that the game code re-uses a single variable to store the index of whatever building/flag object "the one popup" may refer to, which crashes when you select another building and the pinned popup from the first (ex. castle inventory) tries to update. It should be easy to simply store a pointer to the popup's target object inside the popup class object rather than relying on a single re-used variable

I fixed the "one popup object index per player" issue, but it results in the unexpected behavior of still being able to see popups for the previous player when switching, which is confusing. I am going to force it to close all popups when switching players

next issue is what to do when the game window is resized or zoomed.. either close all popups, close popups that become off screen, of try to automatically move things around to fit

when minimap is pinned, its normal dragging behavior (and matching the viewport's movement) stops working, need to investigate why

when tool priority popup is pinned, and tool prio adjusted, it re-opens 'the one' popup

fixed tool prio, but it looks like most of the popup click actions call re-open of same popup for some reason, need to remove that from all of them and see if there is some case where it is actually needed, as it doesn't seem to be as you can't trigger the action unless the popup is already open, and worst case could just nullptr check it

popup (and viewport) dragging no longer works when zoomed, need to figure out why

ALSO, the minimap is not automatically updating

implemented in v0.6.0. Some limitations:

  • if a popup ever becomes off-screen (from resizing window) it will be closed. Might be possible to have it slide into view but that is a lot of work to code
  • zooming is incompatible with pinned popups right now, it is buggy and rather than try to fix it I want to overhaul the existing zoom code. For now, if pinned popups exist and you zoom they will be closed. If you are already zoomed you cannot move popups