Playground now has more control; Implemented framework changes.
Live framerate and update rate changing commands added.
This commit is contained in:
parent
c28261dcfa
commit
d8eda24809
@ -14,7 +14,7 @@ namespace SlatedGameToolkit.Tools.Commands
|
||||
|
||||
public bool Execute(IInteractable interactable, string[] args)
|
||||
{
|
||||
if (args.Length != 1) return false;
|
||||
if (args.Length < 1) return false;
|
||||
args[0] = args[0].ToLower();
|
||||
if (args[0].Equals("start")) {
|
||||
if (GameEngine.IsRunning()) {
|
||||
@ -34,7 +34,7 @@ namespace SlatedGameToolkit.Tools.Commands
|
||||
interactable.Tell("Running: " + GameEngine.IsRunning());
|
||||
interactable.Tell("Target FPS: " + (GameEngine.targetFPS <= 0 ? "Not bounded." : GameEngine.targetFPS.ToString()));
|
||||
interactable.Tell("Update Step: " + (GameEngine.UpdatesPerSecond <= 0 ? "Not Locked." : GameEngine.UpdatesPerSecond.ToString()));
|
||||
interactable.Tell("Debug logging: " + logListener.Debug);
|
||||
interactable.Tell("Debug logging: " + ((logListener == null) ? "false" : "true"));
|
||||
return true;
|
||||
} else if (args[0].Equals("debug")) {
|
||||
if (logListener == null) {
|
||||
@ -56,13 +56,31 @@ namespace SlatedGameToolkit.Tools.Commands
|
||||
interactable.Tell("Stopped listening to game engine's logging.");
|
||||
}
|
||||
return true;
|
||||
} else if (args[0].Equals("updates")) {
|
||||
int updates;
|
||||
if (args.Length < 2 || !int.TryParse(args[1], out updates)) {
|
||||
interactable.Tell("Missing numerical value dictating updates per second.");
|
||||
} else {
|
||||
GameEngine.UpdatesPerSecond = updates;
|
||||
interactable.Tell("Target updates per second set to: " + updates);
|
||||
}
|
||||
return true;
|
||||
} else if (args[0].Equals("framerate")) {
|
||||
int frames;
|
||||
if (args.Length < 2 || !int.TryParse(args[1], out frames)) {
|
||||
interactable.Tell("Missing numerical value dictating framerate.");
|
||||
} else {
|
||||
GameEngine.targetFPS = frames;
|
||||
interactable.Tell("Target framerate set to: " + frames);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public string getDescription()
|
||||
{
|
||||
return "Starts and stops the graphical playground.";
|
||||
return "Controls the playground engine status.";
|
||||
}
|
||||
|
||||
public string[] GetInvokers()
|
||||
@ -72,7 +90,7 @@ namespace SlatedGameToolkit.Tools.Commands
|
||||
|
||||
public string getUsage(string arg)
|
||||
{
|
||||
return "Usage: \"playground [start | stop | status]\" the required argument being whether to start, stop or get the current status of the game engine.";
|
||||
return "\"playground [start | stop | status | log | debug | framerate <framerate> | updates <update rate>]\"";
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
@ -84,7 +84,8 @@ namespace SlatedGameToolkit.Tools.Utilities.Playground
|
||||
|
||||
public void Render(double delta)
|
||||
{
|
||||
renderer.Begin(Matrix4x4.Identity, delta);
|
||||
camera.InterpolatePosition(delta);
|
||||
renderer.Begin(Matrix4x4.Identity);
|
||||
renderer.Draw(logo);
|
||||
renderer.Draw(textureTester);
|
||||
renderer.Draw(untextured);
|
||||
|
Loading…
Reference in New Issue
Block a user