Setting up CEGUI with VC2003 - help!

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

User avatar
sipickles
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Fri Feb 24, 2006 19:41
Location: Enfield, UK

Setting up CEGUI with VC2003 - help!

Postby sipickles » Sat Feb 25, 2006 16:11

Hi,

I am VERY new to CEGUI, and trying to get it working with my MSVC2003 project.

This is what I am doing:


#include "d3d9renderer.h"

CEGUI::DirectX9Renderer* m_CEGUI = new CEGUI::DirectX9Renderer(g_device);
new CEGUI::System(m_CEGUI);



I am getting this errors:



CLIENT.cpp(135) : error C2664: 'CEGUI::DirectX9Renderer::DirectX9Renderer(CEGUI::DirectX9Renderer &)' : cannot convert parameter 1 from 'IDirect3DDevice9 *' to 'CEGUI::DirectX9Renderer &'
A reference that is not to 'const' cannot be bound to a non-lvalue


Can anyone help?


Also, what is this about? :

Macro defintion of max detected - undefining
Macro defintion of min detected - undefining



I am using those macros elsewhere so its a bit of an inconvenience that CEGUI undefs them!

Thanks

Simon

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Sat Feb 25, 2006 17:27

Hi

You need to specify a second argument to the constructor, this can just be set to 0. So:

Code: Select all

CEGUI::DirectX9Renderer* m_CEGUI = new CEGUI::DirectX9Renderer(g_device, 0);


The macro definitions for min/max are, quite frankly, plain idiocy. These are pretty much a Microsoft thing, and it's all well and nice util you compile some real c++ code like:

Code: Select all

...
int x = std::min(a, b);
...


With the macros defined, the 'min' part of the above is expanded by the preprocessor and you end up with compile errors - how clever :roll:

Anyway, since we use such code in CEGUI, if these macros are not undefined, CEGUI will not compile cleanly. We also have affected code in the String header file, so that requires the macros to be undefined in anything that includes that header.

In the end, there were so many queries regarding this issue, that we decided to put things in place to automatically undefine these macros.

You should be using proper c++ code such as that shown above, instead of these macros. Eventually, they will only cause you troubles.

If you absolutely must use them, then ensure that your macro definitions (or MS includes) always appear after any CEGUI ones.

HTH

CE.

User avatar
sipickles
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Fri Feb 24, 2006 19:41
Location: Enfield, UK

Postby sipickles » Sun Feb 26, 2006 10:39

Thanks CE,

I'd just about got that far myself from looking at the class definitions. Thanks for the advice about the min max malarky

Unfortunately, I'm getting a crash now when I try to load the scheme like this:

g_CEGUI = new CEGUI::DirectX9Renderer(g_device, 0 );
g_CEGUISystem = new CEGUI::System(g_CEGUI);

// load in the scheme file, which auto-loads the TaharezLook imageset
SchemeManager::getSingleton().loadScheme("../datafiles/schemes/TaharezLook.scheme");
// load in a font. The first font loaded automatically becomes the default font.
FontManager::getSingleton().createFont("../datafiles/fonts/Commonwealth-10.font");


System::getSingleton().setDefaultFont("Commonwealth-10");
System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");

The crash occurs in the .loadScheme line and is a CEGUI:Generic Exception. The strange thing is I cant step into the code to debug, so I'm thinking I've missed some initialisation step.

I've tried moving the datafiles all over the place to make sure I have my pathing correct, but no change.

Thanks

Simon

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Sun Feb 26, 2006 13:01

Are there any errors in the CEGUI.log file? Could you post these, along with some surrounding lines for context.

It definitely seems like some datafile issue though.

CE.

User avatar
sipickles
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Fri Feb 24, 2006 19:41
Location: Enfield, UK

Postby sipickles » Sun Feb 26, 2006 19:32

26/02/2006 10:38:10 (InfL1) +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
26/02/2006 10:38:10 (InfL1) + Crazy Eddie's GUI System - Event log +
26/02/2006 10:38:10 (InfL1) + (http://www.cegui.org.uk/) +
26/02/2006 10:38:10 (InfL1) +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

26/02/2006 10:38:10 (InfL1) CEGUI::Logger singleton created.
26/02/2006 10:38:10 (InfL1) ---- Begining CEGUI System initialisation ----
26/02/2006 10:38:10 (InfL1) CEGUI::ImagesetManager singleton created
26/02/2006 10:38:10 (InfL1) CEGUI::FontManager singleton created.
26/02/2006 10:38:10 (InfL1) CEGUI::WindowFactoryManager singleton created
26/02/2006 10:38:10 (InfL1) CEGUI::WindowManager singleton created
26/02/2006 10:38:10 (InfL1) CEGUI::SchemeManager singleton created.
26/02/2006 10:38:10 (InfL1) CEGUI::MouseCursor singleton created.
26/02/2006 10:38:10 (InfL1) CEGUI::GlobalEventSet singleton created.
26/02/2006 10:38:10 (InfL1) CEGUI::WidgetLookManager singleton created.
26/02/2006 10:38:10 (InfL1) WindowFactory for 'DefaultWindow' windows added.
26/02/2006 10:38:10 (InfL1) WindowFactory for 'DragContainer' windows added.
26/02/2006 10:38:10 (InfL1) WindowFactory for 'ScrolledContainer' windows added.
26/02/2006 10:38:10 (InfL1) Window type alias named 'DefaultGUISheet' added for window type 'DefaultWindow'.
26/02/2006 10:38:10 (InfL1) CEGUI::System singleton created.
26/02/2006 10:38:10 (InfL1) ---- CEGUI System initialisation completed ----
26/02/2006 10:38:10 (InfL1) ---- Version 0.4.1 ----
26/02/2006 10:38:10 (InfL1) ---- Renderer module is: CEGUI::DirectX81Renderer - Official Direct3D 9 based renderer module for CEGUI ----
26/02/2006 10:38:10 (InfL1) ---- XML Parser module is: CEGUI::TinyXMLParser - Official tinyXML based parser module for CEGUI ----
26/02/2006 10:38:10 (InfL1) ---- Scripting module is: None ----
26/02/2006 10:38:13 (InfL1) Attempting to load Scheme from file '../datafiles/schemes/TaharezLook.scheme'.
26/02/2006 10:38:13 (InfL1) Attempting to create an Imageset from the information specified in file '../datafiles/imagesets/TaharezLook.imageset'.
26/02/2006 10:38:14 (Error) Exception: FactoryModule::FactoryModule - Failed to load module 'CEGUITaharezLook_d'.


I've already posted the only lines that are to do with CEGUI, the others initialise other element of my app.

Si

User avatar
sipickles
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Fri Feb 24, 2006 19:41
Location: Enfield, UK

Postby sipickles » Sun Feb 26, 2006 19:59

Ok, I have identified the problem, a programming weakness on my part i am sure.

I have added this to my vc++ projects executables directory:

E:\C\CEGUI\CEGUI SDK for Visual C++ .NET 2003\bin

but my com;iler isnt finding any of the dlls. I have to manually add these dlls to my project folder to get it to work:

CEGUIBase_d.dll
DirectX9Renderer_d.dll
CEGUITaharezLook_d.dll

That gets it compiling but I am not sure what I am doing wrong here. Sorry to be a pain!

I have added this bit off your website:

root = (DefaultWindow*)winMgr.createWindow("DefaultWindow", "Root");
btn = static_cast<PushButton*>(winMgr.createWindow("TaharezLook/Button", "Root/mybutton"));
root->addChildWindow(btn);

I globalised the variables for simplicity at this stage, will encapsulate later.


How do I get something to appear onscreen?

Also, is CEGUI fast at all? I am looking for a new GUI system after I built off the Custom UI sample in directX SDK, but it is very slow!!

Thanks

Simon

Si

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Mon Feb 27, 2006 09:51

Ok, you need to set some window or other as the active 'sheet' in the system...

Code: Select all

CEGUI::System::getSingleton().setGUISheet(root);


You also need to make sure that you're issuing the renderGUI call in your main loop (this is covered in the wiki tutorial on getting things rendering.)

Also, is CEGUI fast at all? I am looking for a new GUI system after I built off the Custom UI sample in directX SDK, but it is very slow!!

This question is very hard to answer. If you just have a couple of buttons on the screen, then things will be very fast. If you have a large and complex GUI layout with lots of text, then things will, in general, slow down quite a bit. (Don't forget to do all speed tests / profiling in release mode and not debug ;) ).

We are always aware of the speed issue (especially given our target audience), and make improvements in this area as and when the opportunities arise. Generally, we are still at the stage of adding and refining features, and have not spent vast amounts of time optimising as of this point, though at some stage before we reach the big 1.0 version release, this will become something we spend more time on.

CE.

User avatar
sipickles
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Fri Feb 24, 2006 19:41
Location: Enfield, UK

Postby sipickles » Mon Feb 27, 2006 11:41

Do you envisage CEGUI remaining GPL at release 1.0?

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Mon Feb 27, 2006 14:05

Currently we're LGPL (that first 'L' is quite important ;) ).

We are planning to change to the MIT license for future releases (which, if you're unfamiliar with it, is more liberal).

HTH

CE

User avatar
sipickles
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Fri Feb 24, 2006 19:41
Location: Enfield, UK

Postby sipickles » Mon Feb 27, 2006 19:04

Apparently, batching GUI draws is a good way to speed up rendering.

As I understand it, this means drawing the GUI to a single texture and rendering off that, especially the features and text which don't change.

Does CEGUI do anything like that?

As I am playing with it I am liking it so far! Its a huge project!

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Thu Mar 02, 2006 09:18

We do not do anything like this at present, though at some stage it might be investigated. There's a chance that I'll make large changes to the rendering system yet, so effort in this area right at the moment could end up being wasted...

Glad you like what you see so far :)

CE


Return to “Help”

Who is online

Users browsing this forum: No registered users and 16 guests