Horizontal Dragging
Posted: 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:
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.
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.