private void UpdateDebugScreen(Time time) { if (DebugKeyEnabled && Keyboard.GetKeyState(Key.F12) == ButtonState.Pressed) { DebugScreenVisible = !DebugScreenVisible; } DebugLayer.Update(time); if (!DebugScreenVisible) { return; } FPSDisplay.Text = fpsText; layerTextBuilder.Clear(); layerTextBuilder.Append(layerTextTitle); for (int i = Layers.FirstIndex; i <= Layers.LastIndex; i++) { layerTextBuilder.Append("["); layerTextBuilder.Append(i); layerTextBuilder.Append("]: "); layerTextBuilder.Append(Layers[i].Objects.Count); layerTextBuilder.AppendLine(); } LayerDisplay.Text = layerTextBuilder.ToString(); LayerWindow.Size = LayerDisplay.Size; }
static public DebugLayer get() { if (manager == null) { manager = GameObject.FindObjectOfType <DebugLayer>(); } return(manager); }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.White); spriteBatch.Begin(); _Map.draw(ref spriteBatch); //Grid should not be drawn inside of SpriteBatch.begin DebugLayer.draw(ref spriteBatch); _Bot.draw(ref spriteBatch); spriteBatch.End(); base.Draw(gameTime); }
private void DrawDebugScreen() { if (!DebugScreenVisible) { return; } debugCanvas.Begin(ref canvasTransform, Game.Screen); PaintDebugScreen(debugCanvas); debugCanvas.End(); DebugLayer.Draw(Camera); }
protected override void Load() { _testScene = new TestScene(this); CurrentScene = _testScene; DebugLayer.Init(this); Input.OnKeyDown += delegate(Key key) { if (key == Key.F1) { DebugLayer.Active = !DebugLayer.Active; } }; }
/// <summary> /// Log the current instance /// </summary> /// <param name="message"></param> /// <param name="layer"></param> public static void Log(string message, DebugLayer layer = DebugLayer.Game, DebugLevel level = DebugLevel.Information) { if (!debug) { return; } if (disabledDebugLayers[(int)layer]) { return; } string print = string.Format("{0} {1} Time: {2}", layer, message, DateTime.Now.TimeOfDay); Console.ForegroundColor = (ConsoleColor)level; Console.WriteLine(print); }
public void CalPrediction() { var FileName = "cal_deep_test.tsv"; var ini = new IniReader(@"cal.model.ini", 4096, 102); double weightscale = 1e+6; var readerLayer = new LLSingleLineReader() { FileName = FileName, SparseFormat = true, NormalizationFactor = 1.0, Scale = 1E+10, }; var debugLayer = new DebugLayer() { Source = readerLayer }; var encryptLayer = new EncryptLayer() { Source = debugLayer }; var denseLayer = new LLDenseLayer() { Source = encryptLayer, Weights = ini.Weights, Bias = ini.Bias, WeightsScale = weightscale, InputFormat = EVectorFormat.dense }; var network = denseLayer; network.PrepareNetwork(); var pred = network.GetNext().GetColumn(0).Decrypt(null); Assert.AreEqual(102, pred.Count); for (int i = 0; i < 10; i++) { Assert.AreEqual(debugLayer.scores[i], pred[i], 1e-3); } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here _Bot.LoadContent(this.Content); _Map.LoadContent(this.Content); DebugLayer.LoadContent(this.Content); DebugLayer.setDebugColors(Color.Yellow, Color.Blue, Color.Red); //Test debugLayeMap /* communication.DebugGridPoint[] points = new communication.DebugGridPoint[100*100]; * Random random = new Random(); * for(int x = 0; x < 100; x++) * { * for(int y = 0; y < 100; y++) * { * int i = random.Next(0,3); * switch (i) * { * case 0: * points[y * 100 + x] = new communication.DebugGridPoint(x * 10 + 500, y * 10 + 500, communication.DebugGridPointStatus.Wall); * break; * case 1: * points[y * 100 + x] = new communication.DebugGridPoint(x * 10 + 500, y * 10 + 500, communication.DebugGridPointStatus.Valid); * break; * case 2: * points[y * 100 + x] = new communication.DebugGridPoint(x * 10 + 500, y * 10 + 500, communication.DebugGridPointStatus.Invalid); * break; * } * * } * } * DebugLayer.setDebugMap(points, 50); */ }
private void InitDebugScreen() { debugCanvas = new Canvas(); DebugLayer = Layer.CreateStaticLayer(); DebugLayer.Objects.ItemAdded += OnObjectAdded; DebugLayer.Objects.ItemRemoved += OnObjectRemoved; FPSWindow = new Jypeli.Window(); FPSWindow.IsModal = false; FPSWindow.Color = new Color(Color.HotPink, 100); DebugLayer.Add(FPSWindow); FPSDisplay = new Label("00"); FPSDisplay.Color = Color.HotPink; FPSWindow.Size = 1.5 * FPSDisplay.Size; FPSWindow.Add(FPSDisplay); FPSWindow.Right = Screen.Right - Screen.Width / 16; FPSWindow.Top = Screen.Top; LayerWindow = new Jypeli.Window(); LayerWindow.IsModal = false; LayerWindow.Color = new Color(Color.Blue, 100); DebugLayer.Add(LayerWindow); LayerDisplay = new Label("Layers: no data"); LayerDisplay.TextColor = Color.White; LayerWindow.Add(LayerDisplay); LayerWindow.Size = LayerDisplay.Size; LayerWindow.Left = Screen.Left; LayerWindow.Top = Screen.Top - 200; DebugKeyEnabled = true; DebugScreenVisible = false; }
public static void Draw(this SpriteBatch spriteBatch, GameTime time, DebugLayer grid, Vector2 parralax) { grid.Draw(time, spriteBatch, parralax); }
public static void Draw(this SpriteBatch spriteBatch, GameTime time, DebugLayer grid) { grid.Draw(time, spriteBatch, Vector2.One); }
public void ThreadPoolCallback(Object threadContext) { DebugLayer.setDebugMap(_Map, _GridWidth); _CallBack.ice_response(); }
public static void Draw(this SpriteBatch spriteBatch, DebugLayer grid) { grid.Draw(spriteBatch, Vector2.One); }
protected override void Draw() { DebugLayer.Draw(SpriteBatch); }
protected override void Update(float deltaTime) { _deltaTime = deltaTime; DebugLayer.Update(deltaTime); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) { this.Exit(); } //Sensor s = new Sensor(); //s.checkLeftSensor(ref map, Vector2.Zero,(float) Math.PI / 2.0f); //this.Exit(); previousKState = currentKState; currentKState = Keyboard.GetState(); previousMState = currentMState; currentMState = Mouse.GetState(); _debugIndex = DebugLayer.addString("Mouse X: " + currentMState.X + " Y: " + currentMState.Y, _debugIndex); handyDummy.updateInput(currentKState, previousKState); handyDummy.update(_DataHandler); if (currentKState.IsKeyDown(Keys.LeftControl) && currentKState.IsKeyDown(Keys.D) && previousKState.IsKeyUp(Keys.D)) { DebugLayer.DebugActivated = !DebugLayer.DebugActivated; } if (currentKState.IsKeyDown(Keys.LeftControl) && currentKState.IsKeyDown(Keys.G) && previousKState.IsKeyUp(Keys.G)) { _Map.drawGrid = !_Map.drawGrid; } if (currentKState.IsKeyDown(Keys.LeftControl) && currentKState.IsKeyDown(Keys.W) && previousKState.IsKeyUp(Keys.W)) { _Map.drawMap = !_Map.drawMap; } if (currentKState.IsKeyDown(Keys.LeftControl) && currentKState.IsKeyDown(Keys.B) && previousKState.IsKeyUp(Keys.B)) { _Bot.DrawBot = !_Bot.DrawBot; } if (currentKState.IsKeyDown(Keys.LeftControl) && currentKState.IsKeyDown(Keys.M) && previousKState.IsKeyUp(Keys.M)) { _Map.editMode = !_Map.editMode; if (!_Map.editMode) { Map.SerializeToXML(ref _Map, Content.RootDirectory); } } if (_Map.editMode) { if (currentMState.LeftButton == ButtonState.Pressed && previousMState.LeftButton == ButtonState.Released) { _Map.click(currentMState.X, currentMState.Y); } } // TODO: Add your update logic here _Bot.update(gameTime); _DataHandler.update(gameTime); base.Update(gameTime); }
/// <summary> /// Sets whether the current layer should be disabled or enabled for debugging /// </summary> /// <param name="layer"></param> /// <param name="activation"></param> public static void SetLayer(DebugLayer layer, bool activation) { disabledDebugLayers[(int)layer] = activation; }