My problem is that my fps label/text doesn't update, and there are some strange numbers all over my other labels.
(i.e no compiling issues)
Pic of the problem:
http://www.postimage.org/image/2nutc7upw/
And le code: (if you have suggestions for improvments code-wise, do tell as my code isn't very good or efficient.)
Code: Select all
int main() {
IrrlichtDevice* device = createDevice(EDT_OPENGL, dimension2d<u32>(width, height), 32, fullscreen, stencilbuffer, vsync, NULL);
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* sceneManager = device->getSceneManager();
IGUIEnvironment* guiEnvironment = device->getGUIEnvironment();
ICameraSceneNode* camera = sceneManager->addCameraSceneNodeFPS();
camera->setFOV(32);
camera->setFarValue(10000);
camera->setNearValue(20);
sceneManager->addSkyBoxSceneNode(
driver->getTexture("Data/Textures/Skybox/up.jpg"),
driver->getTexture("Data/Textures/Skybox/down.jpg"),
driver->getTexture("Data/Textures/Skybox/left.jpg"),
driver->getTexture("Data/Textures/Skybox/right.jpg"),
driver->getTexture("Data/Textures/Skybox/forward.jpg"),
driver->getTexture("Data/Textures/Skybox/back.jpg"));
ISceneNode *cube = sceneManager->addCubeSceneNode();
sceneManager->addSphereSceneNode(5.0f, 16.0f, 0, -1, vector3df(100,30,10));
sceneManager->addLightSceneNode(camera);
camera->setTarget(cube->getAbsolutePosition());
device->getCursorControl()->setVisible(false);
device->setWindowCaption(L"Bajs");
//DEBUG-TEXT START|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
IGUIStaticText* fpsDebug = guiEnvironment->addStaticText(L"", rect<s32>(10, 10, 200, 200), false);
fpsDebug->setOverrideColor(SColor(255, 255, 0, 0));
IGUIStaticText* vsyncDebug = guiEnvironment->addStaticText(L"", rect<s32>(10, 20, 200, 200), false);
vsyncDebug->setOverrideColor(SColor(255, 255, 0, 0));
IGUIStaticText* fullscreenDebug = guiEnvironment->addStaticText(L"", rect<s32>(10, 30, 200, 200), false);
fullscreenDebug->setOverrideColor(SColor(255, 255, 0, 0));
IGUIStaticText* stencilbufferDebug = guiEnvironment->addStaticText(L"", rect<s32>(10, 40, 200, 200), false);
stencilbufferDebug->setOverrideColor(SColor(255, 255, 0, 0));
IGUIStaticText* rendererDebug = guiEnvironment->addStaticText(L"", rect<s32>(10, 50, 200, 200), false);
rendererDebug->setOverrideColor(SColor(255, 255, 0, 0));
IGUIStaticText* driverTypeDebug = guiEnvironment->addStaticText(L"", rect<s32>(10, 60, 200, 200), false);
driverTypeDebug->setOverrideColor(SColor(255, 255, 0, 0));
IGUIStaticText* resolutionDebug = guiEnvironment->addStaticText(L"", rect<s32>(10, 70, 200, 200), false);
resolutionDebug->setOverrideColor(SColor(255, 255, 0, 0));
stringw fullscreenStr = "";
if (fullscreen == false) {
fullscreenStr = "Fullscreen is off";
}
else if (fullscreen == true) {
fullscreenStr = "Fullscreen is on";
}
stringw vsyncStr = "";
if (vsync == false) {
vsyncStr = "V-sync is off";
}
else if (vsync == true) {
vsyncStr = "V-sync is on";
}
stringw stencilbufferStr = "";
if (stencilbuffer == false) {
stencilbufferStr = "Stencilbuffer is off";
}
else if (stencilbuffer == true) {
stencilbufferStr = "Stencilbuffer is on";
}
stringw fpsStr = "";
stringw rendererStr = stringw("");
stringw drivertypeStr = stringw("Drivertype: ");
stringw resolutionStr = stringw("Resolution: ");
stringw aspectratioStr = stringw("");
rendererStr += stringw(driver->getName());
drivertypeStr += stringw(driver->getDriverType());
vsyncStr += stringw(vsync);
fullscreenStr += stringw(fullscreen);
stencilbufferStr += stringw(stencilbuffer);
resolutionStr += stringw(width);
resolutionStr += stringw("x");
resolutionStr += stringw(height);
fpsStr += driver->getFPS();
if (debug == true) {
vsyncDebug->setText(vsyncStr.c_str());
fullscreenDebug->setText(fullscreenStr.c_str());
stencilbufferDebug->setText(stencilbufferStr.c_str());
rendererDebug->setText(rendererStr.c_str());
driverTypeDebug->setText(drivertypeStr.c_str());
resolutionDebug->setText(resolutionStr.c_str());
}
//DEBUG-TEXT SLUT|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||<
while(device->run() && driver) {
driver->beginScene(true, true, SColor(255, 255, 255, 255));
sceneManager->drawAll();
guiEnvironment->drawAll();
if (debug == true) {
fpsDebug->setText(fpsStr.c_str());
}
driver->endScene();
}
device->drop();
return 0;
}p.s, if you have any good input (as in keyboard and mouse-input) code anywhere or a link to it, please do send
