Ejemplo n.º 1
0
        public static void Init(GraphicsDeviceManager graphics, SpriteBatch spriteBatch, ContentManager content)
        {
            if (Log == null)
            {
                Log = new Log();
            }
            Log.WriteLine($"{nameof(Memory)} :: {nameof(Init)}");
            Log.WriteLine($"{nameof(GraphicsDeviceManager)} :: {graphics}");
            Log.WriteLine($"{nameof(GraphicsDeviceManager)} :: {nameof(graphics.GraphicsDevice.Adapter.CurrentDisplayMode)} :: {graphics?.GraphicsDevice.Adapter.CurrentDisplayMode}");
            if (graphics != null)
            {
                foreach (DisplayMode i in graphics.GraphicsDevice.Adapter.SupportedDisplayModes)
                {
                    Log.WriteLine($"{nameof(GraphicsDeviceManager)} :: {nameof(graphics.GraphicsDevice.Adapter.SupportedDisplayModes)} :: {i}");
                }
            }
            //Log.WriteLine($"{nameof(GraphicsDeviceManager)} :: {graphics.GraphicsDevice.Adapter.DeviceName}");
            //Log.WriteLine($"{nameof(SpriteBatch)} :: {spriteBatch}");
            Log.WriteLine($"{nameof(ContentManager)} :: {content}");

            Memory.Log.WriteLine($"{nameof(Random)} :: new");
            Random = new Random((int)DateTime.Now.Ticks);
            Memory.Log.WriteLine($"{nameof(Memory)} :: {nameof(mainThreadID)} = {nameof(Thread)} :: {nameof(Thread.CurrentThread)} :: {nameof(Thread.ManagedThreadId)} = {Thread.CurrentThread.ManagedThreadId}");
            mainThreadID = Thread.CurrentThread.ManagedThreadId;
            Memory.Log.WriteLine($"{nameof(Memory)} :: {nameof(MainThreadOnlyActions)}");
            MainThreadOnlyActions = new ConcurrentQueue <Action>();

            FF8DIR = GameLocation.Current.DataPath;
            Memory.Log.WriteLine($"{nameof(Memory)} :: {nameof(FF8DIR)} = {FF8DIR}");
            FF8DIRdata = Extended.GetUnixFullPath(Path.Combine(FF8DIR, "Data"));
            Memory.Log.WriteLine($"{nameof(Memory)} :: {nameof(FF8DIRdata)} = {FF8DIRdata}");
            string testdir = Extended.GetUnixFullPath(Path.Combine(FF8DIRdata, $"lang-{Extended.GetLanguageShort()}"));

            Memory.Log.WriteLine($"{nameof(Extended)} :: {nameof(Extended.GetLanguageShort)} = {Extended.GetLanguageShort()}");
            FF8DIRdata_lang = Directory.Exists(testdir) ? testdir : FF8DIRdata;
            Memory.Log.WriteLine($"{nameof(Memory)} :: {nameof(FF8DIRdata_lang)} = {FF8DIRdata_lang}");

            Memory.graphics                = graphics;
            Memory.spriteBatch             = spriteBatch;
            Memory.content                 = content;
            Memory.FieldHolder.FieldMemory = new int[1024];

            FF8StringReference.Init();
            TokenSource = new CancellationTokenSource();
            Token       = TokenSource.Token;
            InitTask    = new Task <int>(InitTaskMethod, Token);
            InitTask.Start();
        }
Ejemplo n.º 2
0
        public static void Init(GraphicsDeviceManager graphics, SpriteBatch spriteBatch, ContentManager content)
        {
            FF8DIR     = GameLocation.Current.DataPath;
            FF8DIRdata = Extended.GetUnixFullPath(Path.Combine(FF8DIR, "Data"));
            string testdir = Extended.GetUnixFullPath(Path.Combine(FF8DIRdata, $"lang-{Extended.GetLanguageShort()}"));

            FF8DIRdata_lang = Directory.Exists(testdir) ? testdir : FF8DIRdata;

            Memory.graphics                = graphics;
            Memory.spriteBatch             = spriteBatch;
            Memory.content                 = content;
            Memory.FieldHolder.FieldMemory = new int[1024];

            FF8StringReference.Init();
            TokenSource = new CancellationTokenSource();
            Token       = TokenSource.Token;
            InitTask    = new Task <int>(InitTaskMethod, Token);
            InitTask.Start();
        }