Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MGui] Patch - Windows selection, Z-order, overlapping, input #33

Open
GoogleCodeExporter opened this issue Apr 18, 2015 · 6 comments
Open

Comments

@GoogleCodeExporter
Copy link

Patch should be applied in
"maratis\branches\Experimental\Sources\MSDK\MGui"

** explanation of the patch
This patch allows selecting (highlighting) windows, with the following features:
* selecting a window will bring it to front
* clicking where there's no windows will unselect all windows
* windows can overlap with no side effects
* you can query if there are selected windows
* you can query if the mouse is over some window
* you have two modes for selecting windows:
  rootWindow->setHardSelecting(true);
    you have to click on a window to select it
  rootWindow->setHardSelecting(false);
    just hovering the mouse on a window will select it


In the case that the user is operating on a MGuiWindow, you may decide not to 
send the input to the Maratis engine too (e.g. for clicking on 3D objects).
In other words you may want a GUI window to block a click or a key which 
otherwise will be sent to the engine.
So you can also do "W,A,S,D movement" and still type those letters in a 
MGuiEditText.

Here's an example on how to use the patch for what concerns input:

    if(input->onKeyDown("MOUSE_BUTTON1"))
    {   if(guiWinRoot->isMouseOverSomething())
        guiWinRoot->onMouseButtonDown(MMOUSE_BUTTON_LEFT);
        else
        {   guiWinRoot->unHighLightAllWindows();
            pick_3d_objects_with_raycasting();
        }
    }
    else if(input->onKeyUp("MOUSE_BUTTON1"))
    {   if(guiWinRoot->isSomethingHighlighted())
        guiWinRoot->onMouseButtonUp(MMOUSE_BUTTON_LEFT);
    }

    if(guiWinRoot->isMouseOverSomething())
    {   //send characters and keys to MGui
    }

    if(guiWinRoot->isSomethingHighlighted())
        return;

    //because of the previous lines and the "return", the following input won't work if there's a selected MGUI window

    if(input->onKeyDown("ENTER"))
    {   //do stuff
    }
    else if(input->onKeyDown("SPACE"))
    {   //do stuff
    }
    //etc

Original issue reported on code.google.com by [email protected] on 16 Nov 2013 at 5:59

Attachments:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant