ComputerCraft Forums

ComputerCraft => Programs => APIs and Utilities => Topic started by: Pitaya4 on Aug 14, 2021, 05:38 pm

Title: CommonUI V1.1 - Simple UI Framework
Post by: Pitaya4 on Aug 14, 2021, 05:38 pm
I had to make a simple frontend to an API. It was a very cumbersome experience, so I made a little framework for simple UI.

CommonUI Framework

Code Select
-- Download
wget https://raw.githubusercontent.com/DimitarBogdanov/CommonUI/main/commonui.lua commonui.lua

Here are some screenshots of stuff made with CommonUI - all from my OpusOS-inspired operating system:
(https://i.imgur.com/8rtjLTX.png)
(https://i.imgur.com/2TXOYtd.png)

There is documentation over at the GitHub wiki page (https://github.com/DimitarBogdanov/CommonUI/wiki). There is a little tutorial on there as well!

Update log:
Code Select
V.1.1, 21 August 2021 - initial OOP version (beta)
V1.02, 15 August 2021 - added NewLabel() and ClearComponents(). See API for more details
V1.01, 15 August 2021 - added CommonUI.AddAndDrawComponent(). See API for more details
Title: CommonUI V1.02 - Simple UI Framework
Post by: QuickMuffin8782 on Aug 18, 2021, 01:26 am
Nice API! Keep up the good work!
Title: CommonUI V1.02 - Simple UI Framework
Post by: Pitaya4 on Aug 18, 2021, 03:58 pm
Thanks! I've been working on an improved OOP version, as I've been writing my OS. The OOP model is way more suitable for this. I've also touched up some components as well. I'll post in a couple of days, probably.
Title: CommonUI V1.02 - Simple UI Framework
Post by: QuickMuffin8782 on Aug 18, 2021, 10:18 pm
Make sure the updated version is on the post so it's up to date! Let me know if any help is needed!
And you're welcome. :D
Title: CommonUI V1.02 - Simple UI Framework
Post by: 8589 on Aug 19, 2021, 06:45 am
Is there a demo?
Title: CommonUI V1.02 - Simple UI Framework
Post by: QuickMuffin8782 on Aug 20, 2021, 12:17 am
Quote from: 8589 on Aug 19, 2021, 06:45 amIs there a demo?
Yes. On one of the pastebin codes.
Title: CommonUI V1.02 - Simple UI Framework
Post by: 8589 on Aug 20, 2021, 08:34 pm
Either having multiple buttons doesn't seem to work or I'm doing something wrong. https://copy-cat.squiddev.cc/?startup=ZnMuZGVsZXRlKCJ0ZXN0Lmx1YSIpCmlmIHNoZWxsLnJ1bigicGFzdGViaW4gZ2V0IEs3eG1YdWhQIHRlc3QubHVhIikgYW5kIHNoZWxsLnJ1bigidGVzdC5sdWEiKSB0aGVuIGVuZA== (https://copy-cat.squiddev.cc/?startup=ZnMuZGVsZXRlKCJ0ZXN0Lmx1YSIpCmlmIHNoZWxsLnJ1bigicGFzdGViaW4gZ2V0IEs3eG1YdWhQIHRlc3QubHVhIikgYW5kIHNoZWxsLnJ1bigidGVzdC5sdWEiKSB0aGVuIGVuZA==)
Title: CommonUI V1.02 - Simple UI Framework
Post by: Pitaya4 on Aug 21, 2021, 05:50 pm
Quote from: 8589 on Aug 20, 2021, 08:34 pmEither having multiple buttons doesn't seem to work or I'm doing something wrong. https://copy-cat.squiddev.cc/?startup=ZnMuZGVsZXRlKCJ0ZXN0Lmx1YSIpCmlmIHNoZWxsLnJ1bigicGFzdGViaW4gZ2V0IEs3eG1YdWhQIHRlc3QubHVhIikgYW5kIHNoZWxsLnJ1bigidGVzdC5sdWEiKSB0aGVuIGVuZA== (https://copy-cat.squiddev.cc/?startup=ZnMuZGVsZXRlKCJ0ZXN0Lmx1YSIpCmlmIHNoZWxsLnJ1bigicGFzdGViaW4gZ2V0IEs3eG1YdWhQIHRlc3QubHVhIikgYW5kIHNoZWxsLnJ1bigidGVzdC5sdWEiKSB0aGVuIGVuZA==)

Looks like perfectly valid code. I've coded my entire OS in the OOP version of CommonUI, that's pretty polished, I'll upload it shortly.
Title: CommonUI V1.02 - Simple UI Framework
Post by: Pitaya4 on Aug 21, 2021, 06:54 pm
We're switching up to GitHub - here's an experimental version of CommonUI running.
In fact, since it's just the raw file on GitHub, this wget will always be up-to-date:

Code Select
wget https://raw.githubusercontent.com/DimitarBogdanov/CommonUI/main/commonui.lua commonui.lua
There's some wiki pages up over at https://github.com/DimitarBogdanov/CommonUI/wiki if you need help with the OOP version.
Title: CommonUI V1.1 - Simple UI Framework
Post by: QuickMuffin8782 on Aug 22, 2021, 11:33 pm
I'd also suggest on making all UI componets on all computers out there (https://www.usability.gov/how-to-and-tools/methods/user-interface-elements.html) and include CraftOS PC support (https://craftos-pc.cc/), and also for finishing touches, add double buffering.
Title: CommonUI V1.1 - Simple UI Framework
Post by: Pitaya4 on Aug 24, 2021, 01:23 pm
Quote from: QuickMuffin8782 on Aug 22, 2021, 11:33 pmI'd also suggest on making all UI componets on all computers out there (https://www.usability.gov/how-to-and-tools/methods/user-interface-elements.html) and include CraftOS PC support (https://craftos-pc.cc/), and also for finishing touches, add double buffering.


Thank you for your response and the links! Some of the stuff in the usability.gov website is going to be coming to CommonUI, but not all of it. For instance, something like a message box is beyond the scope of the project.

I'll have a look at CraftOS-PC. I've been solely using ccemux for developing CommonUI, as it's the only thing I have available with my limited internet access, so that'll be happening in at least a week or two. Double buffering is a great idea, and might come at some point in the future, if I have enough time to implement and test it. School's coming up, unfortunately that means less time for Minecraft/CC, but yeah.
Title: CommonUI V1.1 - Simple UI Framework
Post by: QuickMuffin8782 on Aug 25, 2021, 10:07 pm
Quote from: Pitaya4 on Aug 24, 2021, 01:23 pm
Quote from: QuickMuffin8782 on Aug 22, 2021, 11:33 pmI'd also suggest on making all UI componets on all computers out there (https://www.usability.gov/how-to-and-tools/methods/user-interface-elements.html) and include CraftOS PC support (https://craftos-pc.cc/), and also for finishing touches, add double buffering.


Thank you for your response and the links! Some of the stuff in the usability.gov website is going to be coming to CommonUI, but not all of it. For instance, something like a message box is beyond the scope of the project.

I'll have a look at CraftOS-PC. I've been solely using ccemux for developing CommonUI, as it's the only thing I have available with my limited internet access, so that'll be happening in at least a week or two. Double buffering is a great idea, and might come at some point in the future, if I have enough time to implement and test it. School's coming up, unfortunately that means less time for Minecraft/CC, but yeah.

No problem! Xelostar's Buffer API can be used for reference on double buffering.