From 513df96c53f884d3256e3cbc0a4d0d19a6d8eb6e Mon Sep 17 00:00:00 2001 From: hiker Date: Fri, 17 Apr 2015 09:24:12 +1000 Subject: [PATCH] Fixed font tool (by requesting an old opengl context), increased size and added some constants to change the size easier. --- tools/font_tool/main.cpp | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/tools/font_tool/main.cpp b/tools/font_tool/main.cpp index 7315f74d0..1631ca90b 100644 --- a/tools/font_tool/main.cpp +++ b/tools/font_tool/main.cpp @@ -34,6 +34,9 @@ bool GLContextDebugBit = true; bool GLContextDebugBit = false; #endif +const int WIDTH = 1024; +const int HEIGHT = 768; + const s32 texturesizes[] = {128, 256, 512, 1024, 2048, 4096, 0}; const wchar_t *fileformats[] = { L"bmp", L"ppm", 0 }; // bitmap font formats @@ -339,6 +342,7 @@ void createGUI(IrrlichtDevice* device, CFontTool* fc) { gui::IGUIEnvironment *env = device->getGUIEnvironment(); + //env->getSkin()->setSize((gui::EGUI_DEFAULT_SIZE, 24); // change transparency of skin for (s32 i=0; igetSkin()->setColor((gui::EGUI_DEFAULT_COLOR)i, col); } - IGUIWindow *win = env->addWindow( core::rect(10,10,200,500), false, L"Font Creator"); + IGUIWindow *win = env->addWindow( core::rect(10,HEIGHT/30,WIDTH/4,HEIGHT-100), false, L"Font Creator"); win->getCloseButton()->setVisible(false); - s32 xs=10,xp=xs, yp=30, h=20; + s32 xs=10,xp=xs, yp=HEIGHT/20, h=HEIGHT/30; env->addStaticText(L"Charset", core::rect(xp,yp,50,yp+h),false,false, win); @@ -489,23 +493,35 @@ void createGUI(IrrlichtDevice* device, CFontTool* fc) // font image gui::IGUIImage *img = env->addImage(0, core::position2d(0,0), true,0, MYGUI_IMAGE); - img->setRelativePosition(core::rect(0,20,800,600)); + img->setRelativePosition(core::rect(0,HEIGHT/30,WIDTH,HEIGHT)); // font scrollbar - IGUIScrollBar *scrl= env->addScrollBar(true,core::rect(0,0,800,20),0, MYGUI_CURRENTIMAGE); + IGUIScrollBar *scrl= env->addScrollBar(true,core::rect(0,0,WIDTH,HEIGHT/30),0, MYGUI_CURRENTIMAGE); scrl->setMax(0); scrl->setSmallStep(1); yp += h*3; env->getRootGUIElement()->bringToFront(win); - win->setRelativePosition( core::rect(10,10,200,yp)); + win->setRelativePosition( core::rect(0,HEIGHT/30,200,yp)); } int main(int argc,char **argv) { - IrrlichtDevice* device =createDevice(video::EDT_OPENGL, core::dimension2du(800, 600)); - video::IVideoDriver* driver = device->getVideoDriver(); + SIrrlichtCreationParameters p; + p.DriverType = video::EDT_OPENGL; + p.WindowSize = core::dimension2du(WIDTH, HEIGHT); + p.Bits = 16; + p.Fullscreen = false; + p.Stencilbuffer = false; + p.Vsync = false; + p.EventReceiver = NULL; + p.FileSystem = NULL; + p.ForceLegacyDevice = true; + + IrrlichtDevice *device = createDeviceEx(p); + + video::IVideoDriver* driver = device->getVideoDriver(); scene::ISceneManager* smgr = device->getSceneManager(); gui::IGUIEnvironment *env = device->getGUIEnvironment();