fixes bugs
This commit is contained in:
parent
12bf4fd843
commit
d127436533
|
@ -78,7 +78,7 @@ namespace StardewModdingAPI
|
|||
}
|
||||
|
||||
RegisteredCommands.Add(c);
|
||||
Log.AsyncY("Registered command: " + command);
|
||||
Log.Async("Registered command: " + command);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,14 @@ namespace StardewModdingAPI.Events
|
|||
public static event EventHandler DrawTick = delegate { };
|
||||
public static event EventHandler DrawInRenderTargetTick = delegate { };
|
||||
|
||||
/// <summary>
|
||||
/// Draws when SGame.Debug is true. F3 toggles this.
|
||||
/// Game1.spriteBatch.Begin() is pre-called.
|
||||
/// Do not make end or begin calls to the spritebatch.
|
||||
/// If you are only trying to add debug information, use SGame.DebugMessageQueue in your Update loop.
|
||||
/// </summary>
|
||||
public static event EventHandler DrawDebug = delegate { };
|
||||
|
||||
public static void InvokeDrawTick()
|
||||
{
|
||||
try
|
||||
|
@ -29,5 +37,10 @@ namespace StardewModdingAPI.Events
|
|||
{
|
||||
Resize.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public static void InvokeDrawDebug(object sender, EventArgs e)
|
||||
{
|
||||
DrawDebug.Invoke(sender, e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -201,6 +201,14 @@ namespace StardewModdingAPI.Inheritance
|
|||
/// </summary>
|
||||
public static bool Debug { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// A queue of messages to log when Debug is true.
|
||||
/// If debug is false this queue will be emptied every frame.
|
||||
/// Do not add to the queue if debug is false.
|
||||
/// The queue will be drawn once every Draw update.
|
||||
/// </summary>
|
||||
public static Queue<String> DebugMessageQueue { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The current player (equal to Farmer.Player)
|
||||
/// </summary>
|
||||
|
@ -363,6 +371,7 @@ namespace StardewModdingAPI.Inheritance
|
|||
{
|
||||
Log.AsyncY("XNA Initialize");
|
||||
//ModItems = new Dictionary<int, SObject>();
|
||||
DebugMessageQueue = new Queue<string>();
|
||||
PreviouslyPressedButtons = new Buttons[4][];
|
||||
for (var i = 0; i < 4; ++i) PreviouslyPressedButtons[i] = new Buttons[0];
|
||||
|
||||
|
@ -499,9 +508,22 @@ namespace StardewModdingAPI.Inheritance
|
|||
if (Debug)
|
||||
{
|
||||
spriteBatch.Begin();
|
||||
spriteBatch.DrawString(dialogueFont, "FPS: " + FramesPerSecond, Vector2.Zero, Color.CornflowerBlue);
|
||||
spriteBatch.DrawString(smoothFont, "FPS: " + FramesPerSecond, Vector2.Zero, Color.CornflowerBlue);
|
||||
|
||||
int i = 1;
|
||||
while (DebugMessageQueue.Any())
|
||||
{
|
||||
string s = DebugMessageQueue.Dequeue();
|
||||
spriteBatch.DrawString(smoothFont, s, new Vector2(0, i * 12), Color.CornflowerBlue);
|
||||
i++;
|
||||
}
|
||||
GraphicsEvents.InvokeDrawDebug(null, null);
|
||||
spriteBatch.End();
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugMessageQueue.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("Do not use at this time.")]
|
||||
|
|
Loading…
Reference in New Issue