About Store Forum Documentation Contact



Post Reply 
Changing mouse mode
Author Message
nayon7 Offline
Member

Post: #1
Changing mouse mode
So I'm trying to make a first person game with an inventory. I've managed to put an inventory that I can open with the "I" key, but how do I make it such that when I open the inventory, the mouse stops controlling my view and I get a visible cursor with which I can manipulate my inventory; and when I close the inventory I go back to controlling the movement of the character and the cursor disappears?
06-27-2012 04:41 AM
Find all posts by this user Quote this message in a reply
Seba Offline
Member

Post: #2
RE: Changing mouse mode
in update:
Quote:if(inventory gui hide)
{
camera
}
else
inventory
or add bool variable and set it when I pressed.
06-27-2012 07:17 AM
Find all posts by this user Quote this message in a reply
nayon7 Offline
Member

Post: #3
RE: Changing mouse mode
I get that much, but what is the name of the function that I need to use to bind/unbind the mouse to player movement? Also what is the name of the function that I need to use to display/hide the mouse cursor?
06-27-2012 06:07 PM
Find all posts by this user Quote this message in a reply
Zervox Offline
Member

Post: #4
RE: Changing mouse mode
Code:
Ms.hide()
Ms.show()
if(Ms.hidden())
1). hides the mouse.
2). show the mouse.
3). returns bool if mouse is hidden or not.
there is no bind for player movement handled for you except if you are doing movement outside of player struct and move them in global update function or in the case you need to do what Seba said, using
Code:
if(Ginventory.hidden())
move player
else
  something else.

or
Code:
if(Gui.ms()==&Ginventory)
if mouse is inside inventory gui object do inventory related operations
else
player move specific code
(This post was last modified: 06-27-2012 07:39 PM by Zervox.)
06-27-2012 07:35 PM
Find all posts by this user Quote this message in a reply
Post Reply