Example #1
0
        public Input(Game game) : base(game)
        {
            keys     = new bool[256];
            oldKeys  = new bool[256];
            keyState = Keyboard.GetState();

            Controls = new ControlSet[2];

            if (!System.IO.File.Exists("keys.json"))
            {
                System.IO.File.WriteAllText("keys.json", Mix.GetString("keys.json", false));
            }
            var mapData = Json5.Parse(System.IO.File.ReadAllText("keys.json")) as List <object>;

            for (var i = 0; i < Controls.Length; i++)
            {
                Controls[i] = new ControlSet((JsonObj)mapData[i]);
            }
        }
Example #2
0
        public Character(string jsonFile, int palIndex)
        {
            if (shadow == null)
            {
                shadow = Mix.GetTexture("shadow");
            }
            if (editGreebles == null)
            {
                editGreebles = Mix.GetTexture("editor");
            }
            if (editPixel == null)
            {
                editPixel = new Texture2D(Kafe.GfxDev, 1, 1, false, SurfaceFormat.Color);
                editPixel.SetData(new[] { Color.White });
            }

            boxes    = new List <Rectangle>();
            boxTypes = new List <BoxTypes>();

            Reload(jsonFile, palIndex, false);
            Controls = Input.Controls[0];
        }