zIndex of UI items?

  • baizuo
    26th Jan 2013 Member 0 Permalink

    Sample code:

    Sample = {}
    function Sample.StepHandler()
    tpt.fillrect(55, 55, 111, 111, 255, 255, 255, 125)
    end
    function Sample.Init()
    tpt.register_step(Sample.StepHandler)
    local cancelBtn = Button:new(55, 111, 17, 111, "Poor button")
    interface.addComponent(cancelBtn)
    end
    Sample.Init()

     

    The fillrect will always covers the control (a poor button in the example), can I control the render sequence so that I can decide which is on top and which is in the bottom?

  • boxmein
    26th Jan 2013 Former Staff 0 Permalink
    @baizuo (View Post)
    I think lua stuff is always rendered last... I doubt you could.
  • baizuo
    26th Jan 2013 Member 0 Permalink

    @boxmein (View Post)

     I try to do this because I found that event registered by tpt.register_xxx is not updating in window created by
     interface.addComponent, then my first attempt is to add controls to the main window, manually add a "window" for them, but my "window" simply, however, covers all the controls...

    Then how can I do that? I need some controls and too lazy to implement all of them myself, and I need to update the main window at the same time.

     

    Should I simply fill all the empty space in the given area except that there's a control? That looks silly...

  • boxmein
    26th Jan 2013 Former Staff 0 Permalink
    I won't let this thread sink, but I don't sadly know about your issues. I think register_step will run on a new frame and register_somethingelse will run some other time. Don't resort to using while/for loops though. They'll crash the lua engine and TPT along with it. I haven't worked with Interface either.
    What I'd do is just make the visuals with line/text drawing APIs and check for mouse clicks with mousex/y inside the button's boundaries. I'm not that partial to the TPT api.
  • baizuo
    27th Jan 2013 Member 0 Permalink

    Thanks for your help. I think it's time to make my own button.