sorry for the kinda "ranty" title, but i spend 5 hours now just trying to figure out how the GUI-Layer dimensioning works and came to the conclusion that its either totally screwed up, or totally not documented.
Basically my problem is: things dont show up, as long as I dont give them HUUUUUUGE dimensions. The text that says "Health:" needs dimensions of at least 1000*1000 or it either wont show up at all, or is some blurry vertical line. buttons for some reasons do show up if positioned in the upper left, but dont show up if positioned anywhere else.
Any help? Known issue? Problem with OpenGL? Any Workarounds? Afaik theres no trivial way to include SFML for the 2d layer, is there?
Heres my code, simply trying to render a static text and some buttons.
Code: Select all
#include "MainClass.h"
#include <irrlicht.h>
#include "UIElement.h"
#include "MastEventReceiver.h"
#include <vector>
#include <thread>
#include <chrono>
#include <iostream>
#include <string>
#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
//#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
using namespace std;
IrrlichtDevice *device;
IVideoDriver* driver;
ISceneManager* smgr;
IGUIEnvironment* guienv;
//Event Handler
MastEventReceiver receiver;
//GuiElemente
IGUIStaticText* healthtext;
int main() {
//Setup Device
//Renderer, Size, fullscreen, stencil, vsync, event receiver
device = createDevice(video::EDT_OPENGL, dimension2d<u32>(1920, 1080), 32, true, false, true, &receiver);
if (!device) {
return 1;
}
receiver.init();
//Setup Window
device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");
driver = device->getVideoDriver();
smgr = device->getSceneManager();
guienv = device->getGUIEnvironment();
//TODO::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//Setupgui
IGUISkin* skin = guienv->getSkin();
IGUIFont* font = guienv->getFont("res/fonthaettenschweiler.bmp");
if (font)
skin->setFont(font);
skin->setFont(guienv->getBuiltInFont(), EGDF_TOOLTIP);
healthtext = guienv->addStaticText(L"Health:", rect<s32>(800, 900, 400, 400));
healthtext->setOverrideColor(SColor(255, 0, 255, 50));
healthtext->enableOverrideColor(true);
healthtext->setEnabled(true);
guienv->addButton(rect<s32>(600, 10, 100, 100));
guienv->addButton(rect<s32>(1080 - 110, 620, 100, 100));
guienv->addButton(rect<s32>(1080 - 110, 740, 100, 100));
guienv->addButton(rect<s32>(1080 - 110, 860, 100, 100));
guienv->addButton(rect<s32>(1080 - 110, 980, 100, 100));
while (device->run()) {
driver->beginScene(true, true, SColor(255, 0, 0, 0));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
}