CCKit
CCKit copied to clipboard
A UI library for ComputerCraft that is designed similar to UIKit.
CCKit
A UI library for Computercraft that is designed similar to UIKit.
Usage
Copy this entire repository into a folder named CCKit at the root of your ComputerCraft computer. (You can cd to the computer root and git clone the repo.)
Quick Start
- Load the
CCKitapi:
os.loadAPI("CCKit/CCKit.lua")
- Create a main view controller:
function MyViewController()
local vc = CCKit.CCViewController()
return vc
end
- Put the code for the UI after creating
vc:
function vc:viewDidLoad()
local label = CCKit.CCLabel(1, 1, "Text")
self:addSubview(label)
end
- Start the main loop:
CCKit.CCMain(5, 2, 12, 4, "Window", MyViewController, colors.blue, "Application")
Classes
Classes are created with CCKit.<class>(<arguments>) (e.g. CCKit.CCLabel(x, y, text)) if you load the CCKit API.
All methods must be called with a colon and not a period (e.g. textView:setText(text), not textView.setText(text)).
See the wiki for a list of classes.