Horizontal Dragging

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
arkos
Quite a regular
Quite a regular
Posts: 49
Joined: Thu Apr 27, 2006 21:45

Horizontal Dragging

Postby arkos » Wed Jun 07, 2006 02:21

Hey guys,

I am trying to create an object in my game's HUD that the player can slide back and forth. It will have a custom image on it. Here is my code:

Code: Select all

CEGUI::DragContainer *mDC = (CEGUI::DragContainer *)wmgr.createWindow("DragContainer", "testDrag");
   wmgr.getWindow("HUD")->addChildWindow(mDC);
 
   mDC->setPosition(wmgr.getWindow(hud_power_slider)->getPosition());
   mDC->setWidth(wmgr.getWindow(hud_power_slider)->getWidth());
   mDC->setHeight(wmgr.getWindow(hud_power_slider)->getHeight());
   mDC->addChildWindow(wmgr.getWindow(hud_power_slider));
   wmgr.getWindow(hud_power_slider)->setPosition(CEGUI::Point(0.0,0.0));
   wmgr.getWindow(hud_power_slider)->setWidth(1);
   wmgr.getWindow(hud_power_slider)->setHeight(1);


I basically give the DragContainer the same position and dimension as the StaticImage and then I make the staticImage take up the entire dragContainer space.

Anyways I want the player to only be able to drag the image horizontally. Is there anyway to restrict the drag container in the vertical?

The slider and scrollbar widgets do this but I do not know where to find their code.

User avatar
arkos
Quite a regular
Quite a regular
Posts: 49
Joined: Thu Apr 27, 2006 21:45

Postby arkos » Wed Jun 07, 2006 06:31

I guess what I am going to do is use a SliderThumb widget. It has the functionality that I am looking for, unfortunately I do not understand how to change its image from within code. I figured because it is inherited from PushButton I could use the same code for changing the normal image, but that doesn't work. Can it be done in code, or do I have to change something in the looknfeel file?


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 8 guests