Page 1 of 1

Change mouse Image

Posted: Sat Feb 09, 2008 22:26
by gangste85
I am working on a program...

I want to change the MouseCursor, i can change it, but i also need to change it with a value from a .txt message so the user can customise.

string fromtxtfile;
CEGUI::String valuefromtxtfile = fromtxtfile;
CEGUI::MouseCursor::getSingleton().setImage("LevelLook", valuefromtxtfile);

I have mad al the value's in the txt file available in the levellook.schem and levellook.imageset. If i use hard code like .setImage("LevelLook", "MouseEnemy"); it works fine.

Can anyone tell me what i am doing wrong..

Posted: Sun Feb 10, 2008 07:54
by CrazyEddie
Hi, and welcome to the forum :)

It certainly looks like it should work. Can you look in the CEGUI.log file and see if there are any errors.

The only other thing that comes to mind at the moment is that it could be a character encoding issue - whether this is the case or not will depend on whether you use characters with code >127, and if so, how you subsequently assign those to the string object.

Anyhow, for now just look in the log and see if there are errors relating to images :)

CE.

Posted: Sun Feb 10, 2008 11:11
by gangste85
Hi,

i am getting this error

(Error) Exception: Imageset::getImage - The Image named '' could not be found in Imageset 'LevelLook'.

Posted: Sun Feb 10, 2008 11:36
by scriptkid
Looks like you're passing a non-ascii character or something (like CE suggested). Are you sure that your txt file loader is working correctly? You can dump the loaded settings with calls to CEGUI::Logger::getSingleton().logEvent(...).

HTH!

Posted: Sun Feb 10, 2008 11:37
by gangste85
After seeing the log is started looking to the input from the txt file and i converted the input on the wrong way so that the string all ready had the wrong value...

my mistake :oops:

thnks anyway..

Posted: Sun Feb 10, 2008 11:39
by scriptkid
Okay np :)