Cammo Rose

Can anyone provide me with an example of how to do a cammo rose menu popup when the right mouse button is held down and then vanish with released?

I tried this with something like this

var flg = false;

function onGUI()
{
    //check to see if right mouse was clicked
    if (Input.GetButtonDown ("Fire1"))
    {
        var flg = true;
    }
    if (Input.GetButtonUp ("Fire1"))
    {
        var flg = false;
    }
}

function Update()
{
    if (var flg == true)
    {
        GUI.Box(rect(10,10,100,90, "Menu"));
    }
}

The update function doesn’t seem to like how I am trying to validate the var flg.

I also wasn’t sure how to make a key binding for the right mouse button and call it “menu_toggle” so I used a key I knew would work to test.

Sorry my code looks like crap… been up the past 20 hours or so…

I have no idea what a ‘cammo rose menu popup’ is, or what “The update function doesn’t seem to like how I am trying to validate the var flg.” means, but: you can only call GUI.* functions from onGUI(). The code you have in Update() needs to move to the end of your onGUI().

Ok I see about the update, but I also learned using Input in onGui calls are not a good idea.

I have working code now.

As for the rose menu… this is what I am talking about. Like the BF2 “q” menu.

Also is it possible to make round buttons, or will I have to use textures?

Are the menu items selected by keystrokes or mouse gestures or is it just a convenient arrangement of the menu items?

As for the buttons, there is no direct way to make them round, but you can use different shaped textures (you might want to use GUITextures for this). Also, the textures are considered rectangular, even if they are partially transparent, so you will need to use your own code to mask off the portion not covered by the circle.

Mouse gestures.

Basically this when you hold the trigger (right mouse atm)this pops up and the user moves the mouse and it highlights the menu selections. These are your basic fantasy menus, like inventory character and so forth. Based on this selection the game will open the menu selected.

I wanted to get away from a basic click gui, and save on shortcut space by making an easy to use intuitive selection tool for the menus. From there it is your every menu windows.

I was thinking I would have to use textures. Thanks for the tip. I wouldn’t need to mask them if I just make square areas with in the circles. The mouse pointer will be hidden anyway and the user will know when to click the button because the item will be highlighted. The background gui under the texture will just be for triggering.

Again thanks for your help guys.

Ok so after spending a few minutes in photoshop I made 5 button textures, and using GUI Texture placed them on the screen.

I already seen examples of using ongui for toggling menus on an off, but how would I go about doing that with GUI Textures? Do I used something like Graphics.DrawTexture to envoke the image? GUI.DarwTexture is within a box I think, so I don’t know what I should use.

GUI.DrawTexture would be OK for this (GUITextures are clickable but you don’t appear to need this feature for what you are doing).