|
本帖最后由 zhoujiajun2010 于 2011-3-23 22:07 编辑
osgWidget::Box*createBox1(const std::string&name,osgWidget::Box::BoxType bt)//第二画面按钮盒
{
osgWidget::Box*box1=new osgWidget::Box(name,bt);
osgWidget::Widget*FangDa=new ColorWidget();
osgWidget::Widget*Heart=new ColorWidget();
osgWidget::Widget*Right=new ColorWidget();
osgWidget::Widget*Exit=new ColorWidget();
box1->setOrigin(0,20);
FangDa->setImage("FangDa.png");
FangDa->setName("FangDa");
FangDa->setTexCoord(0.0,0.0,osgWidget::Widget:OWER_LEFT);
FangDa->setTexCoord(1.0,0.0,osgWidget::Widget::LOWER_RIGHT);
FangDa->setTexCoord(1.0,1.0,osgWidget::Widget::UPPER_RIGHT);
FangDa->setTexCoord(0.0,1.0,osgWidget::Widget::UPPER_LEFT);
FangDa->setColor(1.0,1.0,1.0,0.3);
box1->addWidget(FangDa);
//FangDa->setOrigin(100,0);
Heart->setImage("Heart.png");
Heart->setName("Heart");
Heart->setTexCoord(0.0,0.0,osgWidget::Widget::LOWER_LEFT);
Heart->setTexCoord(1.0,0.0,osgWidget::Widget::LOWER_RIGHT);
Heart->setTexCoord(1.0,1.0,osgWidget::Widget::UPPER_RIGHT);
Heart->setTexCoord(0.0,1.0,osgWidget::Widget::UPPER_LEFT);
Heart->setColor(1.0,1.0,1.0,0.3);
box1->addWidget(Heart);
//Heart->setOrigin(100,30);
Right->setImage("Right.png");
Right->setName("Right");
Right->setTexCoord(0.0,0.0,osgWidget::Widget::LOWER_LEFT);
Right->setTexCoord(1.0,0.0,osgWidget::Widget::LOWER_RIGHT);
Right->setTexCoord(1.0,1.0,osgWidget::Widget::UPPER_RIGHT);
Right->setTexCoord(0.0,1.0,osgWidget::Widget::UPPER_LEFT);
Right->setColor(1.0,1.0,1.0,0.3);
box1->addWidget(Right);
//Right->setOrigin(100,60);
Exit->setImage("Exit.png");
Exit->setName("Exit");
Exit->setTexCoord(0.0,0.0,osgWidget::Widget::LOWER_LEFT);
Exit->setTexCoord(1.0,0.0,osgWidget::Widget::LOWER_RIGHT);
Exit->setTexCoord(1.0,1.0,osgWidget::Widget::UPPER_RIGHT);
Exit->setTexCoord(0.0,1.0,osgWidget::Widget::UPPER_LEFT);
Exit->setColor(1.0,1.0,1.0,0.3);
//Exit->setOrigin(1000,10);
box1->addWidget(Exit);
//Exit->setOrigin(100,90);
return box1;
}
请问如何设置Box中的四个按钮的相对位置啊,以上程序的四个按钮是相互挨着的,能否使它们之间有一定的间隔啊,或者移动一定的相对位置,谢谢!!! |
|