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 » Wed Mar 24, 2004 00:11

Hey, thanks for the input Dread!

I tried the texturestages/renderstates that you suggested (as well as clearing the zbuffer) but to no avail. I still get the same results.

The stateblocks (original; right after device is made, and one temporary for restoring to previous states while in a render loop) are both D3DSBT_ALL. But whenever i try to apply the original one mentioned above, the gui renders perfectly, but the game messes up (kind of like all the textures become invisible or something).

And as far as i know, the Utils::RenderFullGUI() function calls resetZ() before it renders, so i don't think calling it again is necessary (although i did and it didn't do anything). I do seem to have a z-ordering problem, though.

I used the clear you mentioned as well. No improvements.

-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 » Wed Mar 24, 2004 06:18

actually another little problem i've run into is that the whole gui system depends on external files (Winlook.sdf.txt/tga).. i'm going to need to load them from memory... so i may have to rewrite code to emulate the PTSettgsFile class. I'd say the render/texturestage states is the biggest problem right now, though

-Derek

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 » Wed Mar 24, 2004 09:34

You could bypass the Winlook.sdf.txt/tga files using the same method that TextFont class does, and use createSpriteSheetFromMemory to copy the image data from memory into a texture for the sprite set, and then define the actual sprites programatically via calls to setSpriteInfo.

What should work with states etc, is this (note that this will probably kill perfomance, but at the moment all we really need it to get things working for you properly).

Initialise Device.
Set GUI required states
Capture State Block: OrgStates
.
.
.
// render time
Capture State Block: TmpStates
Apply State Block: OrgStates
Render GUI
Apply State Block: TmpStates
.
.
.

Obviously that is not an ideal solution, but should definately produce the right results.

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 » Wed Mar 24, 2004 10:11

haha that's what youd THINK... but it isn't happening :x


what method does the textfont class use to bypass the files? as far as i see it still loads the ptsettingsfile


... and as far as the image goes... its just the tga image but copied into memory already. So how would i do that with reateSpriteSheetFromMemory?

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 » Wed Mar 24, 2004 10:40

haha that's what youd THINK... but it isn't happening :x


8O

I'll have to email somebody about this...

what method does the textfont class use to bypass the files? as far as i see it still loads the ptsettingsfile


Yeah, but when creating a TextFont from a operating system font, internally it creates a SpriteSet from scratch, using setSpriteInfo calls. Best bet would be to do a one-time conversion of the sprite definition file into some format easily parsed from memory, then code something that can iterate over the data in memory and make the calls to setSpriteInfo.

... and as far as the image goes... its just the tga image but copied into memory already. So how would i do that with reateSpriteSheetFromMemory?


You'd have to decode it yourself and pass the buffer to createSpriteSheetFromMemory(). Alternatively, you could add a method to the SpriteSet class that will take a texture to use, then you could load the texture however you want and pass in the texture ready to go.

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 » Wed Mar 24, 2004 17:32

another weird artifact is that if i declare the temp state block before the global (original) stateblock:

Code: Select all

      pD3DDevice->CreateStateBlock(D3DSBT_ALL,&dwTempStateBlock);
      pD3DDevice->CreateStateBlock(D3DSBT_ALL,&dwGlobalSavedStateBlock);


the game is fine, but the GUI still renders wrong (looks like the windows have no backgroundfill color).


However, the opposite will make the gui render fine, but will mess up the game's rendering. Odd.

-Derek

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 » Wed Mar 24, 2004 18:54

Just to confirm...

The 'global' state block you are creating only once, after setting the initial gui states, and never touching it's contents again?
The 'temp' state block you are refreshing every frame before rendering the gui?

With reference to the no background problem you mentioned, could this be caused by the same 'client area window' problem you have been having? Or is that bit working okay now?

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 » Wed Mar 24, 2004 21:26

yes that is right... everything is fine. it has to do with render/texturestage states. the global/temp state blocks are how you said.

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 » Thu Mar 25, 2004 07:08

Okay so i added in support to load the sprite def file/texture image from memory. Do i need to make these changes available to the public? I made a program that compiles ".sdf" files, which basically just reads in all the settings from the ini file (winlook.sdf.txt), saves them in binary form, then concatentates the image file (winlook.tga) to the end of that file. It keeps track of everything in structures. I had to edit PTSettingsFile and Utils (overloaded the load function in both) to get them to take in pbyte for the mem pointer and a dword for the size of the compiled sdf file. I also had to make them "realize" the .sdf file format.

Unfortunately i still have the renderstate/texturestagestate problem. I'm not sure how to go about fixing it right now 8O

-Derek

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 » Thu Mar 25, 2004 09:12

Releasing changed sources: Technically yes. What I will do as Mk2 is released is re-license the current versions under a BSD style license. Then all you need do is include a certain copyright notice and nothing else, so long as your product is not publicly released before I do this, then you don't need to worry about it.

I'll keep thinking about the other problem, I heard back from another dev who had similar problems, but they said their problem was ultimately to do with fonts - they didn't elaborate further. If you could PM me another couple of image links later, that could be useful also.

Sorry I haven't been able to sort this out for you yet :(

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 » Thu Mar 25, 2004 10:35

I fixed it. here are the states i used:

Code: Select all

   m_pD3DDevice->SetRenderState( D3DRS_ALPHAFUNC, D3DCMP_GREATER);
   m_pD3DDevice->SetRenderState( D3DRS_ALPHAREF, 0x7F);
   m_pD3DDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
    m_pD3DDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
    m_pD3DDevice->SetRenderState( D3DRS_ZFUNC,     D3DCMP_LESSEQUAL );
    m_pD3DDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
    m_pD3DDevice->SetRenderState( D3DRS_CLIPPING, TRUE );
    m_pD3DDevice->SetRenderState( D3DRS_LIGHTING, FALSE );
    m_pD3DDevice->SetRenderState( D3DRS_COLORVERTEX, TRUE );
    m_pD3DDevice->SetRenderState( D3DRS_SHADEMODE, D3DSHADE_GOURAUD );
    m_pD3DDevice->SetRenderState( D3DRS_FILLMODE,  D3DFILL_SOLID );
    m_pD3DDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
    m_pD3DDevice->SetRenderState( D3DRS_FOGENABLE, FALSE );
    m_pD3DDevice->SetRenderState( D3DRS_RANGEFOGENABLE, FALSE );
    m_pD3DDevice->SetTextureStageState(0, D3DTSS_MAGFILTER, D3DTEXF_POINT);
    m_pD3DDevice->SetTextureStageState(0, D3DTSS_MINFILTER, D3DTEXF_POINT);
    m_pD3DDevice->SetTextureStageState(0, D3DTSS_MIPFILTER, D3DTEXF_POINT);
    m_pD3DDevice->SetTextureStageState( 0, D3DTSS_COLOROP,   D3DTOP_MODULATE );
    m_pD3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
    m_pD3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_CURRENT );
    m_pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP,   D3DTOP_SELECTARG1 );
    m_pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
    m_pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_CURRENT );


All is well now :D

-Derek

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 » Thu Mar 25, 2004 10:44

:mrgreen:

Cool.

I'll keep a copy of that states list somewhere, as it could be useful ;)

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 » Fri Mar 26, 2004 00:47

another thing... is there a way to set a background image for the "desktop" and have menuitem options on that image (just text.. no button drawn over it, but text that functions like a button)?

-Derek

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 » Fri Mar 26, 2004 09:13

"Desktop" image can be achieved in various ways. One way would be to create a new window type, say 'desktop' that has RenderableImage which it draws, attach the new desktop window to the root window, and attach everything else to the desktop window.

The button thing is fairly easy, just disable the frame via setFrameEnabled(false); and the backdrop via setBackdropEnabled(false); for the buttons and attach them to whatever window you want.

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 » Fri Mar 26, 2004 17:03

this is what i did:

Code: Select all

   WLDesktop *desktop = new WLDesktop;
   m_windowList.push_back(desktop);
   desktop->initialise();
   m_rootWindow->addChildWindow(*desktop);
   desktop->show();
   desktop->setSize(GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN));


   WLFrameWindow *wnd = new WLFrameWindow;
   m_windowList.push_back(wnd);
   wnd->initialise();
   m_rootWindow->addChildWindow(*wnd);
   wnd->setPosition(90*Width,30*Height);


trying to desktop->addchildwindow() on the framewindow above just made the title bar appear and nothing else.. adding it to the root window worked though. THe only problem is the image sprite in the texture file i supplied is 1024x768... i need to scale it depending on what resolution i'm in... is there an easy way to do that with renderableimage?

-Derek


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 14 guests