Circle Button ?

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

traibuidoi
Just popping in
Just popping in
Posts: 13
Joined: Tue Aug 05, 2008 08:31

Circle Button ?

Postby traibuidoi » Wed Aug 20, 2008 09:32

Everything in CEGUI base on rectangle

But I want to create a circle button in my game . How could i do that ?

Maybe should i change button skin to a circle ?

But it isn't real circle because user can click the outside of circle but inside the button's rectangle and my button will response :(

To create un-rectangle shape like circle,heart ,ect .. what should i do ?

Another question : i want to make a scrollpane without srollbar . I found scrollcontainer class but when i looked in Falagard_System_base_widgets :http://www.cegui.org.uk/wiki/index.php/Falagard_System_base_widgets_reference . It isn't here !!!! :(
What should i do ?

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Wed Aug 20, 2008 11:09

Hi,

it is not possible to create non-rectangular windows, sorry...

About your scrollable pane withouth scrollbars (if you're still interested ;))

You can query the scrollbars and hide them, for example:

Code: Select all

scrollablePane->getVertScrollbar()->setVisible(false);
scrollablePane->getHorzScrollbar()->setVisible(false);


HTH.
Check out my released snake game using Cegui!

traibuidoi
Just popping in
Just popping in
Posts: 13
Joined: Tue Aug 05, 2008 08:31

Postby traibuidoi » Thu Aug 21, 2008 02:58

scriptkid wrote:Hi,

it is not possible to create non-rectangular windows, sorry...

About your scrollable pane withouth scrollbars (if you're still interested ;))

You can query the scrollbars and hide them, for example:

Code: Select all

scrollablePane->getVertScrollbar()->setVisible(false);
scrollablePane->getHorzScrollbar()->setVisible(false);


HTH.


thank you for your reply . I hope you'll add this features in recent days . Game with rectangled-GUI seem boring , do you think so ? :?

And the scrollpane problem : since i don't use the scrollbar , how can i move the viewport by code ? I've looked the API Scrollpane references , but there's nothing function like setViewport . it has only getViewableArea

Should i inherited your class and make my setViewableArea function ?

daves
Home away from home
Home away from home
Posts: 253
Joined: Thu Feb 02, 2006 20:12

Postby daves » Mon Aug 25, 2008 13:46

There are no circular buttons so to speak. But I do think that it may be possible to emulate a circular button. This does involve creating a button wrapper class that is able to detect a button press and then to return "true" (handled), or "false" not handled depending on whether the user clicks in the circular region or the boundary region (outside of the circle). Along with this making only the circular region visible is quite simple. The idea would be for this wrapper button to let mouse events pass to the parent widget heirarchy if it detects that the mouse event is outside the circle.

Havent tried this, and I think that the only thing that may stand in the way of this working is the "mouse handling logic" as a function of window heirarchy. I know there have been several posts on the fact that CE is looking to do a rewrite on this logic.

The following cegui mouse event handler shows you the basic mechanism for determing where within the rectangular window the mouse event occurs. Once you know this, a little bit of geometry can be applied to determine if this is within the "circle of interest":

Code: Select all

bool ColorChooser::handleCustomColorImageSelection(const CEGUI::EventArgs& e)
   {
      const CEGUI::MouseEventArgs& mouseEventArgs = static_cast<const CEGUI::MouseEventArgs&>(e);
      if(!mSelectingColor)
      {
         return true;
      }
      CEGUI::Window *window = mouseEventArgs.window;
      CEGUI::Point mousePos = mouseEventArgs.position;

      CEGUI::Point mouseWndPos = CEGUI::CoordConverter::screenToWindow(*window, mousePos);

      float xScale = sEnhancedImageSize.d_width/window->getWidth().asAbsolute(window->getParentPixelWidth());
      float yScale = sEnhancedImageSize.d_height/window->getHeight().asAbsolute(window->getParentPixelHeight());
      CEGUI::Vector2 scale(xScale, yScale);
      mouseWndPos *= scale;
   
      setEditableColor(getEnhancedImageColorAtPixel(mouseWndPos));

      return true;

   }


I use this handler in a "color picker" window that allows me to pick a specific pixel within a displayed image.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 18 guests