Skip to content

Conversation

CryZe
Copy link
Collaborator

@CryZe CryZe commented Apr 1, 2019

Implement horizontal layouts for livesplit-core.

There's a few changes in how they work compared to the original LiveSplit. In the original LiveSplit we simply flipped the logic between the two axes. This doesn't work well in practice though, as text always flows horizontally and it is the main problem when it comes to the layout. Text can't arbitrarily be shaped, and cutting it off (or even abbreviating it) loses valuable information. Therefore the livesplit-core port pursues a different strategy, a more hybrid approach between both layout directions. Essentially the height of the window now similar to how it works in vertical mode, merely influences the resolution of the content. Increasing the height doesn't introduce any additional spacing, the content is just adjusted to fit the height chosen. Instead the width now, similar to how it works in vertical mode, decides on how wide to render the components. If text doesn't fit, it needs to be cut off. But this way now allows the user to widen the window to show more text, while the horizontal mode in the original LiveSplit always showed the same amount of text, as it always chose the same component space width, regardless of the aspect ratio or other influences.

Roadmap:

  • Add basic support for horizontal layouts.
  • Clean up the matrix math.
  • Add constants for "first row" and "second row", as these positions keep reappearing.
    • Document the constants.
    • There also seem to be vertical icon paddings.
  • Lay out the splits horizontally.
  • Change window width when the layout changes.
  • Implement better component width hints. (They should probably use the component space coordinates, e.g. the width of one column is 3 component units).
  • Calculate proper window dimensions when changing between horizontal and vertical (we can probably somehow make it so we choose the new dimensions such that the component space coordinates are the same size as before. New Window Height = Window Height * Two Row Height / Old Layout Height, New Window Width = Layout Width * New Window Height / Two Row Height).
  • Make sure the C API works.
  • Fix up the documentation.
    • Document the "legacy" component space (24 legacy units equals 1 component unit).
  • Implement tests.
    • Single Line Mode for Title Component is probably broken now with the new height.

Resolves #173

@CryZe CryZe added the enhancement An improvement for livesplit-core. label Apr 1, 2019
@CryZe CryZe added the feature A new user visible feature for livesplit-core. label Apr 15, 2019
@CryZe CryZe mentioned this pull request Apr 15, 2019
This commit implements horizontal layouts for livesplit-core. The
horizontal layouts in the original LiveSplit were kind of weird in how
when changing the height of the timer, instead of the font sizes
adjusting, like in vertical mode, there would be a weird, really ugly
gap. Therefore there was essential only one predefined aspect ratio that
would look good. This time though, instead we use kind of a hybrid
approach for horizontal mode. There is now a fixed height for all the
horizontal layouts in component space. It's the two row height that we
also use in vertical mode. By using a fixed height, there never is any
gap. We then distribute the total width to the individual components
based on a preferred width they choose. They don't actually get their
preferred width, it only serves as a factor of how large the components
should be compared to each other. So similar to vertical mode,
horizontal mode now also has a varying width per component. This is
another feature that we did not have before. Is something cut off? Just
make the window wider and you'll give more space to the components,
allowing them to show text and other content, without it being cut off
as much.

Closes LiveSplit#173
@CryZe CryZe force-pushed the horizontal-layouts branch from 1de5458 to 2b36871 Compare April 23, 2019 20:28
@CryZe CryZe marked this pull request as ready for review April 23, 2019 20:29
@CryZe CryZe requested a review from wooferzfg April 23, 2019 20:30
@CryZe CryZe merged commit de1ec0d into LiveSplit:master Apr 23, 2019
@CryZe CryZe added this to the v0.11 milestone Apr 23, 2019
@CryZe CryZe deleted the horizontal-layouts branch April 23, 2019 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement for livesplit-core. feature A new user visible feature for livesplit-core.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Horizontal Layouts
1 participant