mode state

This commit is contained in:
ikpil 2023-06-14 00:00:45 +09:00
parent 75295cf463
commit d17b6c13c6
2 changed files with 7 additions and 7 deletions

View File

@ -74,7 +74,7 @@ public class RecastDemo
private bool processHitTest = false; private bool processHitTest = false;
private bool processHitTestShift; private bool processHitTestShift;
private int modState; private int _modState;
private readonly float[] mousePos = new float[2]; private readonly float[] mousePos = new float[2];
@ -190,7 +190,7 @@ public class RecastDemo
public void OnMouseUpAndDown(IMouse mouse, MouseButton button, bool down) public void OnMouseUpAndDown(IMouse mouse, MouseButton button, bool down)
{ {
modState = 0; _modState = 0;
if (down) if (down)
{ {
if (button == MouseButton.Right) if (button == MouseButton.Right)
@ -241,8 +241,7 @@ public class RecastDemo
if (!_mouseOverMenu) if (!_mouseOverMenu)
{ {
processHitTest = true; processHitTest = true;
//processHitTestShift = (mods & Keys.GLFW_MOD_SHIFT) != 0 ? true : false; processHitTestShift = _modState != 0 ? true : false;
//processHitTestShift = (mods & Keys.) != 0 ? true : false;
} }
} }
else if (button == MouseButton.Middle) else if (button == MouseButton.Middle)
@ -411,7 +410,7 @@ public class RecastDemo
var tempMoveDown = keyboard.IsKeyPressed(Key.E) || keyboard.IsKeyPressed(Key.PageDown) ? 1.0f : -1f; var tempMoveDown = keyboard.IsKeyPressed(Key.E) || keyboard.IsKeyPressed(Key.PageDown) ? 1.0f : -1f;
var tempMoveAccel = keyboard.IsKeyPressed(Key.ShiftLeft) || keyboard.IsKeyPressed(Key.ShiftRight) ? 1.0f : -1f; var tempMoveAccel = keyboard.IsKeyPressed(Key.ShiftLeft) || keyboard.IsKeyPressed(Key.ShiftRight) ? 1.0f : -1f;
modState = keyboard.IsKeyPressed(Key.ControlLeft) || keyboard.IsKeyPressed(Key.ShiftRight) ? 1 : 0; _modState |= keyboard.IsKeyPressed(Key.ControlLeft) || keyboard.IsKeyPressed(Key.ShiftLeft) || keyboard.IsKeyPressed(Key.ShiftRight) ? 1 : 0;
_moveFront = Clamp(_moveFront + tempMoveFront * dt * 4.0f, 0, 2.0f); _moveFront = Clamp(_moveFront + tempMoveFront * dt * 4.0f, 0, 2.0f);
_moveLeft = Clamp(_moveLeft + tempMoveLeft * dt * 4.0f, 0, 2.0f); _moveLeft = Clamp(_moveLeft + tempMoveLeft * dt * 4.0f, 0, 2.0f);
_moveBack = Clamp(_moveBack + tempMoveBack * dt * 4.0f, 0, 2.0f); _moveBack = Clamp(_moveBack + tempMoveBack * dt * 4.0f, 0, 2.0f);
@ -652,7 +651,7 @@ public class RecastDemo
if (hit.HasValue) if (hit.HasValue)
{ {
float hitTime = hit.Value; float hitTime = hit.Value;
if (0 != modState) if (0 != _modState)
{ {
// Marker // Marker
markerPositionSet = true; markerPositionSet = true;
@ -674,7 +673,7 @@ public class RecastDemo
} }
else else
{ {
if (0 != modState) if (0 != _modState)
{ {
// Marker // Marker
markerPositionSet = false; markerPositionSet = false;

View File

@ -35,6 +35,7 @@ namespace DotRecast.Recast.Demo.Tools;
public class ConvexVolumeTool : IRcTool public class ConvexVolumeTool : IRcTool
{ {
private readonly ConvexVolumeToolImpl _impl; private readonly ConvexVolumeToolImpl _impl;
private int areaTypeValue = SampleAreaModifications.SAMPLE_AREAMOD_GRASS.Value; private int areaTypeValue = SampleAreaModifications.SAMPLE_AREAMOD_GRASS.Value;
private AreaModification areaType = SampleAreaModifications.SAMPLE_AREAMOD_GRASS; private AreaModification areaType = SampleAreaModifications.SAMPLE_AREAMOD_GRASS;
private float boxHeight = 6f; private float boxHeight = 6f;