New GUI skin [update: new skins, support for 1.5/1.6]

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

Klasker wrote:It was made for Irrlicht 1.3. Maybe something changed in the API for Irrlicht 1.3.1...
Yes, skins can now have fonts for different occasions, getting it working for 1.3.1 is pretty easy-


Lines 63-70 in CImageGUISkin.cpp

Code: Select all

IGUIFont* CImageGUISkin::getFont(EGUI_DEFAULT_FONT which)
{
    return FallbackSkin->getFont(which);
}

void CImageGUISkin::setFont(IGUIFont* font, EGUI_DEFAULT_FONT which)
{
    FallbackSkin->setFont(font, which);
}
and if you're using svn (with the fix for opengl ITexture getOriginalSize/getSize), replace line 221:

Code: Select all

core::dimension2di tsize = elem.Texture->getOriginalSize();
and the header (63-67)

Code: Select all

    //! returns the default font
    virtual IGUIFont* getFont(EGUI_DEFAULT_FONT which=EGDF_DEFAULT);

    //! sets a default font
    virtual void setFont(IGUIFont* font, EGUI_DEFAULT_FONT which=EGDF_DEFAULT);
It's a nice looking skin, and works pretty well with the GUI editor too-
Image
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Cleves
Posts: 224
Joined: Mon Sep 08, 2003 6:40 pm

Post by Cleves »

I'm getting this error when trying to use LoadGUISkinFromFile:

Error 1 error LNK2019: unresolved external symbol "struct irr::gui::SImageGUISkinConfig __cdecl irr::LoadGUISkinFromFile(class irr::io::IFileSystem *,class irr::video::IVideoDriver *,class irr::core::string<char,class irr::core::irrAllocator<char> > const &)" (?LoadGUISkinFromFile@irr@@YA?AUSImageGUISkinConfig@gui@1@PAVIFileSystem@io@1@PAVIVideoDriver@video@1@ABV?$string@DV?$irrAllocator@D@core@irr@@@core@1@@Z) referenced in function _main Main.obj

Here is my code:

Code: Select all

include "Main.h"
#include <CGUIProgressBar.h>
#include <CImageGUISkin.h>
#include <SkinLoader.h>


int main()
{
	Device =createDevice(EDT_OPENGL, dimension2d<s32>(800,600), 32,false, false, false, 0);
    //MyEventReceiver Receiver;
	//Device->setEventReceiver(&Receiver);

    Driver = Device->getVideoDriver();
	Smgr = Device->getSceneManager();
	Env = Device->getGUIEnvironment();
	FileSys = Device->getFileSystem();

	SImageGUISkinConfig GuiCfg;
	GuiCfg = LoadGUISkinFromFile(FileSys, Driver, "/ui/guiskin.cfg");
    /*CImageGUISkin* skin = new CImageGUISkin(Driver, Gui->getSkin());
    skin->loadConfig(guicfg);

    gui::IGUIFont* font = Gui->getFont("../ui/fontlucida.png");
    if (font != 0)
        skin->setFont(font);

    Gui->setSkin(skin);

    skin->drop();*/
	

	//Camera = Smgr->addCameraSceneNode(NULL,vector3df(100,100,-500),vector3df(0,0,0),-1);
	//Camera = Smgr->addCameraSceneNodeFPS();
	//Camera->setPosition(vector3df(0,100,-300));

	while(Device->run())
	{

		Driver->beginScene(true, true, SColor(0,0,0,0));

		Smgr->drawAll();
		Env->drawAll();

		Driver->endScene();
	}



	Device->drop();
	

	return 0;
}
Klasker
Posts: 230
Joined: Thu May 20, 2004 8:53 am
Contact:

Post by Klasker »

Did you include the .cpp files in your project? It looks like you didn't.
Cleves
Posts: 224
Joined: Mon Sep 08, 2003 6:40 pm

Post by Cleves »

Klasker wrote:Did you include the .cpp files in your project? It looks like you didn't.
Bah, stupid me. Thanks.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Hey I am getting strange scaling of textures when I run the binary, it is like the texture is smaller than the mask and it is repeated again. It looks very weird especially on the progress bar.

I am using windows xp with an ATI radeon 200M.

Just to make sure Im saying I havent compiled it yet, this just happens when I run the demo. Could it be related to npot support?
Klasker
Posts: 230
Joined: Thu May 20, 2004 8:53 am
Contact:

Post by Klasker »

BlindSide wrote:Hey I am getting strange scaling of textures when I run the binary, it is like the texture is smaller than the mask and it is repeated again. It looks very weird especially on the progress bar.

I am using windows xp with an ATI radeon 200M.

Just to make sure Im saying I havent compiled it yet, this just happens when I run the demo. Could it be related to npot support?
Sounds like an Irrlicht-related issue, but I don't really understand what you mean - maybe a screenshot would help. What is "npot" by the way?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

npot is non-power-of-two. So textures which are not a poer of two are not scaled when supported, but the hardware driver can work with them unaltered.
But yeah, a screenshot could help. Which Irrlicht version do you use?
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

another skin change in svn. draw2DRectangle is now in the skin, so the behaviour of this can be overridden too.
also I'm also gonna you (Klasker) to join the plugins project next time you're on msn
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
kevinlynx
Posts: 24
Joined: Mon Jun 18, 2007 3:45 pm

Post by kevinlynx »

yes, the gui skin is usefull. But why the scene looks dark ? i compiled these codes myself, and i set ambient light fot the scene (pure white ), but the scene is still some dark !

i searched in the forum and i found this post.
Klasker
Posts: 230
Joined: Thu May 20, 2004 8:53 am
Contact:

Post by Klasker »

kevinlynx wrote:yes, the gui skin is usefull. But why the scene looks dark ? i compiled these codes myself, and i set ambient light fot the scene (pure white ), but the scene is still some dark !

i searched in the forum and i found this post.
Light settings do not affect the GUI. If you want the GUI to look brighter, you must open the images in the "ui" folder and change those with an image-editor.
kevinlynx
Posts: 24
Joined: Mon Jun 18, 2007 3:45 pm

Post by kevinlynx »

of cource i did that. i copyed a new image for the button, but the button still looked dark.
take a look at the screenshot:
Image
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

The button is probably half transparent?
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
kevinlynx
Posts: 24
Joined: Mon Jun 18, 2007 3:45 pm

Post by kevinlynx »

The button is probably half transparent
i donot think so because i have seen any code about that .
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Simply try with a light grey background.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

kevinlynx wrote:
The button is probably half transparent
i donot think so because i have seen any code about that .
Umm dude, look at the picture, there are 2 elements overlapping :P

FIXED
Last edited by BlindSide on Sat Aug 04, 2007 11:09 am, edited 1 time in total.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Post Reply