Without properties bar controls:
With properties bar controls:
Note the differences in FPS in the corners.
The drop only occurs when I run it in Direct3D (both 8 and 9). OpenGL doesn't cause the drop to occur at all.
The offending code is posted below. To give you some context, PropertiesControlBase is a dummy GUI element (a class that inherits IGUIElement) whose parent is the "Properties" window you see on the right of my screenshots. I'm using the dummy control so that when I implement a scrollbar later to scroll the properties up and down, the controls clip to the PropertiesControlBase rect, which starts below the window title bar so that the controls don't draw over the window title bar. Also, when I want to remove the properties controls, I can just call remove() on the PropertiesControlBase and it removes all of its children as well. When I comment out the code in this constructor, there's no drop in framerate when I select a control, so I'm positive that these elements are causing the problem.
Code: Select all
PropertiesControlBase::PropertiesControlBase(IGUIEnvironment* env, IGUIElement* parent, const rect<s32>& rct,
IDashEditControlBase* control) : IGUIElement(EGUIET_ELEMENT, env, parent, -1, rct), ctl(control)
{
props = ctl->getProperties();
const s32 xPos = 10;
const s32 yOffset = 8;
const s32 ySubOff = 5;
const s32 ctlSz = 22;
s32 yPos = 0;
env->addStaticText(L"Standard Properties:", rect<s32>(vector2d<s32>(xPos, yPos), dimension2d<s32>(190, ctlSz)),
false, true, this);
yPos += yOffset + ctlSz;
env->addStaticText(L"Name:", rect<s32>(vector2d<s32>(xPos, yPos), dimension2d<s32>(50, ctlSz)),
false, true, this);
ctlName = env->addEditBox(props->name.c_str(), rect<s32>(vector2d<s32>(xPos + 60, yPos), dimension2d<s32>(100, ctlSz)),
true, this, E_NAME);
yPos += yOffset + ctlSz;
env->addStaticText(L"Position:", rect<s32>(vector2d<s32>(xPos, yPos), dimension2d<s32>(100, ctlSz)),
false, true, this);
yPos += ySubOff + ctlSz;
env->addStaticText(L"X:", rect<s32>(vector2d<s32>(xPos + 33, yPos), dimension2d<s32>(30, ctlSz)),
false, true, this);
ctlPosX = env->addSpinBox(stringw(props->rect.UpperLeftCorner.X).c_str(),
rect<s32>(vector2d<s32>(xPos + 60, yPos), dimension2d<s32>(100, ctlSz)),
true, this, E_POS_X);
yPos += ySubOff + ctlSz;
env->addStaticText(L"Y:", rect<s32>(vector2d<s32>(xPos + 33, yPos), dimension2d<s32>(30, ctlSz)),
false, true, this);
ctlPosY = env->addSpinBox(stringw(props->rect.UpperLeftCorner.Y).c_str(),
rect<s32>(vector2d<s32>(xPos + 60, yPos), dimension2d<s32>(100, 20)),
true, this, E_POS_Y);
yPos += yOffset + ctlSz;
env->addStaticText(L"Size:", rect<s32>(vector2d<s32>(xPos, yPos), dimension2d<s32>(100, ctlSz)),
false, true, this);
yPos += ySubOff + ctlSz;
env->addStaticText(L"X:", rect<s32>(vector2d<s32>(xPos + 33, yPos), dimension2d<s32>(30, ctlSz)),
false, true, this);
ctlSzX = env->addSpinBox(stringw(props->rect.getWidth()).c_str(),
rect<s32>(vector2d<s32>(xPos + 60, yPos), dimension2d<s32>(100, ctlSz)),
true, this, E_SZ_X);
yPos += ySubOff + ctlSz;
env->addStaticText(L"Y:", rect<s32>(vector2d<s32>(xPos + 33, yPos), dimension2d<s32>(30, ctlSz)),
false, true, this);
ctlSzY = env->addSpinBox(stringw(props->rect.getHeight()).c_str(),
rect<s32>(vector2d<s32>(xPos + 60, yPos), dimension2d<s32>(100, ctlSz)),
true, this, E_SZ_Y);
ctlPosX->setDecimalPlaces(0);
ctlPosY->setDecimalPlaces(0);
ctlSzX->setDecimalPlaces(0);
ctlSzY->setDecimalPlaces(0);
ctlPosX->setRange(0, (f32)kMaxPosX);
ctlPosY->setRange(0, (f32)kMaxPosY);
ctlSzX->setRange((f32)IDashControlBase::kMinCtlWidth, (f32)kMaxSzX);
ctlSzY->setRange((f32)IDashControlBase::kMinCtlHeight, (f32)kMaxSzY);
}
Based on what I'm seeing, I'd say it's some sort of bug involving the GUI system and D3D, perhaps when there's a decent amount of controls in the GUI environment.
The controls registered with the GUI environment when the problem occurs are as follows (so you can get an idea of how many there are):
- 3 of the VU Meters you see in the edit pane. These are custom elements designed by me.
- 2 IGUIWindow elements (the "Properties" window on the right and the "Packet Data" window on the bottom)
- 1 VUMeterProperties element derived from the PropertiesControlBase class from which the above code was taken. This is a child of the "Properties" window.
- The 13 elements inside the "Properties" window, which as you can see from the code above, are children of the VUMeterProperties element.
Edit: I tested it on a different machine, and the same problem occurred with OpenGL. I don't know what could be causing it.