Arrows on a image - widget

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
sjcomp
Not too shy to talk
Not too shy to talk
Posts: 30
Joined: Wed Apr 27, 2005 14:59
Contact:

Arrows on a image - widget

Postby sjcomp » Mon Apr 20, 2009 01:03

Hello,

I would like to display an image map with a few arrows on top. I want to move the ends of these arrows with the mouse. Basically I would like to be able to set position and direction of multiple arrows. I can display an image using StaticImage. I can track the mouse presses on the static image. Should I modify the texture of the static image to draw arrows and keep track of the selected tip? Maybe there is an easier way to do that?

Thank you.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Arrows on a image - widget

Postby CrazyEddie » Mon Apr 20, 2009 08:35

Hi,

In the current releases I think updating the source texture is the way to go here, though obviously that can be complicated depending upon your point of view.

It's possible in future releases - from 0.7.0 onwards - that this could be done more easily with just CEGUI, by perhaps create a simple custom widget that would have a collection of the 'arrow' images each which had position and orientation.

So yeah, for now, I think manually updating the texture.

CE.

User avatar
sjcomp
Not too shy to talk
Not too shy to talk
Posts: 30
Joined: Wed Apr 27, 2005 14:59
Contact:

Re: Arrows on a image - widget

Postby sjcomp » Mon Apr 20, 2009 23:57

Thanks, CE. I thought I have seen a widget that allowed selection of the color by clicking on the color plane in the widget, similar to standard color selection dialogs. I can not find it again. Am I imagining things?

Thanks.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Arrows on a image - widget

Postby CrazyEddie » Tue Apr 21, 2009 08:37

I also have a vague recollection of something similar posted here, although a quick search didn't show anything particularly directly useful. I did find posts from people that mentioned their colour selectors (Evak, daves), not sure if their code is available though.

CE.

User avatar
sjcomp
Not too shy to talk
Not too shy to talk
Posts: 30
Joined: Wed Apr 27, 2005 14:59
Contact:

Re: Arrows on a image - widget

Postby sjcomp » Sun Apr 26, 2009 22:31

Hello, a simple question. How do I trap mouse events over a static image? I would like to capture right and left mouse clicks. Ideally I would like to do it the same way as the subscription to button clicks:

Code: Select all

CEGUI::GlobalEventSet::getSingleton().subscribeEvent(
   CEGUI::StaticImage::EventNamespace + "/" + CEGUI::StaticImage::LeftMouseClick,
   CEGUI::Event::Subscriber(&SomethingTodo));


StaticImage is not a class. I see that it is based off the DefautlWindow type, which is GUISheet class, which is Window class. Theoretically I can use:

Code: Select all

CEGUI::GlobalEventSet::getSingleton().subscribeEvent(
   CEGUI::Window::EventNamespace + "/" + CEGUI::Window::EventMouseButtonDown,
   CEGUI::Event::Subscriber(&SomethingTodo));

But that would give me the subscription to all window events... How can I narrow it down to a specific window? Should I simply check the source of event in my subscriber?

Thanks.

User avatar
sjcomp
Not too shy to talk
Not too shy to talk
Posts: 30
Joined: Wed Apr 27, 2005 14:59
Contact:

Re: Arrows on a image - widget

Postby sjcomp » Mon Apr 27, 2009 00:12

When I use CEGUI::Window::EventNamespace then my events for button presses are masked (subscriber to CEGUI::PushButton::EventClicked is not called any more). How can I help that?

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Arrows on a image - widget

Postby CrazyEddie » Mon Apr 27, 2009 09:20

In answer to the part about only caring about one particular subclass, then yes, you should test the source class in your handler.

With regards to the issue about 'higher level' events being inhibited, I can't explain that, since there's nothing in the code that could cause that as far as I know.

CE.

User avatar
sjcomp
Not too shy to talk
Not too shy to talk
Posts: 30
Joined: Wed Apr 27, 2005 14:59
Contact:

Re: Arrows on a image - widget

Postby sjcomp » Tue May 05, 2009 22:36

Thanks CE.

I also noticed that when use global subscription to the ButtonDown events, mouse events stop being processed properly for the top windows. For example when I show a window I have to click on it before the buttons on this window show tooltips when mouse hovers over them. If I click on a button that shows a different gui window everything works fine, but if I click the button that hides current window, then when I show this window again, only the previously pressed button stays focused and clicks anywhere trigger that button. Obviously I'm the one who triggers the events, but the name of the triggered window is not set properly in the EventArgs. If I comment out the global event subscription to the ButtonDown everything works as required, but I do not know when mouse clicks the static image.

Can I somehow specifically subscribe to the button presses on static image?

Thanks.

User avatar
sjcomp
Not too shy to talk
Not too shy to talk
Posts: 30
Joined: Wed Apr 27, 2005 14:59
Contact:

Re: Arrows on a image - widget

Postby sjcomp » Tue May 05, 2009 22:51

I found out that if I subscribe to the events from a particular window then I do not have the issues described above.

Code: Select all

CEGUI::WindowManager::getSingleton().getWindow(MyStaticImageWindowName)->subscribeEvent(
   CEGUI::Window::EventMouseButtonDown,
   CEGUI::Event::Subscriber(&CCeguiGUI::WindowClicked, this));


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 2 guests