Exemplo n.º 1
0
        protected override void Initialize()
        {
            try
            {
                RootTag = BitIO.FromFile("ff.dat", false);
            }
            catch (Exception e)
            {
                string message = e.Message;
                BitIO.ToFile(new SharpTag(), "ff.dat", false);
                RootTag = BitIO.FromFile("ff.dat", false);
            }

            this.IsFixedTimeStep = true;
            if (RootTag.ContainsKey("SETTINGS"))
            {
                Settings.Load(RootTag.GetSharpTag("SETTINGS"));
            }
            else
            {
                Settings.Init();
            }
            Graphics.PreferredBackBufferWidth  = (int)(Settings.WindowWidth * Settings.WindowScale);
            Graphics.PreferredBackBufferHeight = (int)(Settings.WindowHeight * Settings.WindowScale);
            Graphics.ApplyChanges();

#if DEBUG
            Window.Title = "(DEBUG) Final Fantasy: Dawn of Souls";
#else
            Window.Title = "Final Fantasy: Dawn of Souls";
#endif
            Window.AllowUserResizing = false;
            Window.AllowAltF4        = false;

            MediaCache.Init(GraphicsDevice);
            InitDefaultMedia();
            InitVariables();
            base.Initialize();
        }
Exemplo n.º 2
0
        public static Map Load(string name)
        {
            SharpTag tag = BitIO.FromFile(Path.Combine("Maps", name), false);

            Map ret = new Map()
            {
                Name   = tag.GetString("mapname"),
                Width  = tag.GetInt("mapwidth"),
                Height = tag.GetInt("mapheight")
            };

            ret.Tiles = new Sprite[ret.Width, ret.Height];

            for (int i = 0; i < ret.Width; i++)
            {
                for (int j = 0; j < ret.Height; j++)
                {
                    ret.Tiles[i, j] = Sprite.Load(tag.GetSharpTag($"maptile[{i},{j}]"));
                }
            }

            return(ret);
        }