1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[Thread] for share of small unfinished codelets and ideas

Discussion in 'Script Contributions' started by NeonSturm, May 19, 2015.

  1. NeonSturm

    NeonSturm Back Into Space

    • Member
    I have to use PHP in absence of c++ and LUA syntax-highlighters :/
    But the blue text is bad for the dark forum theme users!

    PHP:
    info =
    name "WidgetPositionTools"
    author "NeonSturm"
    version "0.20150519.1"
    license "WTFPL" -- do What The Fuck you want Public License
    licenseText "http://www.wtfpl.net/"
    description "Adds extended possibilities for widget positioning, including to set a position with origin=centre"
    todo "Write moar LUA, check for syntax errors, ..., +usual stuff"
    }

    --- 
    size constants ---
    local PIXEL 0
    local RELATIVE 
    1
    local PERCENT 
    RELATIVE -- bitwise or with relative

    --- settings ---
    local TOP 1
    local LEFT 
    2
    local POSITION 
    TOP LEFT -- includes top and left
    local CENTRE 
    POSITION -- bitwise or with positionbit 2^4 means origin=centre
    local SIZE_MIN 
    16
    local SIZE_MAX 
    32
    local SIZE 
    SIZE_MIN SIZE_MAX -- both sizes

    --[[ Example usage
        set
    ({ CENTRE = {xyPERCENT} -- or MARGIN_RATIO = {left right}
            , 
    SIZE_MIN = {xyPIXEL}
            , 
    SIZE_MAX = {xyPERCENT}
        })
    --]]

    --- 
    TODOhandler --- NOTE: if each set has a serialrepeated calls task order can be cached ---
    function 
    set(args)
        for 
    k,v in pairs(args) do
            
    local width 0
            local height 
    0
            
    ...

            
    SIZE -- figure size out before calculating position from centre if needed
                
    and (...) -- update minmax size
            
    or MIN
                
    and (...) -- update only min size
            
    or MAX
                
    and (...) -- update only max size
            k 
    CENTRE
                
    and ( )

            
    CENTRE
                
    and (v[0] = v[0] - width/2)
                and (
    v[1] = v[1] - height/2)
            
    POSITION
                
    and (...) -- update top left
            
    or TOP
                
    and (...) -- update only top
            
    or LEFT
                
    and (...) -- update only left


            
    ... -- do actions
        end
    end
    Last edited: May 21, 2015
    NeonSturm, May 19, 2015
    Last edited by NeonSturm; at May 21, 2015
    #1
  2. 10d22

    10d22 Designer

    • Dev Member
    • Moderator
    @PsychoticLeprechaun is working on these issues, dont know when it will be done, but we do know of the problem
    NeonSturm likes this.

Share This Page