Detailed debugging was modified

This commit is contained in:
Robert Vokac 2025-02-01 14:01:53 +01:00
parent add7c762a4
commit e1a420053c
3 changed files with 40 additions and 23 deletions

18
DDebug.cs Normal file
View File

@ -0,0 +1,18 @@
using System;
using System.Diagnostics;
using static WindowsPhoneSpeedyBlupi.EnvClasses;
namespace WindowsPhoneSpeedyBlupi
{
public static class DDebug
{
private static bool DETAILED_DEBUGGING { get; set; }
public static void WriteLine(String msg)
{
if (DETAILED_DEBUGGING)
{
Debug.WriteLine(msg);
}
}
}
}

3
Env.cs
View File

@ -1,12 +1,11 @@
using System; using System;
using System.Diagnostics;
using static WindowsPhoneSpeedyBlupi.EnvClasses; using static WindowsPhoneSpeedyBlupi.EnvClasses;
namespace WindowsPhoneSpeedyBlupi namespace WindowsPhoneSpeedyBlupi
{ {
public static class Env public static class Env
{ {
public static bool DETAILED_DEBUGGING { get; set; }
public static Platform PLATFORM { get; private set; } public static Platform PLATFORM { get; private set; }
public static Impl IMPL { get; private set; } public static Impl IMPL { get; private set; }
public static bool INITIALIZED { get; private set; } public static bool INITIALIZED { get; private set; }

View File

@ -288,14 +288,14 @@ namespace WindowsPhoneSpeedyBlupi
float widthHeightRatio = screenWidth / screenHeight; float widthHeightRatio = screenWidth / screenHeight;
float heightRatio = 480 / screenHeight; float heightRatio = 480 / screenHeight;
float widthRatio = 640 / screenWidth; float widthRatio = 640 / screenWidth;
if(Env.DETAILED_DEBUGGING)
{ {
Debug.WriteLine("-----"); DDebug.WriteLine("-----");
Debug.WriteLine("originalX=" + originalX); DDebug.WriteLine("originalX=" + originalX);
Debug.WriteLine("originalY=" + originalY); DDebug.WriteLine("originalY=" + originalY);
Debug.WriteLine("heightRatio=" + heightRatio); DDebug.WriteLine("heightRatio=" + heightRatio);
Debug.WriteLine("widthRatio=" + widthRatio); DDebug.WriteLine("widthRatio=" + widthRatio);
Debug.WriteLine("widthHeightRatio=" + widthHeightRatio); DDebug.WriteLine("widthHeightRatio=" + widthHeightRatio);
} }
if (screenHeight> 480) { if (screenHeight> 480) {
touchOrClick.X = (int)(originalX * heightRatio); touchOrClick.X = (int)(originalX * heightRatio);
@ -303,8 +303,8 @@ namespace WindowsPhoneSpeedyBlupi
touchesOrClicks[i] = touchOrClick; touchesOrClicks[i] = touchOrClick;
} }
if(Env.DETAILED_DEBUGGING) Debug.WriteLine("new X" + touchOrClick.X); DDebug.WriteLine("new X" + touchOrClick.X);
if(Env.DETAILED_DEBUGGING) Debug.WriteLine("new Y" + touchOrClick.Y); DDebug.WriteLine("new Y" + touchOrClick.Y);
} }
} }
@ -316,7 +316,7 @@ namespace WindowsPhoneSpeedyBlupi
if (newKeyboardState.IsKeyDown(Keys.F11)) if (newKeyboardState.IsKeyDown(Keys.F11))
{ {
game1.ToggleFullScreen (); game1.ToggleFullScreen ();
Debug.WriteLine("F11 was pressed."); DDebug.WriteLine("F11 was pressed.");
} }
Boolean keyPressedUp = false; Boolean keyPressedUp = false;
@ -347,9 +347,9 @@ namespace WindowsPhoneSpeedyBlupi
{ {
padPressed = true; padPressed = true;
} }
Debug.WriteLine("padPressed=" + padPressed); DDebug.WriteLine("padPressed=" + padPressed);
Def.ButtonGlyph pressedGlyph = ButtonDetect(touchOrClick); Def.ButtonGlyph pressedGlyph = ButtonDetect(touchOrClick);
Debug.WriteLine("buttonGlyph2 =" + pressedGlyph); DDebug.WriteLine("buttonGlyph2 =" + pressedGlyph);
if (pressedGlyph != 0) if (pressedGlyph != 0)
{ {
pressedGlyphs.Add(pressedGlyph); pressedGlyphs.Add(pressedGlyph);
@ -370,7 +370,7 @@ namespace WindowsPhoneSpeedyBlupi
switch (pressedGlyph) switch (pressedGlyph)
{ {
case Def.ButtonGlyph.PlayJump: case Def.ButtonGlyph.PlayJump:
Debug.WriteLine("Jumping detected"); DDebug.WriteLine("Jumping detected");
accelWaitZero = false; accelWaitZero = false;
keyPress |= 1; keyPress |= 1;
break; break;
@ -438,14 +438,14 @@ namespace WindowsPhoneSpeedyBlupi
lastButtonDown = buttonGlyph; lastButtonDown = buttonGlyph;
if (padPressed) if (padPressed)
{ {
Debug.WriteLine("PadCenter.X=" + PadCenter.X); DDebug.WriteLine("PadCenter.X=" + PadCenter.X);
Debug.WriteLine("PadCenter.Y=" + PadCenter.Y); DDebug.WriteLine("PadCenter.Y=" + PadCenter.Y);
Debug.WriteLine("padTouchPos.X=" + padTouchPos.X); DDebug.WriteLine("padTouchPos.X=" + padTouchPos.X);
Debug.WriteLine("padTouchPos.Y=" + padTouchPos.Y); DDebug.WriteLine("padTouchPos.Y=" + padTouchPos.Y);
Debug.WriteLine("keyPressedUp=" + keyPressedUp); DDebug.WriteLine("keyPressedUp=" + keyPressedUp);
Debug.WriteLine("keyPressedDown=" + keyPressedDown); DDebug.WriteLine("keyPressedDown=" + keyPressedDown);
Debug.WriteLine("keyPressedLeft=" + keyPressedLeft); DDebug.WriteLine("keyPressedLeft=" + keyPressedLeft);
Debug.WriteLine(" keyPressedRight=" + keyPressedRight); DDebug.WriteLine("keyPressedRight=" + keyPressedRight);
{ {
if (keyPressedUp) if (keyPressedUp)
{ {