Exemplo n.º 1
0
void CMenuLogin::updateHuds()
{
	_gerHud->clear();

	if(_loadingStage == LS_PERSONAGENS) 
	{
		_gameCore->_barraLoad = new CHudProgressBar(_gerHud->getRootGUIElement(), _gerHud, rect<s32>( 0+100, _gameCore->sHeight-200, _gameCore->sWidth-100, _gameCore->sHeight-100));
		_gameCore->_barraLoad->setProgress(0.00001f);
	}

	if(_loadingStage > LS_COUNT)
	{
		IGUIImage *img =_gerHud->addImage(_gerVideo->getTexture("recursos/huds/bg_login.png"), position2d<s32>(/*112, 84*/0,0));

		Login = _gerHud->addEditBox(L"fantini", rect<s32>(400,700,500,720), true, 0, 10);
		Password = _gerHud->addEditBox(L"wurzelion", rect<s32>(400,730,500,750), true, 0, 20);
		Password->setPasswordBox(true);
		Login->setMax(15);
		Password->setMax(15);

		_gerHud->addButton(rect<s32>(520,700,620,750), 0, 101, L"conectar");
		//IGUIButton *connect;
		//addNewBtn(connect, rect<s32>(550,700,602,752), 0, 101, 0, L"conectar", true, false, H_CONECTAR, H_CONECTAR);
	}

	for (u32 i=0; i<EGDC_COUNT ; ++i)
	{
		SColor col = _gerHud->getSkin()->getColor((EGUI_DEFAULT_COLOR)i);
		col.setAlpha(255);
		_gerHud->getSkin()->setColor((EGUI_DEFAULT_COLOR)i, col);
	}

	_menuFlag[HUDUPDATED] = true;
}
Exemplo n.º 2
0
IImage* createRainbowImage( u32 w, u32 h, u8 transparency, f64 gamma)
{
	// create image
	core::dimension2du size(w,h);

	IImage* img = (IImage*)new CImage(ECF_A8R8G8B8, size);

	if (!img) return 0;

	size = img->getDimension();

	// loop pixels per col
	for (u32 y=0; y<size.Height; y++)
	{
		// calculate rainbow-color
		SColor c = createRainbowColor( y, size.Height, gamma);

		// set transparency
		c.setAlpha(transparency);

		// write one row with same color
		for (u32 x=0; x<size.Width; x++)
		{
			// write rainbow-color
			img->setPixel(x,y,c,false);
		}
	}

	return img;
}
Exemplo n.º 3
0
Universe::Universe(char *serverAddress, char *serverPort)
{
	instance = this;

	strcpy(this->serverAddress, serverAddress);
	strcpy(this->serverPort, serverPort);
	
	render = new Render(1366, 768, true, L"Client");

	guienv = render->device->getGUIEnvironment();

	gui::IGUIFont* font2 = guienv->getFont("res/font.xml");
	guienv->getSkin()->setFont(font2);

	SColor color;

	color = guienv->getSkin()->getColor(EGDC_3D_FACE);
	color.setAlpha(192);
	guienv->getSkin()->setColor(EGDC_3D_FACE, color);
	
	color = guienv->getSkin()->getColor(EGDC_3D_SHADOW);
	color.setAlpha(192);
	guienv->getSkin()->setColor(EGDC_3D_SHADOW, color);
}
Exemplo n.º 4
0
void EventReceiver::showExitConfirmDialog(){
	IGUIEnvironment* env = device->getGUIEnvironment();
	IGUIWindow* window = env->addWindow(
		rect<s32>(224, 200, 800, 390),true, L"Confirm dialog");
	env->addStaticText(L"Do you want to exit the game?",
		rect<s32>(35,50,600,150),
		false, // border?
		false, // wordwrap?
		window);
	for (u32 i=0; i<EGDC_COUNT ; ++i){
		SColor col = env->getSkin()->getColor((EGUI_DEFAULT_COLOR)i);
		col.setAlpha(255);
		env->getSkin()->setColor((EGUI_DEFAULT_COLOR)i, col);
	}
	env->addButton(
		rect<s32>(15, 100, 285, 170), window, EXIT_OK, L"Ok");
	env->addButton(
		rect<s32>(300, 100, 555, 170), window, EXIT_CANCEL, L"Cancel");
}
Exemplo n.º 5
0
MyCharHeaderMsg::MyCharHeaderMsg( ISceneNode* parent,const wchar_t* msg)
{

	irr::core::list<ISceneNode*> msglist=parent->getChildren();
	irr::core::list<ISceneNode*>::Iterator oper;
	for(oper =msglist.begin(); oper !=msglist.end();++oper )
	{
		//又有新msg要显示,把上次的msg都遍历出来,隐藏..
		if((*oper)->getID()==33){
			(*oper)->setVisible(false);
			//oper=msglist.erase(oper);
		}
	}


		SColor color;
		color.setAlpha(255);
		color.setRed(255);
		color.setBlue(250);
		color.setGreen(0);

	char tmp[512];
	GetWindowsDirectory(tmp,511);
	strcat(tmp,"\\fonts\\SIMSUN.TTC");  //SIMSUN.TTC宋体,新宋体         SIMKAI.TTF楷体     \STXIHEI.TTF   Fixedsys

	IGUIFont* font = getIrrUI()->getFont(tmp,18,true,0);
//	IGUIFont* font = getIrrUI()->getDXFont("宋体",true,18,0,500);
	ITextSceneNode* textnode= getIrrSmgr()->addTextSceneNode(font,	
			msg, 
			color,	parent,
			vector3df(0,90,0), //text相对坐标
			33);   //ID



	scene::ISceneNodeAnimator* a = 0;
	//4.5秒删除
	a= getIrrSmgr()->createDeleteAnimator(4500);
	textnode->addAnimator(a);//字体节点删除
	a->drop();
}
    virtual bool OnEvent(const SEvent& event)
    {
        if (event.EventType == EET_GUI_EVENT)
        {
            s32 id = event.GUIEvent.Caller->getID();
            IGUIEnvironment* env = Device->getGUIEnvironment();

            switch(event.GUIEvent.EventType)
            {

            case EGET_SCROLL_BAR_CHANGED:
                if (id == 104)
                {
                    s32 pos = ((IGUIScrollBar*)event.GUIEvent.Caller)->getPos();

                    for (s32 i=0; i<EGDC_COUNT ; ++i)
                    {
                        SColor col = env->getSkin()->getColor((EGUI_DEFAULT_COLOR)i);
                        col.setAlpha(pos);
                        env->getSkin()->setColor((EGUI_DEFAULT_COLOR)i, col);
                    }

                }
                break;

            case EGET_BUTTON_CLICKED:

                if (id == 101)
                {
                    Device->closeDevice();
                    return true;
                }

                if (id == 102)
                {
                    listbox->addItem(L"Window created");
                    cnt += 30;
                    if (cnt > 200)
                        cnt = 0;

                    IGUIWindow* window = env->addWindow(
                        rect<s32>(100 + cnt, 100 + cnt, 300 + cnt, 200 + cnt),
                        false, // modal?
                        L"Test window");

                    env->addStaticText(L"Please close me",
                        rect<s32>(35,35,140,50),
                        true, // border?
                        false, // wordwrap?
                        window);

                    return true;
                }

                if (id == 103)
                {
                    listbox->addItem(L"File open");
                    env->addFileOpenDialog(L"Please choose a file.");
                    return true;
                }

                break;
            case EGET_LISTBOX_CHANGED:
            case EGET_LISTBOX_SELECTED_AGAIN:
                if (id == 120){
                    int sel = lstLang->getSelected();
                    font = fonts[sel * 2];
                    font2 = fonts[sel * 2 + 1];
                    skin->setFont(font);
                    if (sel == 2){
                        ChangeCaption(1);
                    } else {
                        ChangeCaption(0);
                    }
                }
                break;
            }
        }

        return false;
    }
Exemplo n.º 7
0
	virtual bool OnEvent(const SEvent& event)
	{
		if (event.EventType == EET_GUI_EVENT)
		{
			s32 id = event.GUIEvent.Caller->getID();
			IGUIEnvironment* env = Context.device->getGUIEnvironment();

			switch(event.GUIEvent.EventType)
			{

			/*
			If a scrollbar changed its scroll position, and it is
			'our' scrollbar (the one with id GUI_ID_TRANSPARENCY_SCROLL_BAR), then we change
			the transparency of all gui elements. This is a very
			easy task: There is a skin object, in which all color
			settings are stored. We simply go through all colors
			stored in the skin and change their alpha value.
			*/
			case EGET_SCROLL_BAR_CHANGED:
				if (id == GUI_ID_TRANSPARENCY_SCROLL_BAR)
				{
					s32 pos = ((IGUIScrollBar*)event.GUIEvent.Caller)->getPos();
					
					for (u32 i=0; i<EGDC_COUNT ; ++i)
					{
						SColor col = env->getSkin()->getColor((EGUI_DEFAULT_COLOR)i);
						col.setAlpha(pos);
						env->getSkin()->setColor((EGUI_DEFAULT_COLOR)i, col);
					}
					
				}
				break;

			/*
			If a button was clicked, it could be one of 'our'
			three buttons. If it is the first, we shut down the engine.
			If it is the second, we create a little window with some
			text on it. We also add a string to the list box to log
			what happened. And if it is the third button, we create
			a file open dialog, and add also this as string to the list box.
			That's all for the event receiver.
			*/
			case EGET_BUTTON_CLICKED:
				switch(id)
				{
				case GUI_ID_QUIT_BUTTON:
					Context.device->closeDevice();
					return true;

				case GUI_ID_NEW_WINDOW_BUTTON:
					{
					Context.listbox->addItem(L"Window created");
					Context.counter += 30;
					if (Context.counter > 200)
						Context.counter = 0;

					IGUIWindow* window = env->addWindow(
						rect<s32>(100 + Context.counter, 100 + Context.counter, 300 + Context.counter, 200 + Context.counter),
						false, // modal?
						L"Test window");

					env->addStaticText(L"Please close me",
						rect<s32>(35,35,140,50),
						true, // border?
						false, // wordwrap?
						window);
					}
					return true;

				case GUI_ID_FILE_OPEN_BUTTON:
					Context.listbox->addItem(L"File open");
					// There are some options for the file open dialog
					// We set the title, make it a modal window, and make sure
					// that the working directory is restored after the dialog
					// is finished.
					env->addFileOpenDialog(L"Please choose a file.", true, 0, -1, true);
					return true;

				default:
					return false;
				}
				break;

			case EGET_FILE_SELECTED:
				{
					// show the model filename, selected in the file dialog
					IGUIFileOpenDialog* dialog =
						(IGUIFileOpenDialog*)event.GUIEvent.Caller;
					Context.listbox->addItem(dialog->getFileName());
				}
				break;

			default:
				break;
			}
		}

		return false;
	}