Exemplo n.º 1
0
        public void PopHp(int tag, Transform trans, int hpType, int hp)
        {
            BubbleInfo info   = new BubbleInfo(hp.ToString(), 0f, textColor[hpType]);
            InfoQueue  iqueue = PushBubbleInfo(tag, 2, info);

            iqueue.Follow(trans);
        }
Exemplo n.º 2
0
 protected override void ShowState()
 {
     InfoQueue.Enqueue("State of Car");
     InfoQueue.Enqueue($"1.[Engine] {ShowInfo(Car.Engine)}");
     InfoQueue.Enqueue($"2.[Accumulator] {ShowInfo(Car.Accumulator)}");
     InfoQueue.Enqueue($"3.[Left front disk] {ShowInfo(Car.Disks[0])}");
     InfoQueue.Enqueue($"4.[Right front disk] {ShowInfo(Car.Disks[1])}");
     InfoQueue.Enqueue($"5.[Left rear disk] {ShowInfo(Car.Disks[2])}");
     InfoQueue.Enqueue($"6.[Right rear disk] {ShowInfo(Car.Disks[3])}");
 }
Exemplo n.º 3
0
        public string[] GetInfo()
        {
            List <string> list = new List <string>();

            while (InfoQueue.Any())
            {
                list.Add(InfoQueue.Dequeue());
            }

            return(list.ToArray());
        }
Exemplo n.º 4
0
        public void Bubble(int tag, int kindIdx, Transform trans, string txt, float duration)
        {
            if (kindIdx < 0 || kindIdx >= kindItems.Count)
            {
                return;
            }
            BubbleInfo info   = new BubbleInfo(txt, duration);
            InfoQueue  iqueue = PushBubbleInfo(tag, kindIdx, info);

            iqueue.Follow(trans);
        }
Exemplo n.º 5
0
 static private void InitDebugOutput()
 {
     if (VRage.MyCompilationSymbols.DX11Debug && VRage.MyCompilationSymbols.DX11DebugOutput)
     {
         DebugInfoQueue = Device.QueryInterface <InfoQueue>();
         DebugInfoQueue.SetBreakOnSeverity(MessageSeverity.Corruption, true);
         DebugInfoQueue.SetBreakOnSeverity(MessageSeverity.Error, true);
         DebugInfoQueue.MessageCountLimit = 4096;
         DebugInfoQueue.ClearStorageFilter();
     }
 }
Exemplo n.º 6
0
        public GraphicsDebug(GraphicsDevice device)
        {
            _device         = device;
            _infoQueue      = _device._d3dDevice.QueryInterfaceOrNull <InfoQueue>();
            _cachedMessages = new Queue <GraphicsDebugMessage>();

            if (_infoQueue != null)
            {
                _infoQueue.PushEmptyRetrievalFilter();
                _infoQueue.PushEmptyStorageFilter();
                _hasPushedFilters = true;
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="device">Device</param>
        /// <param name="breakOnWarning">Generate an error on warning</param>
        public SharpDebugger(SharpDevice device, bool breakOnWarning)
        {
            _device = device;
            //init the debug device
            Debug = new DeviceDebug(device.Device);
            //init the queue interface
            Queue = Debug.QueryInterface <InfoQueue>();

            if (breakOnWarning)
            {
                Queue.SetBreakOnSeverity(MessageSeverity.Warning, true);
            }
        }
Exemplo n.º 8
0
        private void MainWindow_OnKeyUp(object sender, KeyEventArgs e) //Allow user to refresh the book list with F5
        {
            switch (e.Key)
            {
            case Key.F5:
                BookGridReload();     //Reload grid
                break;

            case Key.F12:
                //Clear the info stack
                InfoQueue.Clear();
                Info(UiLang.Get("InfoQueueDeleted"));
                break;
            }
        }
Exemplo n.º 9
0
        protected override int RequestChoice()
        {
            Choice = null;
            InfoQueue.Enqueue("1-Move");
            InfoQueue.Enqueue("2-End Game");
            InfoQueue.Enqueue("3x-Repair");
            InfoQueue.Enqueue("4x-Replace");

            while (!Choice.HasValue)
            {
                Thread.Sleep(1);
            }

            return(Choice.Value);
        }
Exemplo n.º 10
0
        private InfoQueue PushBubbleInfo(int tag, int kindIdx, BubbleInfo info)
        {
            long      key     = GetKey(tag, kindIdx);
            InfoQueue infoQue = null;

            if (waitings.ContainsKey(key))
            {
                infoQue = waitings[key];
            }
            else
            {
                infoQue        = new InfoQueue();
                infoQue.ItemGo = kindItems[kindIdx].CachedGo;
                waitings.Add(key, infoQue);
            }
            infoQue.Push(info);
            return(infoQue);
        }
Exemplo n.º 11
0
 public void Loaded(DbConfigurationLoadedEventArgs loadedEventArgs,
                    DbConfigurationInterceptionContext interceptionContext)
 {
     var logger = new ExceptionLogger();
     _baseInfoQueue = new InfoQueue<BaseInfo>();
     var profiler = new DbProfiler(_baseInfoQueue)
     {
         AssembliesToExclude = new SortedSet<string>
         {
             typeof(DbProfiler).Assembly.GetName().Name,
             typeof(DatabaseLogger).Assembly.GetName().Name
         }
     };
     DbInterception.Add(new DatabaseInterceptor(profiler));
     _commandsTransmitter = new CommandsTransmitter(
         _baseInfoQueue, logger, new SimpleHttp(), _serverUri, LoggerPath.GetLogFileFullPath(_logFilePath));
     _commandsTransmitter.Start();
 }
Exemplo n.º 12
0
 static private void InitDebugOutput()
 {
     if (VRage.MyCompilationSymbols.DX11Debug && VRage.MyCompilationSymbols.DX11DebugOutput)
     {
         DebugInfoQueue = Device.QueryInterface <InfoQueue>();
         DebugInfoQueue.SetBreakOnSeverity(MessageSeverity.Corruption, true);
         DebugInfoQueue.SetBreakOnSeverity(MessageSeverity.Error, true);
         DebugInfoQueue.MessageCountLimit = 4096;
         DebugInfoQueue.ClearStorageFilter();
         if (!VRage.MyCompilationSymbols.DX11DebugOutputEnableInfo)
         {
             InfoQueueFilter filter = new InfoQueueFilter();
             filter.DenyList               = new InfoQueueFilterDescription();
             filter.DenyList.Severities    = new MessageSeverity[1];
             filter.DenyList.Severities[0] = MessageSeverity.Information;
             DebugInfoQueue.AddStorageFilterEntries(filter);
         }
     }
 }
Exemplo n.º 13
0
        public void RemoveBubbleInfo(int tag, int kindIdx)
        {
            if (kindIdx < 0 || kindIdx >= kindItems.Count)
            {
                return;
            }
            long key = GetKey(tag, kindIdx);

            if (waitings.ContainsKey(key))
            {
                InfoQueue iqueue = waitings[key];
                if (null != iqueue)
                {
                    iqueue.ReleaseItem();
                }

                waitings.Remove(key);
            }
        }
Exemplo n.º 14
0
 private DatabaseLogger()
 {
     AppDomain.MonitoringIsEnabled = true;
     var logger = new ExceptionLogger();
     var baseInfoQueue = new InfoQueue<BaseInfo>();
     Profiler = new DbProfiler(baseInfoQueue)
     {
         AssembliesToExclude = new SortedSet<string>
         {
             typeof(DbProfiler).Assembly.GetName().Name,
             typeof(DatabaseLogger).Assembly.GetName().Name
         }
     };
     var serverUri = new Uri(ConfigSetGet.GetConfigData("DNTProfilerServerUri"));
     var logFilePath = ConfigSetGet.GetConfigData("DNTProfilerLogFilePath");
     var commandsTransmitter = new CommandsTransmitter(
         baseInfoQueue, logger, new SimpleHttp(), serverUri, LoggerPath.GetLogFileFullPath(logFilePath));
     commandsTransmitter.Start();
 }
Exemplo n.º 15
0
        public void Loaded(DbConfigurationLoadedEventArgs loadedEventArgs,
                           DbConfigurationInterceptionContext interceptionContext)
        {
            var logger = new ExceptionLogger();

            _baseInfoQueue = new InfoQueue <BaseInfo>();
            var profiler = new DbProfiler(_baseInfoQueue)
            {
                AssembliesToExclude = new SortedSet <string>
                {
                    typeof(DbProfiler).Assembly.GetName().Name,
                    typeof(DatabaseLogger).Assembly.GetName().Name
                }
            };

            DbInterception.Add(new DatabaseInterceptor(profiler));
            _commandsTransmitter = new CommandsTransmitter(
                _baseInfoQueue, logger, new SimpleHttp(), _serverUri, LoggerPath.GetLogFileFullPath(_logFilePath));
            _commandsTransmitter.Start();
        }
Exemplo n.º 16
0
        private DatabaseLogger()
        {
            AppDomain.MonitoringIsEnabled = true;
            var logger        = new ExceptionLogger();
            var baseInfoQueue = new InfoQueue <BaseInfo>();

            Profiler = new DbProfiler(baseInfoQueue)
            {
                AssembliesToExclude = new SortedSet <string>
                {
                    typeof(DbProfiler).Assembly.GetName().Name,
                    typeof(DatabaseLogger).Assembly.GetName().Name
                }
            };
            var serverUri           = new Uri(ConfigSetGet.GetConfigData("DNTProfilerServerUri"));
            var logFilePath         = ConfigSetGet.GetConfigData("DNTProfilerLogFilePath");
            var commandsTransmitter = new CommandsTransmitter(
                baseInfoQueue, logger, new SimpleHttp(), serverUri, LoggerPath.GetLogFileFullPath(logFilePath));

            commandsTransmitter.Start();
        }
Exemplo n.º 17
0
        internal static MyRenderDeviceSettings CreateDevice(IntPtr windowHandle, MyRenderDeviceSettings?settingsToTry)
        {
            if (Device != null)
            {
                Device.Dispose();
                Device = null;
            }

            FeatureLevel[]      featureLevels = { FeatureLevel.Level_11_0 };
            DeviceCreationFlags flags         = DeviceCreationFlags.None;

    #if DEBUG_DEVICE
            flags |= DeviceCreationFlags.Debug;
    #endif

            WinApi.DEVMODE mode = new WinApi.DEVMODE();
            WinApi.EnumDisplaySettings(null, WinApi.ENUM_REGISTRY_SETTINGS, ref mode);

            var adapters = GetAdaptersList();

            int adapterIndex = settingsToTry.HasValue ? settingsToTry.Value.AdapterOrdinal : -1;
            adapterIndex = ValidateAdapterIndex(adapterIndex);

            if (adapterIndex == -1)
            {
                throw new MyRenderException("No supporting device detected!", MyRenderExceptionEnum.GpuNotSupported);
            }

            var settings = settingsToTry ?? new MyRenderDeviceSettings()
            {
                AdapterOrdinal   = adapterIndex,
                BackBufferHeight = mode.dmPelsHeight,
                BackBufferWidth  = mode.dmPelsWidth,
                WindowMode       = MyWindowModeEnum.Fullscreen,
                RefreshRate      = 60000,
                VSync            = false,
            };
            m_settings = settings;

            Device = new Device(GetFactory().Adapters[adapters[m_settings.AdapterOrdinal].AdapterDeviceId], flags, FeatureLevel.Level_11_0);

            // HACK: This is required for Steam overlay to work. Apparently they hook only CreateDevice methods with DriverType argument.
            try
            {
                using (new Device(DriverType.Hardware, flags, FeatureLevel.Level_11_0)){}
            }
            catch { }

            if (flags.HasFlag(DeviceCreationFlags.Debug))
            {
                if (DebugDevice != null)
                {
                    DebugDevice.Dispose();
                    DebugDevice = null;
                }

                DebugDevice    = new DeviceDebug(Device);
                DebugInfoQueue = DebugDevice.QueryInterface <InfoQueue>();

                new System.Threading.Thread(ProcessDebugOutput).Start();
            }

            if (ImmediateContext != null)
            {
                ImmediateContext.Dispose();
                ImmediateContext = null;
            }

            ImmediateContext = Device.ImmediateContext;

            m_windowHandle = windowHandle;

            m_resolution = new Vector2I(m_settings.BackBufferWidth, m_settings.BackBufferHeight);

            if (!m_initialized)
            {
                InitSubsystems();
                m_initialized = true;
            }


            if (m_swapchain != null)
            {
                m_swapchain.Dispose();
                m_swapchain = null;
            }

            if (m_swapchain == null)
            {
                SharpDX.DXGI.Device d = Device.QueryInterface <SharpDX.DXGI.Device>();
                Adapter             a = d.GetParent <Adapter>();
                var factory           = a.GetParent <Factory>();

                var scDesc = new SwapChainDescription();
                scDesc.BufferCount            = MyRender11Constants.BUFFER_COUNT;
                scDesc.Flags                  = SwapChainFlags.AllowModeSwitch;
                scDesc.IsWindowed             = true;
                scDesc.ModeDescription.Format = MyRender11Constants.BACKBUFFER_FORMAT;
                scDesc.ModeDescription.Height = m_settings.BackBufferHeight;
                scDesc.ModeDescription.Width  = m_settings.BackBufferWidth;
                scDesc.ModeDescription.RefreshRate.Numerator   = m_settings.RefreshRate;
                scDesc.ModeDescription.RefreshRate.Denominator = 1000;
                scDesc.ModeDescription.Scaling          = DisplayModeScaling.Unspecified;
                scDesc.ModeDescription.ScanlineOrdering = DisplayModeScanlineOrder.Progressive;
                scDesc.SampleDescription.Count          = 1;
                scDesc.SampleDescription.Quality        = 0;
                scDesc.OutputHandle = m_windowHandle;
                scDesc.Usage        = Usage.RenderTargetOutput;
                scDesc.SwapEffect   = SwapEffect.Discard;

                m_swapchain = new SwapChain(factory, Device, scDesc);

                m_swapchain.GetParent <Factory>().MakeWindowAssociation(m_windowHandle, WindowAssociationFlags.IgnoreAll);
            }

            // we start with window always (DXGI recommended)
            m_settings.WindowMode = MyWindowModeEnum.Window;
            ApplySettings(settings);

            return(m_settings);
        }
Exemplo n.º 18
0
 protected override void InformRepaired()
 {
     InfoQueue.Enqueue("Repaired");
 }
Exemplo n.º 19
0
 protected override void InformCantMove()
 {
     InfoQueue.Enqueue("Can't move\nRepair your car");
 }
Exemplo n.º 20
0
 protected override void InformUnrepairable()
 {
     InfoQueue.Enqueue("Cannot repair");
 }
Exemplo n.º 21
0
 protected override void InformReplace()
 {
     InfoQueue.Enqueue("Replaced");
 }
Exemplo n.º 22
0
 protected override void InformGameStarted()
 {
     InfoQueue.Enqueue("Game started");
 }
Exemplo n.º 23
0
 protected override void InformBalance()
 {
     InfoQueue.Enqueue($"Your balance is:{Player.Money}");
 }
Exemplo n.º 24
0
 protected override void InformMoneyIsOver()
 {
     InfoQueue.Enqueue("Money is over");
 }
Exemplo n.º 25
0
 protected override void InformGameOver()
 {
     InfoQueue.Enqueue("Game over");
     InfoQueue.Enqueue($"Final score is:{Car.Way}");
 }
Exemplo n.º 26
0
 protected override void InformMove()
 {
     InfoQueue.Enqueue("Move");
 }
Exemplo n.º 27
0
        public Dx11RenderingDevice()
        {
            logger.Info("Dx11 rendering device creating.");
#if DEBUG
            const DeviceCreationFlags DebugFlags = DeviceCreationFlags.Debug;
#else
            const DeviceCreationFlags DebugFlags = DeviceCreationFlags.None;
#endif
            try
            {
                Factory = new Factory();
                if (Factory.Adapters.Count() == 0)
                {
                    MessageBox.Show("Your system have no video adapters. Try to install video adapter.", "DirectX error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    throw new Exception("There are no valid video adapters in system.");
                }

                var adapter = Factory.GetAdapter(0);
                if (adapter == null)
                {
                    MessageBox.Show("DirectX wasn't able to acquire video adapter. Try to restart your system.", "DirectX error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    throw new Exception("DirectX wasn't able to acquire video adapter.");
                }

                if (adapter.Outputs == null || adapter.Outputs.Count() == 0)
                {
                    MessageBox.Show("There are no video displays connected to your system. Try to connect a display.", "DirectX error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    throw new Exception("No connected displays found.");
                }

                Device = new Device(adapter, DebugFlags | DeviceCreationFlags.SingleThreaded, FeatureLevel.Level_10_0);
            }
            catch (Exception exc)
            {
                switch ((uint)exc.HResult)
                {
                case 0x887A0004:
                    MessageBox.Show("Your DirectX version, videocard or drivers are out of date.\nDirectX 11 installation and videocard with DirectX 10 support is required.", "DirectX error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    break;

                case 0x887A002D:
                    MessageBox.Show("Warning: provided build is a debug build.\nPlease install DirectX SDK or request release build from QA team.", "DirectX error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    break;

                case 0x887A0005:
                case 0x887A0020:
                    MessageBox.Show("There was a serious video system error while initializing Direct3D device.\nTry to restart your system.", "DirectX error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    break;

                default:
                    MessageBox.Show("Unknown error while creating Direct3D device!\nShutting down now.", "DirectX error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    break;
                }

                throw new Exception("Can't create Direct3D 11 device! Exception: " + exc);
            }

#if DEBUG
            using (InfoQueue DeviceInfoQueue = Device.QueryInterface <InfoQueue>())
            {
                DeviceInfoQueue.SetBreakOnSeverity(MessageSeverity.Warning, true);
            }
#endif

            try
            {
                Context = Device.ImmediateContext;

                /*TestShader = new Dx11PipelineState(this, "TestShader", new InputElement[]
                 * {
                 * new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0),
                 * new InputElement("COLOR", 0, Format.R8G8B8A8_UNorm, 0, 1, InputClassification.PerVertexData, 0)
                 * });*/
                TextShader = new Dx11PipelineState(this, "TextShader", new InputElement[]
                {
                    new InputElement("POSITION", 0, Format.R32G32_Float, 0, 0, InputClassification.PerVertexData, 0),
                    new InputElement("UVW", 0, Format.R32G32_UInt, 0, 1, InputClassification.PerVertexData, 0)
                });
                SpriteShader = new Dx11PipelineState(this, "SpriteShader", new InputElement[]
                {
                    new InputElement("POSITION", 0, Format.R32G32_Float, 0, 0, InputClassification.PerVertexData, 0),
                    new InputElement("UVW", 0, Format.R32G32_UInt, 0, 1, InputClassification.PerVertexData, 0)
                });
                RoomShader = new Dx11PipelineState(this, "RoomShader", new InputElement[]
                {
                    new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0),
                    new InputElement("COLOR", 0, Format.R8G8B8A8_UNorm, 0, 1, InputClassification.PerVertexData, 0),
                    new InputElement("OVERLAY", 0, Format.R8G8B8A8_UNorm, 0, 2, InputClassification.PerVertexData, 0),
                    new InputElement("UVWANDBLENDMODE", 0, Format.R32G32_UInt, 0, 3, InputClassification.PerVertexData, 0),
                    new InputElement("EDITORUVANDSECTORTEXTURE", 0, Format.R32_UInt, 0, 4, InputClassification.PerVertexData, 0)
                });
                RasterizerBackCulling = new RasterizerState(Device, new RasterizerStateDescription
                {
                    CullMode = CullMode.Back,
                    FillMode = FillMode.Solid,
                });
                SamplerDefault = new SamplerState(Device, new SamplerStateDescription
                {
                    AddressU          = TextureAddressMode.Mirror,
                    AddressV          = TextureAddressMode.Mirror,
                    AddressW          = TextureAddressMode.Wrap,
                    Filter            = Filter.Anisotropic,
                    MaximumAnisotropy = 4,
                });
                SamplerRoundToNearest = new SamplerState(Device, new SamplerStateDescription
                {
                    AddressU          = TextureAddressMode.Wrap,
                    AddressV          = TextureAddressMode.Wrap,
                    AddressW          = TextureAddressMode.Wrap,
                    Filter            = Filter.MinMagMipPoint,
                    MaximumAnisotropy = 4,
                });
                {
                    DepthStencilStateDescription desc = DepthStencilStateDescription.Default();
                    desc.DepthComparison  = Comparison.LessEqual;
                    desc.DepthWriteMask   = DepthWriteMask.All;
                    desc.IsDepthEnabled   = true;
                    desc.IsStencilEnabled = false;
                    DepthStencilDefault   = new DepthStencilState(Device, desc);
                }
                {
                    DepthStencilStateDescription desc = DepthStencilStateDescription.Default();
                    desc.DepthComparison  = Comparison.Always;
                    desc.DepthWriteMask   = DepthWriteMask.Zero;
                    desc.IsDepthEnabled   = false;
                    desc.IsStencilEnabled = false;
                    DepthStencilNoZBuffer = new DepthStencilState(Device, desc);
                }
                BlendingDisabled = new BlendState(Device, BlendStateDescription.Default());
                {
                    BlendStateDescription desc = BlendStateDescription.Default();
                    desc.RenderTarget[0].IsBlendEnabled        = true;
                    desc.RenderTarget[0].SourceBlend           = desc.RenderTarget[0].SourceAlphaBlend = BlendOption.One;
                    desc.RenderTarget[0].DestinationBlend      = desc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha;
                    desc.RenderTarget[0].BlendOperation        = desc.RenderTarget[0].AlphaBlendOperation = BlendOperation.Add;
                    desc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
                    BlendingPremultipliedAlpha = new BlendState(Device, desc);
                }
            }
            catch (Exception exc)
            {
                throw new Exception("Can't assign needed Direct3D parameters! Exception: " + exc);
            }

            // Sector textures
            bool       support16BitTexture = Device.CheckFormatSupport(Format.B5G5R5A1_UNorm).HasFlag(FormatSupport.Texture2D); // For some reason not all DirectX devices support 16 bit textures.
            string[]   sectorTextureNames  = Enum.GetNames(typeof(SectorTexture)).Skip(1).ToArray();
            GCHandle[] handles             = new GCHandle[sectorTextureNames.Length];
            try
            {
                DataBox[] dataBoxes = new DataBox[sectorTextureNames.Length];
                for (int i = 0; i < sectorTextureNames.Length; ++i)
                {
                    string name = nameof(TombLib) + "." + nameof(Rendering) + ".SectorTextures." + sectorTextureNames[i] + ".png";
                    using (Stream stream = ThisAssembly.GetManifestResourceStream(name))
                    {
                        ImageC image = ImageC.FromStream(stream);
                        if ((image.Width != SectorTextureSize) || (image.Height != SectorTextureSize))
                        {
                            throw new ArgumentOutOfRangeException("The embedded resource '" + name + "' is not of a valid size.");
                        }

                        if (support16BitTexture)
                        { // Compress image data into B5G5R5A1 format to save a bit of GPU memory. (3 MB saved with currently 23 images)
                            ushort[] sectorTextureData = new ushort[SectorTextureSize * SectorTextureSize];
                            for (int j = 0; j < (SectorTextureSize * SectorTextureSize); ++j)
                            {
                                ColorC Color = image.Get(j);
                                sectorTextureData[j] = (ushort)(
                                    ((Color.B >> 3) << 0) |
                                    ((Color.G >> 3) << 5) |
                                    ((Color.R >> 3) << 10) |
                                    ((Color.A >> 7) << 15));
                            }
                            handles[i]   = GCHandle.Alloc(sectorTextureData, GCHandleType.Pinned);
                            dataBoxes[i] = new DataBox(handles[i].AddrOfPinnedObject(), sizeof(ushort) * SectorTextureSize, 0);
                        }
                        else
                        {
                            handles[i]   = GCHandle.Alloc(image.ToByteArray(), GCHandleType.Pinned);
                            dataBoxes[i] = new DataBox(handles[i].AddrOfPinnedObject(), sizeof(uint) * SectorTextureSize, 0);
                        }
                    }
                }

                SectorTextureArray = new Texture2D(Device, new Texture2DDescription
                {
                    Width             = SectorTextureSize,
                    Height            = SectorTextureSize,
                    MipLevels         = 1,
                    ArraySize         = sectorTextureNames.Length,
                    Format            = support16BitTexture ? Format.B5G5R5A1_UNorm : Format.B8G8R8A8_UNorm,
                    SampleDescription = new SampleDescription(1, 0),
                    Usage             = ResourceUsage.Immutable,
                    BindFlags         = BindFlags.ShaderResource,
                    CpuAccessFlags    = CpuAccessFlags.None,
                    OptionFlags       = ResourceOptionFlags.None
                }, dataBoxes);
            }
            finally
            {
                foreach (GCHandle handle in handles)
                {
                    handle.Free();
                }
            }
            SectorTextureArrayView = new ShaderResourceView(Device, SectorTextureArray);

            // Set omni present state
            ResetState();

            logger.Info("Dx11 rendering device created.");
        }
Exemplo n.º 28
0
 protected override void InformNotRepairedBecauseOfBalance()
 {
     InfoQueue.Enqueue("Not enough money for repair");
 }
Exemplo n.º 29
0
 protected override void InformNothingToDo()
 {
     InfoQueue.Enqueue("Nothing to do");
 }