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

-- 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://camo.tmpim.com/8e84d6279670caa9e5ab7ca3d03e14994f8d5e3a/68747470733a2f2f692e696d6775722e636f6d2f3872746a4c54582e706e67)
(https://camo.tmpim.com/f712659e52745a918d095ab5d2e23e9b27f37496/68747470733a2f2f692e696d6775722e636f6d2f3254584f5974642e706e67)

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:
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:

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.