Gameplay on-screen controls are hidden, if there is no touch screen #1
This commit is contained in:
parent
8f5fd98afd
commit
1cbc13415b
@ -309,7 +309,7 @@ namespace WindowsPhoneSpeedyBlupi
|
|||||||
}
|
}
|
||||||
|
|
||||||
KeyboardState newKeyboardState = Keyboard.GetState();
|
KeyboardState newKeyboardState = Keyboard.GetState();
|
||||||
Keys[] keysToBeChecked = new Keys[6] { Keys.LeftControl, Keys.Up, Keys.Right, Keys.Down, Keys.Left, Keys.Space };
|
Keys[] keysToBeChecked = new Keys[7] { Keys.LeftControl, Keys.Up, Keys.Right, Keys.Down, Keys.Left, Keys.Space, Keys.Escape,};
|
||||||
foreach(Keys keys in keysToBeChecked) {
|
foreach(Keys keys in keysToBeChecked) {
|
||||||
if (newKeyboardState.IsKeyDown(keys)) touchesOrClicks.Add(new TinyPoint(-1, (int)keys));
|
if (newKeyboardState.IsKeyDown(keys)) touchesOrClicks.Add(new TinyPoint(-1, (int)keys));
|
||||||
}
|
}
|
||||||
@ -360,6 +360,7 @@ namespace WindowsPhoneSpeedyBlupi
|
|||||||
{
|
{
|
||||||
case Keys.LeftControl: pressedGlyph = Def.ButtonGlyph.PlayJump; pressedGlyphs.Add(pressedGlyph); break;
|
case Keys.LeftControl: pressedGlyph = Def.ButtonGlyph.PlayJump; pressedGlyphs.Add(pressedGlyph); break;
|
||||||
case Keys.Space: pressedGlyph = Def.ButtonGlyph.PlayAction; pressedGlyphs.Add(pressedGlyph); break;
|
case Keys.Space: pressedGlyph = Def.ButtonGlyph.PlayAction; pressedGlyphs.Add(pressedGlyph); break;
|
||||||
|
case Keys.Escape: pressedGlyph = Def.ButtonGlyph.PlayPause; pressedGlyphs.Add(pressedGlyph); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
83
Pixmap.cs
83
Pixmap.cs
@ -4,6 +4,7 @@ using System;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using Microsoft.Xna.Framework.Input.Touch;
|
||||||
using WindowsPhoneSpeedyBlupi;
|
using WindowsPhoneSpeedyBlupi;
|
||||||
using static System.Net.Mime.MediaTypeNames;
|
using static System.Net.Mime.MediaTypeNames;
|
||||||
using static WindowsPhoneSpeedyBlupi.Def;
|
using static WindowsPhoneSpeedyBlupi.Def;
|
||||||
@ -382,21 +383,35 @@ namespace WindowsPhoneSpeedyBlupi
|
|||||||
DrawIcon(channel, icon, rect, opacity, 0.0, useHotSpot);
|
DrawIcon(channel, icon, rect, opacity, 0.0, useHotSpot);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawIcon(int channel, int icon, TinyRect rect, double opacity, double rotation, bool useHotSpot)
|
public void DrawIcon(int channel, int icon, TinyRect rect, double opacity, double rotationDeg, bool useHotSpot)
|
||||||
{
|
{
|
||||||
if (icon == -1)
|
if (icon == -1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (channel == 14 && !TouchPanel.GetCapabilities().IsConnected)
|
||||||
|
{
|
||||||
|
int[] padGameplayIconNumbers = new int[] { 0, 1, 2, 3, 30, 12, 23 };
|
||||||
|
foreach (int iconNumber in padGameplayIconNumbers)
|
||||||
|
{
|
||||||
|
if(iconNumber == icon)
|
||||||
|
{
|
||||||
|
if(iconNumber == 1 && rect.LeftX > 100) { continue; }
|
||||||
|
//Touch display is not connected and the icon is a gameplay icon. Nothing to do.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Texture2D bitmap = GetBitmap(channel);
|
Texture2D bitmap = GetBitmap(channel);
|
||||||
if (bitmap == null)
|
if (bitmap == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int num;
|
int bitmapGridX;
|
||||||
int bitmapGridY;
|
int bitmapGridY;
|
||||||
int iconWidth;
|
int iconWidth;
|
||||||
int num2;
|
int iconHeight;
|
||||||
int gap;
|
int gap;
|
||||||
switch (channel)
|
switch (channel)
|
||||||
{
|
{
|
||||||
@ -404,95 +419,95 @@ namespace WindowsPhoneSpeedyBlupi
|
|||||||
case 11:
|
case 11:
|
||||||
case 12:
|
case 12:
|
||||||
case 13:
|
case 13:
|
||||||
num = 60;
|
bitmapGridX = 60;
|
||||||
bitmapGridY = 60;
|
bitmapGridY = 60;
|
||||||
iconWidth = 60;
|
iconWidth = 60;
|
||||||
num2 = 60;
|
iconHeight = 60;
|
||||||
gap = 0;
|
gap = 0;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
num = 64;
|
bitmapGridX = 64;
|
||||||
bitmapGridY = 64;
|
bitmapGridY = 64;
|
||||||
iconWidth = 64;
|
iconWidth = 64;
|
||||||
num2 = 64;
|
iconHeight = 64;
|
||||||
gap = 1;
|
gap = 1;
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
num = 60;
|
bitmapGridX = 60;
|
||||||
bitmapGridY = 60;
|
bitmapGridY = 60;
|
||||||
iconWidth = 60;
|
iconWidth = 60;
|
||||||
num2 = 60;
|
iconHeight = 60;
|
||||||
gap = 0;
|
gap = 0;
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
num = 144;
|
bitmapGridX = 144;
|
||||||
bitmapGridY = 144;
|
bitmapGridY = 144;
|
||||||
num2 = Tables.table_explo_size[icon];
|
iconHeight = Tables.table_explo_size[icon];
|
||||||
iconWidth = Math.Max(num2, 128);
|
iconWidth = Math.Max(iconHeight, 128);
|
||||||
gap = 0;
|
gap = 0;
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
num = 32;
|
bitmapGridX = 32;
|
||||||
bitmapGridY = 32;
|
bitmapGridY = 32;
|
||||||
iconWidth = 32;
|
iconWidth = 32;
|
||||||
num2 = 32;
|
iconHeight = 32;
|
||||||
gap = 0;
|
gap = 0;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
num = 40;
|
bitmapGridX = 40;
|
||||||
bitmapGridY = 40;
|
bitmapGridY = 40;
|
||||||
iconWidth = 40;
|
iconWidth = 40;
|
||||||
num2 = 40;
|
iconHeight = 40;
|
||||||
gap = 0;
|
gap = 0;
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
num = 140;
|
bitmapGridX = 140;
|
||||||
bitmapGridY = 140;
|
bitmapGridY = 140;
|
||||||
iconWidth = 140;
|
iconWidth = 140;
|
||||||
num2 = 140;
|
iconHeight = 140;
|
||||||
gap = 0;
|
gap = 0;
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
num = 640;
|
bitmapGridX = 640;
|
||||||
bitmapGridY = 160;
|
bitmapGridY = 160;
|
||||||
iconWidth = 640;
|
iconWidth = 640;
|
||||||
num2 = 160;
|
iconHeight = 160;
|
||||||
gap = 0;
|
gap = 0;
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
num = 410;
|
bitmapGridX = 410;
|
||||||
bitmapGridY = 380;
|
bitmapGridY = 380;
|
||||||
iconWidth = 410;
|
iconWidth = 410;
|
||||||
num2 = 380;
|
iconHeight = 380;
|
||||||
gap = 0;
|
gap = 0;
|
||||||
break;
|
break;
|
||||||
case 17:
|
case 17:
|
||||||
num = 226;
|
bitmapGridX = 226;
|
||||||
bitmapGridY = 226;
|
bitmapGridY = 226;
|
||||||
iconWidth = 226;
|
iconWidth = 226;
|
||||||
num2 = 226;
|
iconHeight = 226;
|
||||||
gap = 0;
|
gap = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
num = 0;
|
bitmapGridX = 0;
|
||||||
bitmapGridY = 0;
|
bitmapGridY = 0;
|
||||||
iconWidth = 0;
|
iconWidth = 0;
|
||||||
num2 = 0;
|
iconHeight = 0;
|
||||||
gap = 0;
|
gap = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (num != 0)
|
if (bitmapGridX != 0)
|
||||||
{
|
{
|
||||||
Rectangle srcRectangle = GetSrcRectangle(bitmap, num, bitmapGridY, iconWidth, num2, gap, icon);
|
Rectangle srcRectangle = GetSrcRectangle(bitmap, bitmapGridX, bitmapGridY, iconWidth, iconHeight, gap, icon);
|
||||||
Rectangle rectangle = GetDstRectangle(rect, iconWidth, num2, useHotSpot);
|
Rectangle rectangle = GetDstRectangle(rect, iconWidth, iconHeight, useHotSpot);
|
||||||
float num3 = 0f;
|
float rotationRad = 0f;
|
||||||
if (rotation != 0.0)
|
if (rotationDeg != 0.0)
|
||||||
{
|
{
|
||||||
num3 = (float)Misc.DegToRad(rotation);
|
rotationRad = (float)Misc.DegToRad(rotationDeg);
|
||||||
rectangle = Misc.RotateAdjust(rectangle, num3);
|
rectangle = Misc.RotateAdjust(rectangle, rotationRad);
|
||||||
}
|
}
|
||||||
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
|
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
|
||||||
spriteBatch.Draw(bitmap, rectangle, srcRectangle, Color.FromNonPremultiplied(255, 255, 255, (int)(255.0 * opacity)), num3, origin, effect, 0f);
|
spriteBatch.Draw(bitmap, rectangle, srcRectangle, Color.FromNonPremultiplied(255, 255, 255, (int)(255.0 * opacity)), rotationRad, origin, effect, 0f);
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user