New GUI skin [update: new skins, support for 1.5/1.6]
Textures have 2 different methods for obtaining sizes. One obtains the original size of the actual image, and the other contains the (possibly) increased size to the nearest power of 2 if the texture was required to be a power of 2.
Something like getDimensions and getOriginalDimensions ? I think the wording was slightly different though... (Checks API)
Something like getDimensions and getOriginalDimensions ? I think the wording was slightly different though... (Checks API)
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
About darker colors - it's true, when i use same texture for skin's window and IGUIImage first looks darker:(
in function
we have those lines: as i see here's a problem, but if we comment this piece we'll lose a transparency. Has somebody any ideas?
p.s. when we change to it works nice for me, but i think there will be a problems not are?
p.p.s. oh, i understood this part of code for my goal it needs to make more switch-cases to draw different elements with right colors ... and parts of elements too like window's corners and caption etc
in function
Code: Select all
void CImageGUISkin::drawElementStyle( const SImageGUIElementStyle& elem, const core::rect<s32>& rect, const core::rect<s32>* clip, video::SColor* pcolor )
Code: Select all
video::SColor faceColor = getColor(EGDC_3D_FACE);
color.setRed( (u8)(color.getRed() * faceColor.getRed() / 255) );
color.setGreen( (u8)(color.getGreen() * faceColor.getGreen() / 255) );
color.setBlue( (u8)(color.getBlue() * faceColor.getBlue() / 255) );
color.setAlpha( (u8)(color.getAlpha() * faceColor.getAlpha() / 255 ) );
p.s. when we change to
Code: Select all
video::SColor faceColor = getColor(EGDC_3D_LIGHT);
p.p.s. oh, i understood this part of code for my goal it needs to make more switch-cases to draw different elements with right colors ... and parts of elements too like window's corners and caption etc
Is there anybody attempt to fix this error? I am using a Intel Q35 Express with Intel GMA 3100 and my system is well new...
Project homepage: http://fosp.wordpress.com/
Project Forum URL: http://forum.gamedev.vn/index.php?showforum=74
Project Google Group: http://groups.google.com/group/fosproject
Engine Project: http://code.google.com/p/fosengine/
Project Forum URL: http://forum.gamedev.vn/index.php?showforum=74
Project Google Group: http://groups.google.com/group/fosproject
Engine Project: http://code.google.com/p/fosengine/
That's it!!! Everything is ok now!Klasker wrote:Try downloading it again. I resized two of the textures to have a power-of-two width. I still think it's a bug in Irrlicht, that it uses coordinates after resizing, instead of remembering its original size.
Project homepage: http://fosp.wordpress.com/
Project Forum URL: http://forum.gamedev.vn/index.php?showforum=74
Project Google Group: http://groups.google.com/group/fosproject
Engine Project: http://code.google.com/p/fosengine/
Project Forum URL: http://forum.gamedev.vn/index.php?showforum=74
Project Google Group: http://groups.google.com/group/fosproject
Engine Project: http://code.google.com/p/fosengine/
-
- Posts: 26
- Joined: Sun Jan 21, 2007 9:11 pm
-
- Posts: 2
- Joined: Fri Aug 01, 2008 5:16 pm
- Location: Guatemala
when i try to implement this in my project, i get these errors. Im using Irrlicht version 1.4, but somehow get these errors:
Seems like it doesnt recognize CImageGUISkin and SImageGUISkinConfig, i have no clue where i should look to solve this so i figured i could ask you here
This is my UI class
Code: Select all
Compiling...
UI.cpp
..\..\..\..\..\Desktop\GAME\svn\Source\CPP en H files\Game\UI.cpp(10) : error C2039: 'SImageGUISkinConfig' : is not a member of 'irr::gui'
..\..\..\..\..\Desktop\GAME\svn\Source\CPP en H files\Game\UI.cpp(10) : error C2065: 'SImageGUISkinConfig' : undeclared identifier
..\..\..\..\..\Desktop\GAME\svn\Source\CPP en H files\Game\UI.cpp(10) : error C2146: syntax error : missing ';' before identifier 'guicfg'
..\..\..\..\..\Desktop\GAME\svn\Source\CPP en H files\Game\UI.cpp(10) : error C2065: 'guicfg' : undeclared identifier
..\..\..\..\..\Desktop\GAME\svn\Source\CPP en H files\Game\UI.cpp(10) : error C3861: 'LoadGUISkinFromFile': identifier not found
..\..\..\..\..\Desktop\GAME\svn\Source\CPP en H files\Game\UI.cpp(11) : error C2039: 'CImageGUISkin' : is not a member of 'irr::gui'
..\..\..\..\..\Desktop\GAME\svn\Source\CPP en H files\Game\UI.cpp(11) : error C2065: 'CImageGUISkin' : undeclared identifier
..\..\..\..\..\Desktop\GAME\svn\Source\CPP en H files\Game\UI.cpp(11) : error C2065: 'skin' : undeclared identifier
..\..\..\..\..\Desktop\GAME\svn\Source\CPP en H files\Game\UI.cpp(11) : error C2039: 'CImageGUISkin' : is not a member of 'irr::gui'
..\..\..\..\..\Desktop\GAME\svn\Source\CPP en H files\Game\UI.cpp(11) : error C2061: syntax error : identifier 'CImageGUISkin'
..\..\..\..\..\Desktop\GAME\svn\Source\CPP en H files\Game\UI.cpp(12) : error C2227: left of '->loadConfig' must point to class/struct/union/generic type
type is ''unknown-type''
..\..\..\..\..\Desktop\GAME\svn\Source\CPP en H files\Game\UI.cpp(18) : error C2227: left of '->setFont' must point to class/struct/union/generic type
type is ''unknown-type''
..\..\..\..\..\Desktop\GAME\svn\Source\CPP en H files\Game\UI.cpp(21) : error C2227: left of '->drop' must point to class/struct/union/generic type
type is ''unknown-type''
Build log was saved at "file://c:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\game\game\Debug\BuildLog.htm"
game - 13 error(s), 0 warning(s)
This is my UI class
Code: Select all
#include "UI.h"
// Player players[2];
UI::UI(IrrlichtDevice* device)
{
this->device = device;
this->env = device->getGUIEnvironment();
gui::SImageGUISkinConfig guicfg = LoadGUISkinFromFile(device->getFileSystem(), device->getVideoDriver(), "media/ui/guiskin.cfg");
gui::CImageGUISkin* skin = new gui::CImageGUISkin(driver, env->getSkin());
skin->loadConfig(guicfg);
//IGUISkin* skin = env->getSkin();
gui::IGUIFont* font = env->getFont("media/ui/fontlucida.png");
if (font != 0)
skin->setFont(font, gui::EGDF_DEFAULT);
env->setSkin(skin);
skin->drop();
}
// type getPlayers()
// {
// }
void UI::showHighScores()
{
}
void UI::showPlayerCreationScreen()
{
}
void UI::showMultiPlayerSelectionScreen()
{
}
void UI::showSinglePlayerSelectionScreen()
{
env->addStaticText(L"Quick SinglePlayer Select", rect<s32>(300,260,400,269), false);
IGUIListBox* playerlistbox = env->addListBox(rect<s32>(250, 270, 550, 370), 0, 5, true);
playerlistbox->addItem(L"Yannick");
playerlistbox->addItem(L"Rutger");
}
void UI::showStartScreen()
{
device->setWindowCaption(L"user interface van de game");
IVideoDriver *driver = device->getVideoDriver();
IGUIEnvironment *env = device->getGUIEnvironment();
env->addStaticText(L"Onze naamloze game", rect<s32>(50,20,200,40), false);
env->addButton(rect<s32>(10,110,200,140), 0, 1, L"Single player");
env->addButton(rect<s32>(10,160,200,190), 0, 2, L"Multi player");
env->addButton(rect<s32>(10,210,200,240), 0, 3, L"Highscores");
env->addButton(rect<s32>(10,260,200,290), 0, 4, L"Select player");
env->addImage(driver->getTexture("UI testplaatje.jpg"), position2d<int>(300,100));
}
hey,
i just tried this snipped with 1.4.2 and find it great? What would be needed to get it into irrlicht?
I thought about maybe rewriting the config file to xml and zipping everything to a .skin folder.
But then again i don't know if there is any possiblity to have something like this inside irrlicht.
Instead of containing a FallbackSkin it maybe should inheirt from one of Irrlichts skins and only override certain functions?
greetings,
Halan
i just tried this snipped with 1.4.2 and find it great? What would be needed to get it into irrlicht?
I thought about maybe rewriting the config file to xml and zipping everything to a .skin folder.
But then again i don't know if there is any possiblity to have something like this inside irrlicht.
Instead of containing a FallbackSkin it maybe should inheirt from one of Irrlichts skins and only override certain functions?
greetings,
Halan
My Blog: http://www.freakybytes.org
Hey,
i started working on simplyfing the whole class.
I would like to request spereate draw calls for the background of progress bars and check boxes.
Also the ablility of the xml read to read Colors or Positions.
This is how the config file looks now (imo much cleaner)
nice?
greets,
Halan
edit: also I'm wondering if the bug that he fixed with clipRects.h is still there.
i started working on simplyfing the whole class.
I would like to request spereate draw calls for the background of progress bars and check boxes.
Also the ablility of the xml read to read Colors or Positions.
This is how the config file looks now (imo much cleaner)
Code: Select all
<!-- Config file for the GUI Skin
Source border is the border width (in pixels) on the texture.
Dest border is the border width on the screen (also in pixels).
-->
<?xml version="1.0"?>
<guiskin>
<element name="Button">
<texture>button.png</texture>
<srcBorder top="10" left="10" bottom="10" right="10">
<dstBorder top="10" left="10" bottom="10" right="10">
</element>
<element name="ButtonPressed">
<texture>button.png</texture>
<srcBorder top="10" left="10" bottom="10" right="10">
<dstBorder top="10" left="10" bottom="10" right="10">
<color alpha="255" red="196" green="196" blue="196">
</element>
<element name="SunkenPane">
<texture>sunkenpane.png</texture>
<srcBorder top="32" left="32" bottom="32" right="32">
<dstBorder top="10" left="10" bottom="10" right="10">
</element>
<element name="Window">
<texture>windowbg.png</texture>
<srcBorder top="25" left="10" bottom="10" right="10">
<dstBorder top="25" left="10" bottom="10" right="10">
</element>
<element name="ProgressBar">
<texture>gauge.png</texture>
<srcBorder top="16" left="16" bottom="16" right="16">
<dstBorder top="16" left="16" bottom="16" right="16">
</element>
<element name="ProgressBarFilled">
<texture>gauge.png</texture>
<srcBorder top="16" left="16" bottom="16" right="16">
<dstBorder top="16" left="16" bottom="16" right="16">
</element>
</guiskin>
greets,
Halan
edit: also I'm wondering if the bug that he fixed with clipRects.h is still there.
My Blog: http://www.freakybytes.org
Irrlicht 1.5
Hello : )
I just updated to irrlicht 1.5 and got the error related to the abstract class.
Here are the litle changes I made to make it compile:
Add this to the CImageGUISkin.h
Added this to the CImageGUISkin.cpp
It was simple like that.
I hope this is useful to someone.
I just updated to irrlicht 1.5 and got the error related to the abstract class.
Here are the litle changes I made to make it compile:
Add this to the CImageGUISkin.h
Code: Select all
virtual void draw3DTabButton(IGUIElement* element, bool active,
const core::rect<s32>& rect, const core::rect<s32>* clip=0, gui::EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT);
virtual void draw3DTabBody(IGUIElement* element, bool border, bool background,
const core::rect<s32>& rect, const core::rect<s32>* clip=0, s32 tabHeight=-1, gui::EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT );
Code: Select all
void CImageGUISkin::draw3DTabButton(IGUIElement* element, bool active,
const core::rect<s32>& rect, const core::rect<s32>* clip, gui::EGUI_ALIGNMENT alignment)
{
FallbackSkin->draw3DTabButton(element, active, rect, clip, alignment);
}
void CImageGUISkin::draw3DTabBody(IGUIElement* element, bool border, bool background,
const core::rect<s32>& rect, const core::rect<s32>* clip, s32 tabHeight, gui::EGUI_ALIGNMENT alignment)
{
FallbackSkin->draw3DTabBody(element, border, background, rect, clip, tabHeight, alignment);
}
I hope this is useful to someone.
You can also look into my improved versionGameDude wrote:That looks pretty cool, I'll have to look into it sometime
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=30912
My Blog: http://www.freakybytes.org