vudu icon indicating copy to clipboard operation
vudu copied to clipboard

[WIP] some improvements

Open tpimh opened this issue 1 year ago • 2 comments

This is more of a request for comments on my changes,

  1. I couldn't find a key that would produce a single ` character in LÖVE on my keyboard. It seems that some keyboard layouts have this key before 1, and some don't (source). I simply set the GUI toggle to "scancode" instead of "key", so it the button would be consistent between different keyboard layouts. Also added a note about this to readme.
  2. Add leading zero to the number of elapsed seconds. Just for visual appeal. This can be done better: string.format("%d:%02d", math.floor(vd.timer/60), math.floor(vd.timer%60))
  3. UI is not being resized correctly when window size is changed. It seems that some functions rely on ui.w and ui.h (which is never updated) instead of ui.bounds.w and ui.bounds.h. I just updated the values as a quick workaround, but maybe all references to ui.w and ui.h should be replaced with ui.bounds.w and ui.bounds.h? Or maybe update of these variables needs to be moved to vdui:resize function?
  4. This is just pure hack. If a window is minimized when resize happens, it gets stuck. What I do is:
  • check if window is minimized
  • if it is, toggle minimize
  • resize window normally
  • if it was previously minimized, toggle minimize again Well, it works, but it's definitely a hack, and the code is quite repetitive. Perhaps a this should be a vdwin function? Not really sure what to do about it.

tpimh avatar Oct 31 '24 12:10 tpimh

1, 2, and 3 are awesome. I wrote this code too long ago to give you a solid answer on 3, but what you've done doesn't look insane to me.

4 is probably too hacky. I agree this should be a vdwin function. Given that there can be more than just the current 3 windows, something more general would be better. Could we handle the same behaviour by having resize fire an event that all windows subscribe to? There may be a yet more elegant solution, again I haven't touched this code in years...

deltadaedalus avatar Nov 01 '24 03:11 deltadaedalus

Thanks for your review. I've more or less finalized 1, 2 and 3, and I will need to think about correct implementation of 4.

One more thing that I noticed is the UI breaks if it's resized to extremely small dimensions, so I will probably also clamp w and h to some minimum sane values.

tpimh avatar Nov 01 '24 07:11 tpimh