Hello Guest

Author Topic: Managing UI Z-Index  (Read 3694 times)

LaserDinosaur

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 38
    • View Profile
Managing UI Z-Index
« on: January 12, 2014, 08:14:31 pm »
Hi all

I'm building out the UI for my game uses a lot of windows and icons. Up until now I've been managing the sort-order by manually assigning the position-z, but as the UI gets more complex it's becoming hard to manage (especially since some of the position-z values cannot be known in advance).

In Unity there are some helper methods like "GUI.FocusWindow" and "GUI.BringWindowToFront" - Are there anything equivalent of this in tk2d?

Cheers!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Managing UI Z-Index
« Reply #1 on: January 13, 2014, 10:39:38 am »
Hi,

No there isn't - there isn't a concept of a window in there.
We were developing a "windowing" type system on top of tk2d, which would handle pushes and pops nicely. We never completed it though since Unity 4.3 came out and introduced the sort order stuff. If you want to imply net something similar, I recommend using sort order for most of the UI, and then have a little window manager that pushes and pops stuff by fixed z increments. Every time you push something all the rest of the "Windows" are pushed back by a certain amount in z, and every time you pop it it comes back forward by the same amount. This simplifies stuff greatly.

LaserDinosaur

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: Managing UI Z-Index
« Reply #2 on: January 14, 2014, 04:00:54 am »
Cool, I'll have a go at implementing that. Thanks!