Fusion / libui.cr

Crystal-lang bindings for libui
MIT License
176 stars 17 forks source link

OOP approach to libui.cr? #7

Open hanyuone opened 7 years ago

hanyuone commented 7 years ago

Is it a good idea to create objects for each of the "types" in LibUI, to make it easier for a Crystal programmer to use, as opposed to a "functional" style in the Crystal port of controlgallery?

hanyuone commented 7 years ago

@Fusion?

felipetesc commented 6 years ago

Hello there. I found your port and your work great. However I think what Qwerp-Derp suggested to be considerated, OO will make our life to be simplified. As an instance, I am trying to use the lib using an OO approach and I am finding myself in trouble. I'll create a new post to open as an issue, there is the possibility, however, that the problem it's not even related with your bindings, but with Crystal itself. Anyways please don't stop your work, it's awesome! And please, please, please consider OO! Thank You!

refi64 commented 6 years ago

FWIW the maintainer of this repo doesn't seem to have been on GitHub since mid October (opening one issue for Mailspring) and before that since late June. The website linked hasn't been updated in ages, and many of the projects mentioned are now down. I wouldn't expect anything to come out of this repo anytime soon...

hanyuone commented 6 years ago

@kirbyfan64 Should I start a new repository for LibUI?

Fusion commented 6 years ago

Hi, guys.

@Qwerp-Derp and @felipetesc : if you look at this example (https://github.com/Fusion/libui.cr/blob/master/src/examples/objgallery/objgallery.cr) is this not what you are looking for?

@kirbyfan64 : While I understand your concern, please keep in mind that the upstream project's last release is 18 months old and its master branch has been frozen for a year. I will gladly resume work when there is something new to work with 😉

refi64 commented 6 years ago

Well, I wasn't really complaining or anything, but you have to admit it had kind of looked a bit deserted...

Fusion commented 6 years ago

No problem. Actually, I wish the upstream project was active, especially now that there is a hope of Crystal being supported on Windows.

hanyuone commented 6 years ago

@Fusion That's not really what I'm looking for here - the code just looks like a bunch of calls to C functions. There's hardly objects there, except for the main OBJGallery class. When you want to create a new window, instead of doing maybe UI::Window.new, you have to do UI.new_window, and to modify that window you have to do UI.window_set_margined instead of something like Window#set_margined. Same with UI.new_vertical_box, UI.new_horizontal_box, etc.

Overall, my problem with this library is that it doesn't feel like an OOP, Crystal library, it just feels like a thin wrapper around LibUI. Just my 2c.

hanyuone commented 6 years ago

@Fusion Also, do you mean "upstream project" as in the master branch? Because I can see a lot of work being done in utflib-and-attrstr, as it's where andlabs is focused on currently.

Fusion commented 6 years ago

@Qwerp-Derp Yes, lots of rework under the hood in that branch, but nothing new interface-wise. I believe that, when that branch is complete, work on widget interfaces will resume but until then, there isn't much to do.

Fusion commented 6 years ago

Also, it's been so long that I forgot that I had given up in the OO approach early on, to focus on the YAML approach instead. Have you looked into it?

hanyuone commented 6 years ago

@Fusion I have looked into it a little bit, but the syntax is a little overwhelming for me. Still, though, wouldn't an OOP approach still be beneficial for the user, when creating a Crystal app using libui.cr, and yourself, when implementing the YAML system?