Skip to content

Commit

Permalink
Show Options button added. Screen interface updated to reflect contro…
Browse files Browse the repository at this point in the history
…ller support
  • Loading branch information
AristurtleDev committed Oct 28, 2023
1 parent 0b85ca3 commit dbf2298
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,14 @@ public class InputEngine
///////////////////////////////////////////////////////////////////////////
public VirtualButton ShowHelpButton { get; private set; }

///////////////////////////////////////////////////////////////////////////
/// Show Options Button
/// This is the command that brings up the overlay text showing the
/// options to quit or pixelcide. For Gamepad it also displays the
/// options for changing team or changing class.
///////////////////////////////////////////////////////////////////////////
public VirtualButton ShowOptionsButton { get; private set; }

///////////////////////////////////////////////////////////////////////////
/// Quit Button
/// This is the command used in conjunction with the Select Button
Expand Down Expand Up @@ -273,12 +281,14 @@ public InputEngine()
//
ChangeTeam = new VirtualButton();
ChangeTeam.Nodes.Add(new VirtualButton.Keyboard.Key(Keys.N));
ChangeTeam.Nodes.Add(new VirtualButton.GamePad.Button(Buttons.X));

//
// Change Class
//
ChangeClass = new VirtualButton();
ChangeClass.Nodes.Add(new VirtualButton.Keyboard.Key(Keys.M));
ChangeClass.Nodes.Add(new VirtualButton.GamePad.Button(Buttons.A));

//
// Say To Team
Expand All @@ -299,6 +309,13 @@ public InputEngine()
ShowHelpButton.Nodes.Add(new VirtualButton.Keyboard.Key(Keys.F1));
ShowHelpButton.Nodes.Add(new VirtualButton.GamePad.Button(Buttons.Back));

//
// Show Options Button
//
ShowOptionsButton = new VirtualButton();
ShowOptionsButton.Nodes.Add(new VirtualButton.Keyboard.Key(Keys.Escape));
ShowOptionsButton.Nodes.Add(new VirtualButton.GamePad.Button(Buttons.Start));

//
// Quit Button
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,24 +402,35 @@ public void Render(GraphicsDevice graphicsDevice)
spriteBatch.Draw(texRadarForeground, new Vector2(10, 30), Color.White);

// Draw escape message.
if (_P.inputEngine.ShowHelpButton.Check())
if (_P.inputEngine.ShowOptionsButton.Check())
{
string quitMessage = string.Empty;
string pixelcideMessage = string.Empty;
string changeTeamMessage = string.Empty;
string changeClassMessage = string.Empty;

if (_P.inputEngine.ControlType == ControlType.KeyboardMouse)
{
quitMessage = "PRESS Y TO CONFIRM THAT YOU WANT TO QUIT.";
pixelcideMessage = "PRESS K TO COMMIT PIXELCIDE.";
changeClassMessage = "PRESS M TO CHANGE CLASS";
changeTeamMessage = "PRESS N TO CHANGE TEAMS";
}
else
{
quitMessage = "PRESS (Y) Button TO CONFIRM THAT YOU WANT TO QUIT.";
pixelcideMessage = "PRESS (B) Button TO COMMIT PIXELCIDE.";
quitMessage = "PRESS (Y) BUTTON TO CONFIRM THAT YOU WANT TO QUIT.";
pixelcideMessage = "PRESS (B) BUTTON TO COMMIT PIXELCIDE.";
changeClassMessage = "PRESS (A) BUTTON TO CHANGE CLASS";
changeTeamMessage = "PRESS (X) BUTTON TO CHANGE TEAM";
}

RenderMessageCenter(spriteBatch, quitMessage, new Vector2(graphicsDevice.Viewport.Width / 2, graphicsDevice.Viewport.Height / 2 + 30), Color.White, Color.Black);
RenderMessageCenter(spriteBatch, pixelcideMessage, new Vector2(graphicsDevice.Viewport.Width / 2, graphicsDevice.Viewport.Height / 2 + 80), Color.White, Color.Black);
if (_P.inputEngine.ControlType == ControlType.GamePad)
{
RenderMessageCenter(spriteBatch, changeClassMessage, new Vector2(graphicsDevice.Viewport.Width / 2, graphicsDevice.Viewport.Height / 2 - 80), Color.White, Color.Black);
RenderMessageCenter(spriteBatch, changeTeamMessage, new Vector2(graphicsDevice.Viewport.Width / 2, graphicsDevice.Viewport.Height / 2 + 30), Color.White, Color.Black);
}
RenderMessageCenter(spriteBatch, pixelcideMessage, new Vector2(graphicsDevice.Viewport.Width / 2, graphicsDevice.Viewport.Height / 2 - 30), Color.White, Color.Black);
RenderMessageCenter(spriteBatch, quitMessage, new Vector2(graphicsDevice.Viewport.Width / 2, graphicsDevice.Viewport.Height / 2 + +80), Color.White, Color.Black);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,22 @@ public override string OnUpdate(GameTime gameTime, KeyboardState keyState, Mouse

///////////////////////////////////////////////////////////////////
/// Check if player wants to change class
/// (Keyboard only, gamepad check is during options section below)
///////////////////////////////////////////////////////////////////
if (_P.inputEngine.ChangeClass.Pressed())
if (_P.inputEngine.ChangeClass.Pressed() && _P.inputEngine.ControlType == ControlType.KeyboardMouse)
{
nextState = "Infiniminer.States.ClassSelectionState";
}

///////////////////////////////////////////////////////////////////
/// Check if player wants to change team
/// (Keyboard only, gamepad check is during options section below)
///////////////////////////////////////////////////////////////////
if (_P.inputEngine.ChangeTeam.Pressed() && _P.inputEngine.ControlType == ControlType.KeyboardMouse)
{
nextState = "Infiniminer.States.TeamSelectionState";
}

///////////////////////////////////////////////////////////////////
/// Check if player wants to enter a chat mode
///////////////////////////////////////////////////////////////////
Expand All @@ -292,7 +302,7 @@ public override string OnUpdate(GameTime gameTime, KeyboardState keyState, Mouse
///////////////////////////////////////////////////////////////////
/// Check if player want to quit match or commit pixelcide
///////////////////////////////////////////////////////////////////
if (_P.inputEngine.ShowHelpButton.Check())
if (_P.inputEngine.ShowOptionsButton.Check())
{
if (_P.inputEngine.QuitButton.Pressed())
{
Expand All @@ -304,16 +314,20 @@ public override string OnUpdate(GameTime gameTime, KeyboardState keyState, Mouse
{
_P.KillPlayer("HAS COMMITTED PIXELCIDE!");
}
}

///////////////////////////////////////////////////////////////////
/// Check if player wants to change team
///////////////////////////////////////////////////////////////////
if (_P.inputEngine.ChangeTeam.Pressed())
{
nextState = "Infiniminer.States.TeamSelectionState";
if (_P.inputEngine.ChangeTeam.Pressed())
{
nextState = "Infiniminer.States.TeamSelectionState";
}

if (_P.inputEngine.ChangeClass.Pressed())
{
nextState = "Infiniminer.States.ClassSelectionState";
}
}



///////////////////////////////////////////////////////////////////
/// Update the players position
///////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -369,7 +383,7 @@ public override string OnUpdate(GameTime gameTime, KeyboardState keyState, Mouse
///////////////////////////////////////////////////////////////////
/// Player is dead, check for respawn
///////////////////////////////////////////////////////////////////
if(_P.screenEffectCounter > 2 && _P.inputEngine.UseTool.Pressed())
if (_P.screenEffectCounter > 2 && _P.inputEngine.UseTool.Pressed())
{
_P.inputEngine.UseTool.ConsumePress();
_P.RespawnPlayer();
Expand Down

0 comments on commit dbf2298

Please sign in to comment.