예제 #1
0
        private KeyBinds GetKeyBindings()
        {
            var keyBinds = new KeyBinds();

            keyBinds.Bind(Keys.Left, 0, InputCommands.MoveLeft);
            keyBinds.Bind(Keys.Up, 0, InputCommands.MoveUp);
            keyBinds.Bind(Keys.Right, 0, InputCommands.MoveRight);
            keyBinds.Bind(Keys.Down, 0, InputCommands.MoveDown);
            keyBinds.Bind(Keys.Z, 0, InputCommands.Fire);
            return(keyBinds);
        }
예제 #2
0
        private void GlControl1_ContextCreated(object sender, GlControlEventArgs e)
        {
            game = new Game.Game();
            game.World.DebugEvents.EntityAdded   += DebugEvents_EntityAdded;
            game.World.DebugEvents.EntityRemoved += DebugEvents_EntityRemoved;

            game.Init();
            renderer  = game.World.GetDependency <Renderer>();
            keyBinds  = GetKeyBindings();
            stopwatch = new Stopwatch();

            timescaleInput.ValidatingType = typeof(float);
            timestepInput.ValidatingType  = typeof(float);
            Gl.Enable(EnableCap.Blend);
            Gl.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);
            previousTime = stopwatch.Elapsed.TotalSeconds;
        }