[PLUGIN] CGUI v0.02a (24/01/2011): Construct GUI

Post and try out addons that are currently in development.

Post » Sat Jan 22, 2011 4:01 pm

[quote="sglorz":2gcye28n]Hum, strange error. CGUI plugin is built the same way as Input System and I don't think the drive is the reason. Have you verified that the plugins is correctly installed (beware of the runtime/edittime mixup)?[/quote:2gcye28n]

No i am sure i placed them correctly and i tried a few times but always the same thing.

I just tested it with my other computer that uses C drive though and it worked fine. I guess it was the E drive thing as i can't think of anything else why it would not work.

I have it working on one computer though which is good and this is a really nice plugin by the way, many thanks. :D
B
2
S
2
G
1
Posts: 121
Reputation: 1,092

Post » Sat Jan 22, 2011 8:41 pm

zeno,
I was getting that error after installing the plugin. I checked the dependencies of the csx files and found that they needed D3DX9_43.dll, which wasn't on my system. I updated DirectX to get the file and It works now.
B
79
S
24
G
54
Posts: 4,746
Reputation: 40,755

Post » Sun Jan 23, 2011 12:54 am

I've nearly finished to remove all the drawing bugs, but I'm stuck with some transparency problem and I need some construct/DirectX guru to help me :mrgreen:

Here is the problem. In Edit mode, the GUI is displayed using DirectX directly and all is fine. In runtime mode I can't do the same because of the filters, scrolling things, etc... So I use the runtime renderer functions (essentially Quad_xywh) and I have a transparency problem.

Here is the original from MyGUI build:


Here is the result in Construct:


As you can see on the slider, transparency is not correct, there is a black shadow. In this 3rd image, you can see what happens when switching form one tab to another:


I need to find a way to remove this black shadow. If anyone can help me, I'll be greatful.

By the way, here are my DirectX states:

[code:1ilcusc7]
mpD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);

mpD3DDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
mpD3DDevice->SetTextureStageState(0, D3DTSS_COLORARG0, D3DTA_DIFFUSE);
mpD3DDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);

mpD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
mpD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAARG0, D3DTA_DIFFUSE);
mpD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);

mpD3DDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
mpD3DDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
mpD3DDevice->SetSamplerState( 0, D3DSAMP_MIPFILTER, D3DTEXF_NONE );

mpD3DDevice->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
mpD3DDevice->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);

mpD3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
mpD3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);

mpD3DDevice->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
mpD3DDevice->SetRenderState(D3DRS_ZENABLE, FALSE);
mpD3DDevice->SetRenderState(D3DRS_LIGHTING, 0);
mpD3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);

mpD3DDevice->SetFVF(D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1);[/code:1ilcusc7]
B
3
S
1
G
2
Posts: 80
Reputation: 985

Post » Sun Jan 23, 2011 10:04 pm

YES !! I've found the reason. Colors and alpha are multiplied by Construct before rendering, for filter handling I think.

I've added some hack for each vertices:

[code:3p8lf3y9] for(int c=0 ; c<4 ; c++)
{
vertexcolors[c].r /= vertexcolors[c].a;
vertexcolors[c].g /= vertexcolors[c].a;
vertexcolors[c].b /= vertexcolors[c].a;
}[/code:3p8lf3y9]

Ugly but I don't know how to bypass this. A new demo should arrive soon.
B
3
S
1
G
2
Posts: 80
Reputation: 985

Post » Tue Jan 25, 2011 11:28 am

[quote="R0J0hound":2ehik4g3]zeno,
I was getting that error after installing the plugin. I checked the dependencies of the csx files and found that they needed D3DX9_43.dll, which wasn't on my system. I updated DirectX to get the file and It works now.[/quote:2ehik4g3]

Thanks, i thought i already had the latest DirectX but maybe not so i will download it to see it it works.
B
2
S
2
G
1
Posts: 121
Reputation: 1,092

Post » Tue Jan 25, 2011 5:53 pm

Yeah after updating DirectX it now runs ok on this computer. :)

By the way i found a bug -

In your demo example i noticed if you preview it and click outside of the window (i did it in task manager to check it's cpu/mem usage) when you hover back over the window the mouse is invisible until you click in it again.

I am guessing this is because it uses a custom mouse pointer and the event to re-show it is missed for some reason.
B
2
S
2
G
1
Posts: 121
Reputation: 1,092

Post » Tue Jan 25, 2011 7:13 pm

The mouse cursor is hidden by the CAP file, so there is no cursor displayed in the window, border included and if the window does not have the focus, no mouse message is sent.
B
3
S
1
G
2
Posts: 80
Reputation: 985

Post » Tue Jan 25, 2011 7:32 pm

Definitely going to need a dummied down example for me.
Something without the function object would be nice.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Tue Jan 25, 2011 8:21 pm

Let me explain the example:



First I set the plugin variables:
Resources paths: Media/Demos/Demo_Themes;Media/Common/Demos;Media/Common/Themes
The main resource file (with the main theme ): MyGUI_Core.xml
Then the layouts (windows): Wallpaper.layout for the background, HelpPanel.layout for the top left window and Themes.layout for the main window.

All this files are loaded at EditTime and at Runtime to render the layout.

I create a private variable MainLayout which contains the layout of the main window (Themes.layout).

Start of layout
Step 7: I set the textbox called "Text" (described in HelpPanel.layout) with a caption. Then I create my demo window (call "CreateDemo").

CreateDemo function with theme number to load as parameter:
Step 8: First I unload the main window by calling "DestroyDemo".

Step 9 to 11: depending on the value of function parameter, the main theme is changed by a load resource file.

Step 12: I fill the entries of the combo box called "ComboBox" and set the index the same as the input parameter. I also set the ComboBox to be a drop box only with no edit field. Then I tell the ComboBox to react to "On accept" event with a "Set event". Some events have parameters. "On accept" has 2 parameters: sender (widget's name who sent the event) and index (the new selected index in the combo box). These parametes are retrieved using "GetEventParameter(paramNumber).

DestroyDemo function
Step 13: unload Themes.layout

On ComboBox accept
Step 14: I call CreateDemo with event parameter 1 which is the new selected index retrieved by "GetEventParameter(1)".

I hope that will help to understand the demo a bit more ;)

By the way, GetEventParameter is zero-base indexed, shouldn't it be one-base indexed?
B
3
S
1
G
2
Posts: 80
Reputation: 985

Post » Thu Jan 27, 2011 10:03 am

How do you correctly link a button to a regular event?

I thought this would be a really simple task but after trying to link it with a simple event to show a hidden object it was not working. I tried a load of options also yet nothing worked.

Also do you plan to make documentation/help for your object? I found loads of docs for the actual library and have been able to modify the XML and display that shows just fine but it's just the returning data back i am not having much success with.

No included offline documentations is a general problem i am finding with this program though. For many things it's not much of a issue as they are self described/need no help but for the more complex plugins like this it would be a good idea i think.
B
2
S
2
G
1
Posts: 121
Reputation: 1,092

PreviousNext

Return to Work-in-progress addons

Who is online

Users browsing this forum: No registered users and 0 guests