Fix docs and a mouse bug

This commit is contained in:
excitedneon 2017-05-12 11:57:44 +03:00
parent e37b4af9fb
commit 27c1e7a0c4
1 changed files with 11 additions and 4 deletions

View File

@ -24,13 +24,21 @@ namespace Cyber.Controls {
private bool CursorLocked = true;
private bool RequestedLockState = true;
private bool Requested = false;
/// <summary>
/// Request a new lock state. The cursor will be locked in case there
/// isn't another reason to have it in a different state (like the
/// <see cref="DebugConsole"/> being up).
/// </summary>
/// <param name="locked">If set to <c>true</c>, cursor might bse
/// locked.</param>
public void RequestLockState(bool locked) {
RequestedLockState = locked;
Requested = true;
}
/// <summary>
/// Is the cursor currently locked?
/// </summary>
public bool Locked() {
return Term.IsVisible() || RequestedLockState;
}
@ -43,10 +51,9 @@ namespace Cyber.Controls {
if (Term.IsVisible()) {
CursorLocked = false;
UpdateCursor();
} else if (Requested) {
} else {
CursorLocked = RequestedLockState;
UpdateCursor();
Requested = false;
}
}