Hi,
I'm trying to setup an ogre scene editor package: Ogre Toolbox. I have a basic framework up and running, rendering is ok, but I have difficulties converting between Strings.
I'm using wxWidgets for the GUI. How do I convert between wxString and Ogre::String ?
Or should I just go with CEGui?
[Edit]For the current version check: http://www.ogre3d.org/phpBB2/viewtopic.php?t=8122[/edit]
Ogre Toolbox (Editor)
-
- Halfling
- Posts: 88
- Joined: Sun Sep 05, 2004 7:01 pm
- Location: Belgium
Ogre Toolbox (Editor)
Last edited by Mr. Turner on Sun Feb 20, 2005 5:34 pm, edited 2 times in total.
-
- Halfling
- Posts: 61
- Joined: Sun Feb 22, 2004 3:41 pm
- Location: Martigny, Switzerland
You can convert your Ogre::String (which is in fact a std::string) to a standard null terminated C-string by doing:
(and it looks like it is the same for a wxString, according to the documentation of wxWidget)
Both classes are able to use standard null terminated C-strings (as parameters for a lot of their methods, including constructors and assignement operator).
Code: Select all
ogreString.c_str();
Both classes are able to use standard null terminated C-strings (as parameters for a lot of their methods, including constructors and assignement operator).
-
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
-
- Gremlin
- Posts: 164
- Joined: Wed Aug 18, 2004 6:41 pm
- Location: London
Re: Ogre Toolbox (Editor)
wxString can be derived from std::string, but you cannot rely on it being so. It depends on how you configure the wxWidgets build. Still, converting between the two types of string is pretty trivial:Mr. Turner wrote:.
I'm using wxWidgets for the GUI. How do I convert between wxString and Ogre::String ?
Or should I just go with CEGui?
wxString wx_string(ogre_string.c_str());
or
wx_string = ogre_string.c_str();
where ogre_string is an Ogre::String object.
For what you are doing, wxWidgets is a far better choice than CEGUI. CEGUI is great - but it's application is in-game stuff rather than for full blown design tools.
Ian
-
- Halfling
- Posts: 88
- Joined: Sun Sep 05, 2004 7:01 pm
- Location: Belgium
-
- Halfling
- Posts: 88
- Joined: Sun Sep 05, 2004 7:01 pm
- Location: Belgium
-
- Halfling
- Posts: 88
- Joined: Sun Sep 05, 2004 7:01 pm
- Location: Belgium
move to 1.0
Hi,
I'm making the move to Ogre 1.0 CVS-HEAD, but I'm having trouble converting this Code:
handle is a HWND that I got from a wxWidget. This code works in Ogre 0.15.2, but not in 1.0 CVS-HEAD.
It crashes at the setexternalwindowhandle. No error in the ogre.log .
If I comment it out, it does everything except now it's in its own window instead of in the wxWidget.
I've read that the setexternalwindowhandle has been changed into a parameter-like system, but I always get errors.
Mr. Turner
I'm making the move to Ogre 1.0 CVS-HEAD, but I'm having trouble converting this Code:
Code: Select all
mRoot->showConfigDialog();
// Render system + external handle.
mRSys = mRoot->getRenderSystem();
D3D9RenderSystem *rsys = (D3D9RenderSystem *)mRSys;
rsys->SetExternalWindowHandle(handle);
// Root and Scene.
mWnd = mRoot->initialise(true);
mScene = mRoot->getSceneManager(ST_GENERIC);
It crashes at the setexternalwindowhandle. No error in the ogre.log .
If I comment it out, it does everything except now it's in its own window instead of in the wxWidget.
I've read that the setexternalwindowhandle has been changed into a parameter-like system, but I always get errors.
Mr. Turner
-
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66