Changing the order of an image

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Anasky
Not too shy to talk
Not too shy to talk
Posts: 38
Joined: Mon Sep 25, 2017 21:34

Changing the order of an image

Postby Anasky » Sun Nov 12, 2017 16:08

Hey all,

I have several icons displayed on-screen which change their position over time.
I can know through code which one should be above the others, but I don't know how to tell CEGUI which object to show above the rest?
(Like: Icon 10 is first, icon 6 is second, icon 4 is third. And then a few seconds later: Icon 10 is second, icon 6 is third, icon 4 is first.)

User avatar
Ident
CEGUI Team
Posts: 1836
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Changing the order of an image

Postby Ident » Sun Nov 12, 2017 16:45

You will need to change their order in the child array. This is what defines what is drawn on top (and i think you ask for occlusion draw order right?).

You can either remove all child windows and then add them in order or you can simply use the moveToFront and moveToBack functions until you get the order you want :) It might be preferrable to use the functions the window already provides, unless this is inconvenient for you. If you do not change order often, then I would just remove all windows and re-add.
CrazyEddie: "I don't like GUIs"

Anasky
Not too shy to talk
Not too shy to talk
Posts: 38
Joined: Mon Sep 25, 2017 21:34

Re: Changing the order of an image

Postby Anasky » Sun Nov 12, 2017 16:47

I tried doing the remove and re-add method, but that gave issues with multithreading.
I'll try out the moveToFront function, thanks! :D

User avatar
Ident
CEGUI Team
Posts: 1836
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Changing the order of an image

Postby Ident » Sun Nov 12, 2017 16:51

Anasky wrote:I tried doing the remove and re-add method, but that gave issues with multithreading.
I'll try out the moveToFront function, thanks! :D

CEGUI has to run in a single thread. If you still get issues despite having it running in one thread then something must be wrong with how you sync between threads, i dont think it can be related to CEGUI itself in that case.
CrazyEddie: "I don't like GUIs"

Anasky
Not too shy to talk
Not too shy to talk
Posts: 38
Joined: Mon Sep 25, 2017 21:34

Re: Changing the order of an image

Postby Anasky » Sun Nov 12, 2017 17:24

Ident wrote:
Anasky wrote:I tried doing the remove and re-add method, but that gave issues with multithreading.
I'll try out the moveToFront function, thanks! :D

CEGUI has to run in a single thread. If you still get issues despite having it running in one thread then something must be wrong with how you sync between threads, i dont think it can be related to CEGUI itself in that case.


I have my update thread and my render thread separated. This means that when the Update function tells CEGUI to change parents of a window, the RenderThread might be rendering CEGUI at that point in time.
It works fine for everything else, just switching parents has a bit of an issue ^^

But the moveToFront seems to work :)


Return to “Help”

Who is online

Users browsing this forum: No registered users and 1 guest