slages / love-imgui

imgui module for the LÖVE game engine
MIT License
318 stars 61 forks source link

Add support for default Float size and dock ratio split #11

Closed Eiyeron closed 7 years ago

Eiyeron commented 7 years ago

Hey.

Inspired by the forum topic, I deicded to add the ability to define the default size of a floating deck and a prototypical way to define what I call the split ratio : the amount of space to allocate to the dock that'll be attached to the container between 0 (no space) and 1 (the whole space), 0.5 being the default behavior.

It allows me to build from scratch a decent-looking UI like this kind (totally not inspired by Unity, hahaha) image

Something I'm thinking is the inability to get informations like placment and docking modes from docks. It'd be interesting to be able to get those infos to save the current UI state, for instance to reproduce it after rebooting the game.

At least, thanks for the work involved in this library, I hope, it can evolve into something more flexible and awesome!

Eiyeron commented 7 years ago

Well, to add more precisions about the "prototypical" way, here's a thing I thought up: Instead of cluttering BeginDock, why not just using two helpers like SetNextDockSplitRatio or SetNextDockFloatingSize? Another idea would be just using the floating size in the ratio calculation instead of passing two ImVec.

I'm waiting for your feedback to determine which solution to choose and to improve the PR. Have a nice day.

ocornut commented 7 years ago

Hi ! Once this is sorted out/designed, would be nice to post your findings/changes in https://github.com/ocornut/imgui/issues/351 for later references (the official implementation will want to look at all desirable features and combine all/most into one impl).

slages commented 7 years ago

Perfect I'll merge it, but yes I totally vote for SetNextDockSplitRatio / SetNextDockFloatingSize methods to be more consistant with the rest of imgui. And about merging them and just using the floating size, I'm clearly leaving the decision to you, if you think it's an improvement don't hesitate to go for it.