If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
-
PlayG7SeveN
- Posts: 22
- Joined: Wed Apr 18, 2007 4:17 pm
Post
by PlayG7SeveN »
Code: Select all
GUIWindow* window = env->addWindow(
rect<s32>(150 + cnt, 140 + cnt, 500 + cnt, 330 + cnt),false,
L"OPTIONS");
gui::IGUIListBox* boxx = env->addListBox(core::rect<int>(10,25,220,80), window, 1);
boxx->addItem(L"Direct3D");
boxx->addItem(L"OpenGL");
boxx->addItem(L"Software");
boxx->setSelected(selected);
selected VALUE IS TURNING "0"
WHY IS DOING SUCH ?
-
vitek
- Bug Slayer
- Posts: 3919
- Joined: Mon Jan 16, 2006 10:52 am
- Location: Corvallis, OR
Post
by vitek »
What is the value of selected that you are passing to setSelected()?
-
PlayG7SeveN
- Posts: 22
- Joined: Wed Apr 18, 2007 4:17 pm
Post
by PlayG7SeveN »
Code: Select all
*
*
*
s32 selected(2);
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
if (event.EventType == EET_GUI_EVENT)
{
s32 id = event.GUIEvent.Caller->getID();
IGUIEnvironment* env = device->getGUIEnvironment();
switch(event.GUIEvent.EventType)
{
case EGET_BUTTON_CLICKED:
if (id == 102 and sayi==0)
{
IGUIWindow* window = env->addWindow(rect<s32>(150 + cnt, 140 + cnt, 500 + cnt, 330 + cnt),
false,
L"OPTIONS");
gui::IGUIListBox* boxx = env->addListBox(core::rect<int>(10,25,220,80), window, 1);
boxx->addItem(L"Direct3D");
boxx->addItem(L"OpenGL");
boxx->addItem(L"Software");
boxx->setSelected(selected);
switch(selected)
{
case 0: outDriver = 0; break;
case 1: outDriver = 1 ; break;
case 2: outDriver = 2; break;
}
*
*
*
*
if (id == 120)
{
ofstream myfile;
myfile.open ("options.txt");
myfile <<outDriver;
myfile.close();
device->closeDevice();
return true;
}
*
*
*
*
int main()
{
video::E_DRIVER_TYPE driverType;
driverType = video::EDT_SOFTWARE;
device = createDevice(driverType, core::dimension2d<s32>(550, 412));
if (device == 0)
return 1;
MyEventReceiver receiver;
device->setEventReceiver(&receiver);
*
*
*
*
OPTİONS FILE IN
SELECTED VALUE IS TURNING "s32 selected(2)" LASTING VALUE..
MEMBER ISN'T ABLE TO DO DIFFERENT 2 VALUES....