Giter Site home page Giter Site logo

gui.lua's People

Contributors

lewark avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

ott0s

gui.lua's Issues

Add more widgets

If possible, I'd like to add the following widgets:

  • BoxContainer
  • GridContainer
  • ScrollContainer
  • TabContainer
  • CheckBox
  • ComboBox
  • Image
  • MenuBar
  • ProgressBar
  • Slider
  • TextArea (unfinished)

Parameters not validated

Parameters to method calls are not checked for correct type, resulting in confusing situations as seen in #1. Adding calls to cc.expect in each API method validating the parameters would resolve this issue.

Also, because this module contains classes, it might be good to add an expectClass function that checks using Object:instanceof.

Missing documentation

Currently, little documentation is provided on the API beyond the demo.lua script. It would be helpful to document the behavior and parameters of each method, especially for complicated methods like LinearContainer:addChild.

Imposible to create gui

I wrote a gui, just to try if I can create an installer. But every time I got an error gui.lua:291: attempt to index local 'child' (a nil value)
I can not fix this, because I am not so good at lua. But your code demo.lua works. Help, please.
Here is the code:

local gui = require('gui')

local root = gui.Root:new()

local box = gui.LinearContainer:new(root,2,1,1)
--local box2 = gui.LinearContainer:new(root,1,0,0)

local lbl = gui.Label:new(root,"Hello!")
local btn1 = gui.Button:new(root,"Button 1")
local btn2 = gui.Button:new(root,"Button 2")
local btn3 = gui.Button:new(root,"Big Btn.")
--local field = gui.TextField:new(root,5,"TextField")
--local area = gui.ListBox:new(root,10,10,{})
--local sb = gui.ScrollBar:new(root,area)

--for i=1,64 do
--    table.insert(area.items,"Item "..tostring(i))
--end
btn1.enabled = false

function btn1:onPressed()
    lbl.text = "Pressed"
    root:onLayout() -- redraw entire screen
end
function btn2:onPressed()
    btn1.enabled = true
    btn1.dirty = true
end

--root:addChild(box2)

--box2:addChild(area,true,true,gui.LinearAlign.START)
--box2:addChild(sb,false,true,gui.LinearAlign.START)
--box2:addChild(box,false,true,gui.LinearAlign.START)

box:addChild(lbl,false,false,gui.LinearAlign.START)
box:addChild(btn1,false,false,gui.LinearAlign.START)
box:addChild(btn2,false,false,gui.LinearAlign.START)
box:addChild(field,false,true,gui.LinearAlign.START)
box:addChild(btn3,true,true,gui.LinearAlign.START)

root:mainLoop()

Documentation improvements

Documentation generator should search directories recursively.
It might also be good to move the script to a separate repository.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.