Page 2 of 2

Posted: Wed Jun 02, 2010 4:18 pm
by full_newbie
This full code:

Code: Select all

#include <irrlicht.h>
#include <iostream>
#include <fstream>
#include <locale>
#include <string>
#include <stdio.h>
typedef int errno_t;

using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
using namespace std;
int main()
{

	IrrlichtDevice * device = createDevice(EDT_OPENGL, core::dimension2d<u32>(1024, 768),32,true);

	if (device == 0)
		return 1; 


	device->setWindowCaption(L"Irrlicht Engine - User Interface Demo");
	device->setResizable(true);

	video::IVideoDriver* driver = device->getVideoDriver();
	IGUIEnvironment* env = device->getGUIEnvironment();


	IGUISkin* skin = env->getSkin();
	IGUIFont* font = env->getFont("media/myfont.xml");
	if (font)
		skin->setFont(font);

	skin->setFont(env->getBuiltInFont(), EGDF_TOOLTIP);
//first variant
wchar_t* fileText = L"FAILED TO LOAD FROM FILE";
   FILE *f;
   f = _wfopen(L"test.dlg", L"rt,ccs=UNICODE");
   if (f)
   {
      wchar_t t[1000];
      fgetws(t, 1000, f);
      fclose(f);
      fileText = t;
   }
env->addStaticText(fileText, rect<s32>(200,200,400,250), true);
//second variant
locale::global(locale(""));
wifstream f("test.dlg", std::wifstream::in);
if (! f.is_open())
        throw 42;
wstring s1;
const wchar_t *load_string;
getline(f, s1);
load_string=s1.c_str();
load_string=(wchar_t*)load_string;
env->addStaticText(load_string, rect<s32>(200,200,400,250), true);
	return 0;
}
This arhiv for font and text file:
http://best-scripts.uz/Release.zip
Image
Please help!!!!

Posted: Thu Jun 03, 2010 7:57 am
by full_newbie
Special sank's greenya for help me.
Theme closed