how to define On Mouse Over eventin DirectX

I wish to create some onmouseover event function, can anyone tell me how to do it in DirectX, i've checked some example from DirectX tutotrial, the addbutton function got on mouse over event, but it's already preset in the library. If I want to set OnMouseOver event in my own code, what should I do.

Thanks.

[326 byte] By [kenneth1983] at [2007-12-25]
# 1
Are you using DXUT for your UI?
WessamBahnassi at 2007-9-3 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...
# 2
Sorry i'm not sure what is DXUT, I'm just got an "Empty Project" example from DirectX Sample Browser as the template of my project. Is that the DXUT, do you know which example i'm saying?
kenneth1983 at 2007-9-3 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...
# 3
How do you create your UI controls in your code?
WessamBahnassi at 2007-9-3 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...
# 4
kenneth1983 wrote:

I wish to create some onmouseover event function, can anyone tell me how to do it in DirectX, i've checked some example from DirectX tutotrial, the addbutton function got on mouse over event, but it's already preset in the library. If I want to set OnMouseOver event in my own code, what should I do.

Thanks.

Look at the "CustomUI" sample in the DirectX Sample Browser. It shows you how to do it in either C# or C++.

DavidWeller-MSFT at 2007-9-3 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...
# 5

Hi kenneth1983,

i porpose check your mouse whether over button x, y, x+width, y+height.

Best Regards,

brian_tsim at 2007-9-3 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...
# 6

I think i'm using DXUT to create my UI

kenneth1983 at 2007-9-3 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...
# 7

I didn't see any onMouseOverEvent in the coding, the onMouseOverEvent is from the dxutgui.cpp

The onmouseoverevent code below I copied from dxutgui.ccp

CDXUTBUTTON

Element.TextureColor.States[ DXUT_STATE_NORMAL ] = D3DCOLOR_ARGB(150, 255, 255, 255);

Element.TextureColor.States[ DXUT_STATE_PRESSED ] = D3DCOLOR_ARGB(200, 255, 255, 255);

Element.FontColor.States[ DXUT_STATE_MOUSEOVER ] = D3DCOLOR_ARGB(255, 0, 0, 0);

CDXUTCheckBox

Element.TextureColor.States[ DXUT_STATE_MOUSEOVER ] = D3DCOLOR_ARGB(160, 255, 255, 255);

Element.TextureColor.States[ DXUT_STATE_PRESSED ] = D3DCOLOR_ARGB(60, 0, 0, 0);

Element.TextureColor.States[ DXUT_STATE_FOCUS ] = D3DCOLOR_ARGB(30, 255, 255, 255);

CDXUTRADIOBUTTON

Element.TextureColor.States[ DXUT_STATE_NORMAL ] = D3DCOLOR_ARGB(150, 255, 255, 255);

Element.TextureColor.States[ DXUT_STATE_FOCUS ] = D3DCOLOR_ARGB(200, 255, 255, 255);

Element.TextureColor.States[ DXUT_STATE_PRESSED ] = D3DCOLOR_ARGB(255, 255, 255, 255);

do you know how to bring the code above to my own code, thanks

kenneth1983 at 2007-9-3 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...
# 8
I have this idea too, but i refer to the "Custom Format" from directx sample browser, the mouse position value got problem, because the mouse position (x, y) value is different everytime i run the program and move the cursor.
kenneth1983 at 2007-9-3 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...