Use of crazyeddie gui sources

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
Derek
Quite a regular
Quite a regular
Posts: 70
Joined: Wed Jan 12, 2005 12:06

Use of crazyeddie gui sources

Postby Derek » Mon Mar 22, 2004 19:16

wnd->getClientAreaWindow()->addChildWindow(*button);

getclientareawindow returns an invalid value in debug mode (0xcdcdcdcd). When i run it in release, however, i get a crash instead in ntdll.dll (Which seems to have to do with the new operator).

User avatar
Derek
Quite a regular
Quite a regular
Posts: 70
Joined: Wed Jan 12, 2005 12:06

Use of crazyeddie gui sources

Postby Derek » Mon Mar 22, 2004 19:29

using this currently crashes me:

Code: Select all

   if (!bInitialized)
   {
      ///////////////////////////////////////////////////////////////////
      //WINDOW CODE
      Utils::setD3DDevice(pD3DDevice);
      Window* rootWnd = CEGUI::Utils::instance()->getRootWindow();
      rootWnd->show();

      Utils::instance()->setGUISprites("C:\\WinLook.txt");
      Utils::instance()->getDefaultFont()->createFromOSFont("Tahoma", 8, 0);

      WLFrameWindow* wnd = new WLFrameWindow;
      myWindowList.push_back(wnd);
      wnd->initialise();
      rootWnd->addChildWindow(*wnd);
      wnd->setPosition(25,25);
      wnd->setSize(195,180);
      wnd->show();
      wnd->setText("Always-On-Top Window");
      wnd->setCloseButtonEnable(true);
      wnd->setAlwaysOnTop(true);

      WLButton* button = new WLButton;
      myWindowList.push_back(button);
      button->initialise();
      wnd->getClientAreaWindow()->addChildWindow(*button);
      button->setPosition(5,5);
      button->setSize(75, 16);
      button->setText("Quit!");
      button->show();
      //Utils::instance()->setCursorChangeHandler(cursorChanger);
      bInitialized = true;
      ///////////////////////////////////////////////////////////////////
   }


I put the image/sdf file on C:\ (and renamed it to just .txt)

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

Use of crazyeddie gui sources

Postby CrazyEddie » Mon Mar 22, 2004 19:40

This is too strange :(

The base class constructor for FrameWindow sets the client pointers to 0, so you should never get the uninitialised ptr value from the debug build. It's almost as if the constructor itself is not being called.

What happens if you add just a single button directly to the root window?

Not that it would cause failure where you are getting it, but I presume you moved the .tga image file to C:\ also?

User avatar
Derek
Quite a regular
Quite a regular
Posts: 70
Joined: Wed Jan 12, 2005 12:06

Use of crazyeddie gui sources

Postby Derek » Mon Mar 22, 2004 19:53

yeah the tga is in the same place. i also edited the winlook.txt (Renamed from winlook.sdf.txt) and fixed the path


rootWnd->addChildWindow(*button); doesn't crash

User avatar
Derek
Quite a regular
Quite a regular
Posts: 70
Joined: Wed Jan 12, 2005 12:06

Use of crazyeddie gui sources

Postby Derek » Mon Mar 22, 2004 19:54

also rendering the gui after using the rootWnd->add... line works (i see the button and the window)



...wnd->addChildWindow(*button); seems to work too (Same line). The button is on the upper left corner of the window

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

Use of crazyeddie gui sources

Postby CrazyEddie » Mon Mar 22, 2004 20:11

Do you get the title bar and close button on the window okay as well? (confirms call to initialise() went to the right place).

What happens if you do similar to this...

Code: Select all

.
.
.
WLClientArea* tmpClient = new WLClientArea;
tmpClient->initialise();
tmpClient->show();
wnd->setClientArea(tmpClient);
tmpClient->addChildWindow(*button);
.
.
.


You may have set the window size so that it resizes the client area for you. This is a kludge, but it helps to identify the exact point of failure.

This will be my last post tonight, but I'll be back early tomorrow :)

User avatar
Derek
Quite a regular
Quite a regular
Posts: 70
Joined: Wed Jan 12, 2005 12:06

Use of crazyeddie gui sources

Postby Derek » Tue Mar 23, 2004 07:45

there is no WLClientArea (or setclientarea function call). I tried the same using a Window* and it didn't work.

-Derek

User avatar
Derek
Quite a regular
Quite a regular
Posts: 70
Joined: Wed Jan 12, 2005 12:06

Use of crazyeddie gui sources

Postby Derek » Tue Mar 23, 2004 08:41

good news! i got it working. I decided to write a window manager and that seems to have done the trick. The only problem now is that the windows don't look right.. like they have no background images, etc. I'll private message you a link to a screenshot of what i'm talking about

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

Use of crazyeddie gui sources

Postby CrazyEddie » Tue Mar 23, 2004 09:20

:) Glad you are making some progress.

That image looks strange for a couple of reasons that I can think of. If you have texture filtering on, that will cause that shaddowing you see. And enabling alpha-blending in GUI releases before support for that was added, when combined with filtering, will also result in odd rendering.

No WLClientArea and no setClientArea() method? The WLClientArea has it's own .cpp/.h files, and setClientArea() method is at line 161 in FrameWindow.h. :oops: FrameWindow.cpp i meant

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

Use of crazyeddie gui sources

Postby CrazyEddie » Tue Mar 23, 2004 09:35

D'oh! My bad. Sorry.

The method is called setClientAreaWindow()

User avatar
Derek
Quite a regular
Quite a regular
Posts: 70
Joined: Wed Jan 12, 2005 12:06

Use of crazyeddie gui sources

Postby Derek » Tue Mar 23, 2004 18:09

I'm trying:

m_pD3DDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
m_pD3DDevice->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE);
m_pD3DDevice->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER);
m_pD3DDevice->SetRenderState(D3DRS_ALPHAREF, 0x7F);
m_pD3DDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESSEQUAL);
m_pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
m_pD3DDevice->SetTextureStageState( 0, D3DTSS_MINFILTER, D3DTEXF_POINT );
m_pD3DDevice->SetTextureStageState( 0, D3DTSS_MAGFILTER, D3DTEXF_POINT );
m_pD3DDevice->SetTextureStageState( 0, D3DTSS_MIPFILTER, D3DTEXF_NONE );
m_pD3DDevice->SetTextureStageState( 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE );


but it's still not rendering right. I've tried snapping stateblocks, but restoring the original stateblock seems to not restore everything correctly, because the rest of the game is messed up after that.

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

Use of crazyeddie gui sources

Postby CrazyEddie » Tue Mar 23, 2004 18:31

Is your state-block of D3DSBT_ALL type, as I was under the impression that it covered everything (though has a perf hit).

Are you remembering to clear the Z-buffer before rendering the GUI?

User avatar
DreadID4
Just popping in
Just popping in
Posts: 5
Joined: Wed Jan 12, 2005 12:06
Contact:

Use of crazyeddie gui sources

Postby DreadID4 » Tue Mar 23, 2004 19:12

Hey, sorry haven't been to the boards in a few days, but I would be happy to help with your vc++ 6.0 problem (though it seems like you mostly got that figured out). I actually disabled all of the dynamic casts so I wouldn't have to use RTTI (static_cast!). I also made a Gui_Factory object you might be interested in. I had problems rendering the GUI as well, I'll post what I did to fix the problem.

Here's what I'm using as far as getting it to draw right because of D3D state changes:

Code: Select all

     CEGUI::Utils::instance()->resetZ();

   // Note D3DCLEAR_TARGET IS EXPENSIVE, do not use it if you don't need to
   pd3dDevice->Clear(0, NULL, D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
   //pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(255, 0, 255), 1.0f, 0);

    if( SUCCEEDED( pd3dDevice->BeginScene() ) )
    {   
      //...

      pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
      pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
      pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_CURRENT);
      
      pd3dDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
      pd3dDevice->SetRenderState(D3DRS_ALPHATESTENABLE, true);
      pd3dDevice->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER);
      pd3dDevice->SetRenderState(D3DRS_ALPHAREF, 0x7F);

      CEGUI::Utils::instance()->renderFullGUI();

      pd3dDevice->SetRenderState(D3DRS_ALPHATESTENABLE, false);

      //...

      //Engine_AppBase::m_GraphicsPipeline.Init2DDrawSettings();
   }


Like crazy ed said, make sure you clear the zbuffer, and resest the gui z before rendering. Hope that helps. Also note, I'm using the latest version of 2.0, not 3.0. Though it shouldn't make much difference

If it is possibly any help, here's a "gui_factory" I built to help organize data (so it can be deleted all together) and keep initialization of gui objects in one place. http://www.third-helix.com/iauns/download/guifactory.zip This is also based off 2.0, so it doesn't have te multiline edit box or alpha blending. It's kinda hacked together (static functions) but it works really well, and is quite organized.

If you want my modified GUI sources, I can put them up as well, just ask.

PS: Do whatever you want with the GUI factory.

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

Use of crazyeddie gui sources

Postby CrazyEddie » Tue Mar 23, 2004 19:27

This post is off-topic, though hopefully it won't throw the whole topic off on a tangent.

At the moment I'm not doing much at all except dying from Flu :( But, once I get back into things, I hope produce what will be pretty much a 'final' release of the current GUI system (prior to the Mk2 system being released). This will include the VC++ 6 compatibility changes merged in, and with DreadID4's permission, possibly include an extended version of the gui_factory? (NB: The alpha-blending is not in any source release, it's CVS only at the moment, so that will make that more 'available' for use as well).

Missed your PS edit. Thanks :D

User avatar
DreadID4
Just popping in
Just popping in
Posts: 5
Joined: Wed Jan 12, 2005 12:06
Contact:

Use of crazyeddie gui sources

Postby DreadID4 » Tue Mar 23, 2004 20:16

If you want, I'll spiff up the GUI_Factory a bit more. Because there is a few proprietary things in there (infoscroller and progress bullet), and A LOT of duplicated code (all of the frame window vs. window stuff). I'd be happy to enhance it a bit before you use it, that is if you haven't already started work on it =).

Also, I hope you can get that GUI system working properly derek, it's great!

Edit: I'm updating it, shouldn't take more than an hour =).


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 18 guests