[SOLVED] InjectKeys to CEGUI Problems
Moderators: CEGUI MVP, CEGUI Team
Re: injectKeys to CEGUI Problems
Yep , looks like SetWindowsHookEx( WH_GETMESSAGE ) is having troubles with D3D9 mouse positions. I need another hook method then.
Re: injectKeys to CEGUI Problems
i don't like these windows functions and types, a pity we have to use that poorly programmed trash... especially when i got to use this redundant windows special types like LPSTR that require special conversion functions etc. i start getting mad, it is just eww...
anyways- if u found a working solution please post it in case someone else steps into the same trap, obviously cegui wasnt the culprit in this case
anyways- if u found a working solution please post it in case someone else steps into the same trap, obviously cegui wasnt the culprit in this case
CrazyEddie: "I don't like GUIs"
Re: injectKeys to CEGUI Problems
Don't worry , i will post all the code i have when i solve everything.
My idea was to create a base for D3DX Overaly with CEGUI , so people can create theyr own menus without need to worry about Hooks, just CEGUI.
Anyways i need to clean A LOT my code , most of it its just copy paste of CEGUI Classes from FrameWorkBase.
My idea was to create a base for D3DX Overaly with CEGUI , so people can create theyr own menus without need to worry about Hooks, just CEGUI.
Anyways i need to clean A LOT my code , most of it its just copy paste of CEGUI Classes from FrameWorkBase.
Re: injectKeys to CEGUI Problems
Solved the problem within mouse position:
Looks like Msg Struct have another struct inside it called PT with X/Y Position of Mouse.
Now the mouse position updates correctly , Mouse Cursor with TaharezLook draws correctly and Event Triggers correctly too.
Anyways there r still 2 issues , one is the reposition of CEGUI Cursor since OS Cursor and CEGUI Cursor rn't on the same X/Y values.
Second issues still on FrameWindow Animations Like HelloWorld Demo , they don't even trigger.
I'll look into it today.
Code: Select all
Old:
case WM_MOUSEMOVE:
mouseEnters();
this->injectMousePosition((float)(LOWORD(lParam)), (float)(HIWORD(lParam)));
SendMessage( hWndServer, UWM_MOUSEMOVE, 0, 0);
break;
New:
case WM_MOUSEMOVE:
mouseEnters();
this->injectMousePosition((float)msg->pt.x, (float)msg->pt.y);
SendMessage( hWndServer, UWM_MOUSEMOVE, 0, 0);
break;
Looks like Msg Struct have another struct inside it called PT with X/Y Position of Mouse.
Now the mouse position updates correctly , Mouse Cursor with TaharezLook draws correctly and Event Triggers correctly too.
Anyways there r still 2 issues , one is the reposition of CEGUI Cursor since OS Cursor and CEGUI Cursor rn't on the same X/Y values.
Second issues still on FrameWindow Animations Like HelloWorld Demo , they don't even trigger.
I'll look into it today.
Re: injectKeys to CEGUI Problems
If you send the correct absolute values of the mouse cursor to cegui i dont see how it can be wrong
CrazyEddie: "I don't like GUIs"
Re: injectKeys to CEGUI Problems
Still Looking into MSDN , maybe i can find something in there.
Anyways looks like OS Mouse is Faster than CEGUI Mouse.
Anyways looks like OS Mouse is Faster than CEGUI Mouse.
Re: injectKeys to CEGUI Problems
On FullScreen Mode , mouse position is updated correctly , anyways still no visible animations :/
On windowed mode , mouse position dosn't update correctly and no animations.
Looks like Absolute Positioning is what's causing the problem in windowed mode... i could be wrong anyways.
On windowed mode , mouse position dosn't update correctly and no animations.
Looks like Absolute Positioning is what's causing the problem in windowed mode... i could be wrong anyways.
Re: injectKeys to CEGUI Problems
you can simply debug whatever u are injecting the right stuff into CEGUI to figure if it is your mistake or CEGUI's (most likely it is yours)...
CrazyEddie: "I don't like GUIs"
Re: injectKeys to CEGUI Problems
100% sure isn't CEGUI. I don't know about animation problem , but this weird mouse positioning is my fault.
Re: injectKeys to CEGUI Problems
Tryd to use GetPosition within Direct3D9 Window without hooks and printed X/Y , its exactly the same value that i pass with MessageHook. It's Absolute to my ScreenSize. That explains why work with Full-Screen Mode.
Then added this to RenderGUI Function:
The most shocking part was discover that the 3 functions had exactly the same cursor position:
D3D APP Position :620.000000 and 509.000000
SystemWideHook Position: 620.000000 and 509.000000
CEGUI Position: 620.000000 and Y 509.000000
Ok , now i'm lost lol.
Then added this to RenderGUI Function:
Code: Select all
CEGUI::GUIContext * mainContext = &CEGUI::System::getSingleton().getDefaultGUIContext(); // #### must be done *after* MyGUIInit() ####
CEGUI::Vector2f mousePos = mainContext->getMouseCursor().getPosition();
The most shocking part was discover that the 3 functions had exactly the same cursor position:
D3D APP Position :620.000000 and 509.000000
SystemWideHook Position: 620.000000 and 509.000000
CEGUI Position: 620.000000 and Y 509.000000
Ok , now i'm lost lol.
Re: injectKeys to CEGUI Problems
everything works as it should. obviously u cant use this function for windowed mode mouse positions. i cant help u with d3d or windows functions, this is the CEGUI forum.
CrazyEddie: "I don't like GUIs"
Re: injectKeys to CEGUI Problems
Ok, if everything works as it should then I misunderstood the concept behind injecting Mouse Positions.
Thought CEGUI was using the ScreenSize not WindowSize, since i'm injecting Mouse Position based on my ScreenSize the CEGUI Cursor will never be on the correct position.
So I should calculate WndSize b4 injecting my input if Windowed and then do some maths with ScreenSize.
Thought CEGUI was using the ScreenSize not WindowSize, since i'm injecting Mouse Position based on my ScreenSize the CEGUI Cursor will never be on the correct position.
So I should calculate WndSize b4 injecting my input if Windowed and then do some maths with ScreenSize.
Re: injectKeys to CEGUI Problems
Ok after some trys on getting Relative Position with Maths and not getting any solution i found the problem.
So after all CEGUI Positoning use :
D3DPRESENT_PARAMETERS -> BackBufferWidth && BackBufferHeight for Mouse positoning ,
not Window width and height.
Using:
Found my resolution inside APP is 800x600 ... I was trying to obtain relative position using Window Width and Height , so never matched....
So , from that point i will need to do so many things inside Mouse Hook that could cause a severe lose of performance...
Since games can change from FullScreen to Windowed any given time , at least I must keep checking for it , i can do the maths just one time , if window isn't resized.....
Well , i will post the result later when i'm done with all this...
So after all CEGUI Positoning use :
D3DPRESENT_PARAMETERS -> BackBufferWidth && BackBufferHeight for Mouse positoning ,
not Window width and height.
Using:
Code: Select all
CEGUI::Sizef sized = guiContext->getSurfaceSize();
printf/fods("%f and %f \n",sized.d_height,sized.d_width);
Found my resolution inside APP is 800x600 ... I was trying to obtain relative position using Window Width and Height , so never matched....
So , from that point i will need to do so many things inside Mouse Hook that could cause a severe lose of performance...
Since games can change from FullScreen to Windowed any given time , at least I must keep checking for it , i can do the maths just one time , if window isn't resized.....
Well , i will post the result later when i'm done with all this...
Re: injectKeys to CEGUI Problems
Ok found the problem and now positoning works Ok.
D3D9 app I was using to test my hooks wasn't using AdjustWIndowRect() after resizing.... So Everything was incorrectly set because of that.
Well still no animations but at least i learned some useful tricks.
D3D9 app I was using to test my hooks wasn't using AdjustWIndowRect() after resizing.... So Everything was incorrectly set because of that.
Well still no animations but at least i learned some useful tricks.
Who is online
Users browsing this forum: No registered users and 3 guests