This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
ebernerd's profile picture

Cobalt UI - a UI library for Cobalt!

Started by ebernerd, 01 July 2016 - 04:03 AM
ebernerd #1
Posted 01 July 2016 - 06:03 AM
COBALT UI

UI made easy


COBALT NOW HAS A DISCORD! https://discord.gg/ZdhMJJ5

If you have not seen Cobalt, the callback manager that is required to use this, check it out here!
To install Cobalt UI, run the Cobalt installer (pastebin run h5h4fm3t) and when asked if you want to install Cobalt UI, press "Y".

No tutorials here! Please check out the extensive documentation for tutorials on this API.

Cobalt UI is a UI library for Cobalt, my callback wrapper for ComputerCraft. You can create awesome looking UI in seconds, with support for:
  • Buttons
  • Radios
  • Checkboxes
  • Panels
  • Text Inputs
  • Texts
Examples:
Spoiler




Using this, you can create responsive, beautiful UI that work on computers, pocket computers, and advanced monitors. Cobalt UI even has support for external "stylesheets", so your main file isn't cluttered with design declarations.

If you have any questions, feel free to leave them here. If you find an issue, please post it in my GitHub issue tracker!
Edited on 25 September 2016 - 07:58 PM
DannySMc #2
Posted 01 July 2016 - 09:05 AM
Hmm, I quite like your implementation of this nice one!! Does it support multiline text boxes?
ebernerd #3
Posted 01 July 2016 - 04:08 PM
Hmm, I quite like your implementation of this nice one!! Does it support multiline text boxes?
Not quite yet. I tried to make inputs fancier but that was a disaster. I'm looking to implement "textareas" and better inputs soon!
DannySMc #4
Posted 01 July 2016 - 05:34 PM
Hmm, I quite like your implementation of this nice one!! Does it support multiline text boxes?
Not quite yet. I tried to make inputs fancier but that was a disaster. I'm looking to implement "textareas" and better inputs soon!

Ahh yes, please do and I shall be using your UI ;)/> I have a basic textbox working, but the amount of code is just not worth it. Wish there was an easier way.
ebernerd #5
Posted 01 July 2016 - 07:06 PM
Take a look at external styling in the wiki. It doesn't reduce the amount of code directly but it keeps it all organised
Mumbai #6
Posted 01 July 2016 - 08:28 PM
YES. This is going to make my programmming MUCH easier.
ebernerd #7
Posted 01 July 2016 - 08:48 PM
Oh my! I've forgotten some crucial information on "cobalt.state" in the docs.

Set an object's "state" to draw when "cobalt.state" is set to it. If no state is set a root panel has the state of "_ALL", and child objects have their parent's state by default.

Will update the docs when I am at a Pc again. Currently on the road.
ebernerd #8
Posted 04 July 2016 - 07:33 PM
I've finally gotten back to a PC. I've updated the Cobalt UI Documentation to include the "state" attribute. You can edit the state attribute through external styling as well, if that's what you need!

More updates to Cobalt and Cobalt UI are coming soon!
ebernerd #9
Posted 07 August 2016 - 05:34 PM
Cobalt-UI has been updated along with Cobalt! Here's the changelog:

ADDITIONS
  • Textareas - multiline inputs
  • Inputs now have full size characters, and can be scrolled forward and back using arrow keys
  • input:disable()
  • input:setText(text)
MODIFICATIONS
  • obj:setMargins(top,right,bottom,left) changed to obj:setMargins(top,left)
REMOVALS
  • Bottom and right margins
BUG FIXES
  • Fixed percentage issues (using percents like 5% or 100% would return unexpected results)
  • Percentages are more precise
  • Standardized how percentages are calculated - some values were being calculated differently (why I don't know.)
Happy coding! If you find any issues, please put them in the github issue tracker!
ebernerd #10
Posted 25 September 2016 - 09:58 PM
Cobalt now has a discord! https://discord.gg/ZdhMJJ5
Sewbacca #11
Posted 02 October 2016 - 11:24 AM
Wow, i am very surprised! You have a really good knowledge about OOP!
It reminds me a bit on Visual Studio, a very complex development environment for C#, an OO-language.
I didn't downloaded it, but it looks very nice!
One aspect, can you automatically call the events?
So:

function cobalt.draw()
–your code
end


that would be fine =).
Nice work guy!
Edited on 02 October 2016 - 09:25 AM
ebernerd #12
Posted 08 October 2016 - 01:08 AM
Wow, i am very surprised! You have a really good knowledge about OOP!
It reminds me a bit on Visual Studio, a very complex development environment for C#, an OO-language.
I didn't downloaded it, but it looks very nice!
One aspect, can you automatically call the events?
So:

function cobalt.draw()
–your code
end


that would be fine =).
Nice work guy!

I dunno what you mean by "automatically call"

cobalt.draw runs once every frame, which is dictated by cobalt.updatespeed. So by default it runs 30 times a second.
Sewbacca #13
Posted 08 October 2016 - 09:52 PM
Oh, sorry, i meant
function cobalt.mousepressed( x, y, button )
–your code
cobalt.ui.mousepressed( x, y, button )
end
but i see, it doesn't make much sense, because.