예제 #1
0
파일: Program.cs 프로젝트: srl295/NCLDR
        static void Main(string[] args)
        {
            Console.WriteLine("NCLDR Builder");
            Console.WriteLine("NCLDR Builder builds the NCLDR data file from CLDR data");
            Console.WriteLine(String.Empty);

            CommandArgumentsReader reader = new CommandArgumentsReader(args);
            string cldrPath = reader.GetArgumentValue("-CLDRPath");
            string ncldrPath = reader.GetArgumentValue("-NCLDRPath");
            displayMode = GetDisplayMode(reader.GetArgumentValue("-DisplayMode"));
            if (String.IsNullOrEmpty(cldrPath) || String.IsNullOrEmpty(ncldrPath))
            {
                Console.WriteLine("Syntax:");
                Console.WriteLine("NCldrBuilderCmd -CLDRPath:<CLDRPath> -NCLDRPath:<NCLDRPath> [-DisplayMode:Quiet|Verbose|Diagnostics]");
                Console.WriteLine("where:");
                Console.WriteLine(@"<CLDRPath> is the path to the CLDR root folder e.g. C:\CLDR\Release22.1");
                Console.WriteLine(@"<NCLDRPath> is the path to the NCLDR output folder e.g. C:\Projects\NCldr\Source\NCldr\NCldrData");
                Console.WriteLine(@"<DisplayMode> is either Quiet, Verbose or Diagnostics indicating the volume of progress information displayed");
            }
            else if (!Directory.Exists(cldrPath))
            {
                Console.WriteLine(String.Format("CLDRPath '{0}' does not exist", cldrPath));
            }
            else if (!Directory.Exists(ncldrPath))
            {
                Console.WriteLine(String.Format("NCLDRPath '{0}' does not exist", ncldrPath));
            }
            else
            {
                Console.WriteLine(String.Empty);
                NCldrBuilder.Build(cldrPath, ncldrPath, new NCldrBuilderProgressEventHandler(Progress));
                Console.WriteLine(String.Empty);
                Console.WriteLine("Done.");
            }
        }
        public ComparisonGraphLegend()
		{
			// Required to initialize variables
			InitializeComponent();

            mode = DisplayMode.Subpoints;
		}
예제 #3
0
        public TriangleScene(IEye eye, DisplayMode desctopDisplayMode)
            : base(eye, desctopDisplayMode)
        {
            var vertexShader = Device.Create.VertexShader(ShaderParser.Parse(VertexShaderText));
            var pixelShader = Device.Create.PixelShader(ShaderParser.Parse(PixelShaderText));
            shaderCombination = Device.Create.ShaderCombination(vertexShader, null, null, null, pixelShader);

            var vertexData = new[]
                {
                    new Vertex(-0.7f, -0.7f, Color4.Red),
                    new Vertex(0.0f, 0.7f, Color4.Yellow),
                    new Vertex(0.7f, -0.7f, Color4.Green)
                };

            vertexBuffer = Device.Create.Buffer(new BufferDescription
            {
                SizeInBytes = vertexData.Length * Vertex.SizeInBytes,
                Usage = Usage.Immutable,
                BindFlags = BindFlags.VertexBuffer
            }, new SubresourceData(vertexData));

            vertexLayout = Device.Create.VertexLayout(vertexShader, new[]
                {
                    new VertexLayoutElement(ExplicitFormat.R32G32B32A32_FLOAT, 0, 0),
                    new VertexLayoutElement(ExplicitFormat.R32G32B32A32_FLOAT, 0, 16)
                });
        }
예제 #4
0
 public LCDWrapper(GPIOPins rs, GPIOPins enable, GPIOPins d0, GPIOPins d1, GPIOPins d2, GPIOPins d3, GPIOPins d4, GPIOPins d5, GPIOPins d6, GPIOPins d7, int columns = 40, int rows = 2, DisplayMode displayMode = DisplayMode.LCD_ONLY)
 {
     DisplayMode = displayMode;
     Columns = columns;
     Rows = rows;
     if (DisplayMode != DisplayMode.CONSOLE_ONLY) {
         transferProvider = new RaspPiGPIOMemLcdTransferProvider(
             fourBitMode: false,
             rs: rs,
             rw: GPIOPins.GPIO_NONE,
             enable: enable,
             d0: d0,
             d1: d1,
             d2: d2,
             d3: d3,
             d4: d4,
             d5: d5,
             d6: d6,
             d7: d7
         );
         lcd = new Lcd(transferProvider);
         lcd.Begin(Convert.ToByte(columns), Convert.ToByte(rows));
         lcd.Backlight = true;
         lcd.BlinkCursor = false;
         lcd.ShowCursor = false;
         lcd.Visible = true;
     }
     if (DisplayMode != DisplayMode.LCD_ONLY) {
         Console.Clear();
         Console.ForegroundColor = ConsoleColor.White;
         Console.BackgroundColor = ConsoleColor.Black;
         Console.CursorVisible = false;
     }
 }
 public AY_3_8900()
 {
     _displayMode = DisplayMode.ForegroundBackground_FGBG; // no idea if this should be the default
     _screenshotIndex = 0;
     _screenBuffer = new Color[196, 89];
     ClearScreenBuffer();
 }
        public PlainSurfaceItem(int maxWidth, int maxHeight, int widthRequest = 0, int heightRequest = 0, string label = null)
        {
            //Console.WriteLine ("PlainSurfaceItem");
            _label = label;
            this._evtBox = new EventBox ();
            this._draw = new global::Gtk.DrawingArea ();
            if(widthRequest > 0) {
                _draw.WidthRequest = widthRequest;
            }
            if(heightRequest > 0) {
                _draw.HeightRequest = heightRequest;
            }

            this._evtBox.Add (this._draw);

            maxWidth = Math.Max (maxWidth, widthRequest);
            maxHeight = Math.Max (maxHeight, heightRequest);
            this._height = Math.Max(_draw.Allocation.Height, heightRequest);
            this._width = Math.Max(_draw.Allocation.Width, widthRequest);
            this._mode = DisplayMode.Snapshot;
            this._surface = new ImageSurface(Format.Argb32, maxWidth, maxHeight);
            this._button = MouseButton.None;
            this._background = new Color (1.0, 1.0, 1.0);

            _draw.ExposeEvent += DrawExpose;
            _evtBox.ButtonPressEvent += DrawButtonPressEvent;
            _evtBox.ButtonReleaseEvent += DrawButtonReleaseEvent;
            _evtBox.MotionNotifyEvent += DrawMotionNotifyEvent;
        }
예제 #7
0
 public DisplayMode EnumAdapterModes(int adapter, Format format, int mode)
 {
     DisplayMode modeRef = new DisplayMode();
     int res = Interop.Calli(comPointer, adapter, (int)format, mode, (IntPtr)(void*)&modeRef,(*(IntPtr**)comPointer)[7]);
     if( res < 0 ) { throw new SharpDXException( res ); }
     return modeRef;
 }
        public UInt16 Read(int address)
        {
            if (address == 0x21)
                _displayMode = DisplayMode.ColorStack; // FIX: this should only apply if vblank period 1

            return 0;
        }
예제 #9
0
        private void InitForm(DisplayMode mode)
        {
            if (_transparent)
            {
                _view.Border3DStyle = Border3DStyle.Flat;
                _view.BorderStyle = BorderStyle.None;
                _view.GridLineColor = Color.Black;
                FormBorderStyle = FormBorderStyle.None;
                ShowInTaskbar = false;
                Opacity = 0.8D;
                TransparencyKey = Color.Transparent;
                _view.PrimarySelectionColor = Color.Transparent;
                _view.SecondarySelectionColor = Color.Transparent;
            }
            if (mode == DisplayMode.Dark)
            {
                BackColor = Color.FromArgb(1, 2, 3);
                ForeColor = Color.FromArgb(1, 2, 3);
                _view.BackColor = Color.Black;
            }
            if(mode ==DisplayMode.Light)
            {
                BackColor = Color.LightGray;
                TransparencyKey = Color.FromArgb(255, 254, 253);
                _view.BackColor = Color.LightGray;
            }

        }
예제 #10
0
        public MolMovementEntity(DisplayMode displayMode, AtomEntity[] atoms)
        {
            this.displayMode = displayMode;
            this.atoms = atoms;

            // calc bounding box
            Vector3 min = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue);
            Vector3 max = new Vector3(float.MinValue, float.MinValue, float.MinValue);
            foreach (AtomEntity item in atoms)
            {
                if (item.BoundingBox.Centre.X - item.ItemRadius < min.X)
                    min.X = item.BoundingBox.Centre.X - item.ItemRadius;
                if (item.BoundingBox.Centre.X + item.ItemRadius > max.X)
                    max.X = item.BoundingBox.Centre.X + item.ItemRadius;

                if (item.BoundingBox.Centre.Y - item.ItemRadius < min.Y)
                    min.Y = item.BoundingBox.Centre.Y - item.ItemRadius;
                if (item.BoundingBox.Centre.Y + item.ItemRadius > max.Y)
                    max.Y = item.BoundingBox.Centre.Y + item.ItemRadius;

                if (item.BoundingBox.Centre.Z - item.ItemRadius < min.Z)
                    min.Z = item.BoundingBox.Centre.Z - item.ItemRadius;
                if (item.BoundingBox.Centre.Z + item.ItemRadius > max.Z)
                    max.Z = item.BoundingBox.Centre.Z + item.ItemRadius;
            }
            bBox = new BoundingBox(min, max);
        }
		/// <summary>
		/// Creates a new designer attribute for handling a float value.
		/// </summary>
		/// <param name="displayName">The name shown on the node and in the property editor for the property.</param>
		/// <param name="description">The description shown in the property editor for the property.</param>
		/// <param name="category">The category shown in the property editor for the property.</param>
		/// <param name="displayMode">Defines how the property is visualised in the editor.</param>
		/// <param name="displayOrder">Defines the order the properties will be sorted in when shown in the property grid. Lower come first.</param>
		/// <param name="flags">Defines the designer flags stored for the property.</param>
		/// <param name="min">The minimum value of the property.</param>
		/// <param name="max">The maximum value of the property.</param>
		/// <param name="steps">The minimum value added or substracted when changing the property's value.</param>
		/// <param name="units">The units the value is represented in.</param>
		public DesignerFlexibleInteger(string displayName, string description, string category, DisplayMode displayMode, int displayOrder, DesignerFlags flags, int min, int max, int steps, string units) : base(displayName, description, category, displayMode, displayOrder, flags)
		{
			_min= min;
			_max= max;
			_steps= steps;
			_units= units;
		}
예제 #12
0
        /// <summary>
        ///		Default constructor.
        /// </summary>
        public Driver( GraphicsAdapter adapterDetails )
        {
#if SILVERLIGHT
            _desktopMode = new DisplayMode
                           {
                               Width = (int)XnaRenderWindow.DrawingSurface.Width,
                               Height = (int)XnaRenderWindow.DrawingSurface.Height,
                               Format = SurfaceFormat.Color
                           };
            _name = "Silverlight XNA";
            _description = "Silverlight XNA Device";
            _adapterNum = 0;
            _adapterIdentifier = new Guid(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
            _adapter = adapterDetails;

            _videoModeList = new VideoModeCollection
                             {
                                 new VideoMode( _desktopMode )
                             };
#else
            _desktopMode = adapterDetails.CurrentDisplayMode;
            _name = adapterDetails.DeviceName;
            _description = adapterDetails.Description;
            _adapterNum = adapterDetails.DeviceId;
            _adapterIdentifier = new Guid(adapterDetails.VendorId, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
            _adapter = adapterDetails;

            _videoModeList = new VideoModeCollection();
#endif
        }
예제 #13
0
 /// <summary>
 /// Creates a new designer attribute for handling an integer value.
 /// </summary>
 /// <param name="displayName">The name shown on the node and in the property editor for the property.</param>
 /// <param name="description">The description shown in the property editor for the property.</param>
 /// <param name="category">The category shown in the property editor for the property.</param>
 /// <param name="displayMode">Defines how the property is visualised in the editor.</param>
 /// <param name="displayOrder">Defines the order the properties will be sorted in when shown in the property grid. Lower come first.</param>
 /// <param name="flags">Defines the designer flags stored for the property.</param>
 /// <param name="linkedToProperty">The restrictions of this property are defined by another property.</param>
 /// <param name="min">The minimum value of the property.</param>
 /// <param name="max">The maximum value of the property.</param>
 /// <param name="steps">The minimum value added or substracted when changing the property's value.</param>
 /// <param name="units">The units the value is represented in.</param>
 public DesignerInteger(string displayName, string description, string category, DisplayMode displayMode, int displayOrder, DesignerFlags flags, string linkedToProperty, int min, int max, int steps, string units)
     : base(displayName, description, category, displayMode, displayOrder, flags, typeof(DesignerNumberEditor), linkedToProperty)
 {
     _min = min;
     _max = max;
     _steps = steps;
     _units = units;
 }
예제 #14
0
 public DesignerInteger(string displayName, string description, string category, DisplayMode displayMode, int displayOrder, DesignerFlags flags)
     : base(displayName, description, category, displayMode, displayOrder, flags, typeof(DesignerNumberEditor), null)
 {
     _min = int.MinValue;
     _max = int.MaxValue;
     _steps = 1;
     _units = null;
 }
예제 #15
0
 public MetaScene(IEye eye, DisplayMode desctopDisplayMode)
 {
     this.eye = eye;
     this.desctopDisplayMode = desctopDisplayMode;
     var swapChain = eye.Device.PrimarySwapChain;
     window = swapChain.Window;
     eye.NewFrame += NewFrame;
 }
 public MsAGLVisualization(DisplayMode mode, DTE2 _dte, bool transparent, ATEClient client)
 {
     _mode = mode;
     this._dte = _dte;
     
     _transparent = transparent;
     _client = client;
 }
예제 #17
0
 public HeaderColumnSection( ISectionHost host, DisplayMode displayMode, Column column )
     : base(host)
 {
     Debug.Assert( column != null );
     CanDrag = true;
     _displayMode = displayMode;
     _column = column;
     column.DataChanged += column_DataChanged;
 }
예제 #18
0
 /// <summary>
 /// Creates a new designer attribute for handling a string value.
 /// </summary>
 /// <param name="displayName">The name shown on the node and in the property editor for the property.</param>
 /// <param name="description">The description shown in the property editor for the property.</param>
 /// <param name="category">The category shown in the property editor for the property.</param>
 /// <param name="displayMode">Defines how the property is visualised in the editor.</param>
 /// <param name="displayOrder">Defines the order the properties will be sorted in when shown in the property grid. Lower come first.</param>
 /// <param name="flags">Defines the designer flags stored for the property.</param>
 public DesignerPropertyEnum(string displayName, string description, string category, DisplayMode displayMode, int displayOrder, DesignerFlags flags, AllowStyles styles, string dependedProperty, string dependingProperty, ValueTypes filterType = ValueTypes.All, double min = double.MinValue, double max = double.MaxValue)
     : base(displayName, description, category, displayMode, displayOrder, flags, typeof(DesignerPropertyEnumEditor), null, filterType)
 {
     _styles = styles;
     _dependedProperty = dependedProperty;
     _dependingProperty = dependingProperty;
     _minValue = min;
     _maxValue = max;
 }
 /// <summary>
 /// Returns the proper class according to display mode.
 /// </summary>
 /// <param name="dm"></param>
 /// <returns></returns>
 public static ImageDisplayMode SelectImageDisplayMode(DisplayMode dm)
 {
     switch (dm)
     {
         case DisplayMode.NORMAL: return new normalDisplay();
         case DisplayMode.ONLY_CELL_AUT_IMAGE: return new onlyImageDisplay();
     }
     return new noDisplay();
 }
예제 #20
0
파일: DisplayMode.cs 프로젝트: Blecki/IN8
 public static void PrepareScreenBuffer(
     DisplayMode mode,
     byte[] MEM, 
     byte start_page, 
     Color[] palette)
 {
     for (int p = 0; p < mode.width * mode.height; ++p)
        mode.data[p] = palette[ExtractPixel(mode, MEM, start_page, p)];
     mode.target.SetData(mode.data);
 }
        public HollywoodLogger()
        {

#if HOLLYWOOD_LOG_HTML
            _displayMode = DisplayMode.HTML;
#elif UNITY_EDITOR
            _displayMode = DisplayMode.EDITOR;
#endif

        }
예제 #22
0
 /// <summary>
 /// Creates a new instance of the ExperimentFilter class.
 /// </summary>
 public ExperimentFilter()
 {
     _logger = new Logger(this);
     _displayMode = DisplayMode.Unlocked;
     _text = string.Empty;
     _kscBiomes = new List<string>();
     AllExperiments = new List<Experiment>();
     DisplayExperiments = new List<Experiment>();
     CompleteCount = TotalCount = 0;
     AvailableExperiments = new UnlockedExperimentList( );
 }
예제 #23
0
        /// <summary>
        /// HACK! This function will be removed in 0.3.15
        /// Checks if the specified OpenTK.Platform.DisplayMode is available, and selects it if it is.
        /// </summary>
        /// <param name="mode">The OpenTK.Platform.DisplayMode to select.</param>
        /// <param name="info">The OpenTK.Platform.IWindowInfo that describes the display to use. Note: a window handle is not necessary for this function!</param>
        /// <returns>True if the DisplayMode is available, false otherwise.</returns>
        bool IGLContextCreationHack.SelectDisplayMode(DisplayMode mode, IWindowInfo info)
        {
            List<int> visualAttributes = new List<int>();

            // TODO: Improve modesetting code.
            if (mode == null || mode.Color.BitsPerPixel == 0)
            {
                // Define the bare essentials - needed for compatibility with Mono's System.Windows.Forms
                Debug.Print("Preparing visual for System.Windows.Forms (compatibility mode)");
            
                visualAttributes.Add((int)Glx.Enums.GLXAttribute.RGBA);
                /*visualAttributes.Add((int)Glx.Enums.GLXAttribute.RED_SIZE);
                visualAttributes.Add((int)1);
                visualAttributes.Add((int)Glx.Enums.GLXAttribute.GREEN_SIZE);
                visualAttributes.Add((int)1);
                visualAttributes.Add((int)Glx.Enums.GLXAttribute.BLUE_SIZE);
                visualAttributes.Add((int)1);*/
                visualAttributes.Add((int)Glx.Enums.GLXAttribute.DEPTH_SIZE);
                visualAttributes.Add((int)1);
                visualAttributes.Add((int)Glx.Enums.GLXAttribute.DOUBLEBUFFER);
                visualAttributes.Add((int)0);
            }
            else
            {
                Debug.Print("Preparing visual for DisplayMode: {0}", mode.ToString());

                visualAttributes.Add((int)Glx.Enums.GLXAttribute.RGBA);
                visualAttributes.Add((int)Glx.Enums.GLXAttribute.RED_SIZE);
                visualAttributes.Add((int)mode.Color.Red);
                visualAttributes.Add((int)Glx.Enums.GLXAttribute.GREEN_SIZE);
                visualAttributes.Add((int)mode.Color.Green);
                visualAttributes.Add((int)Glx.Enums.GLXAttribute.BLUE_SIZE);
                visualAttributes.Add((int)mode.Color.Blue);
                visualAttributes.Add((int)Glx.Enums.GLXAttribute.ALPHA_SIZE);
                visualAttributes.Add((int)mode.Color.Alpha);
                visualAttributes.Add((int)Glx.Enums.GLXAttribute.DEPTH_SIZE);
                visualAttributes.Add((int)mode.DepthBits);
                visualAttributes.Add((int)Glx.Enums.GLXAttribute.DOUBLEBUFFER);
                visualAttributes.Add((int)0);
            }

            windowInfo.CopyInfoFrom(info);
            visual = Glx.ChooseVisual(windowInfo.Display, windowInfo.Screen, visualAttributes.ToArray());
            if (visual == IntPtr.Zero)
                return false;
            else
            {
                windowInfo.VisualInfo = (XVisualInfo)Marshal.PtrToStructure(visual,
                                                                            typeof(XVisualInfo));
                Debug.Print("Chose visual {0}", windowInfo.VisualInfo.ToString());
            }
            return true;
        }
예제 #24
0
파일: Scene.cs 프로젝트: Zulkir/Beholder
 protected Scene(IEye eye, DisplayMode desctopDisplayMode)
 {
     Eye = eye;
     Adapter = eye.Device.Adapter;
     Device = eye.Device;
     DesctopDisplayMode = desctopDisplayMode;
     ImmediateContext = Device.ImmediateContext;
     SwapChain = Device.PrimarySwapChain;
     Window = SwapChain.Window;
     Keyboard = Window.Input.Keyboard;
     Mouse = Window.Input.Mouse;
 }
예제 #25
0
        public SequenceDiagram(DisplayMode mode, DTE2 dte, bool transparent)
        {
            _mode = mode;
            _dte = dte;
            _transparent = transparent;
            _lifelines = new Dictionary<string, Lifeline>();
            InitializeComponent();

            Icon = ResourceReader.GetIcon("MM-16.ico");
            InitForm(mode);
            _view.DefaultTool = new GoToolManager(_view);
        }
예제 #26
0
    public static DxCapabilities RequestCapabilities(Capabilities deviceCapabilities, DisplayMode displayMode)
    {
      int maxAnisotropy = deviceCapabilities.MaxAnisotropy;
      bool supportsFiltering = MPDirect3D.Direct3D.CheckDeviceFormat(
          deviceCapabilities.AdapterOrdinal, deviceCapabilities.DeviceType, displayMode.Format,
          Usage.RenderTarget | Usage.QueryFilter, ResourceType.Texture, Format.A8R8G8B8);

      bool supportsAlphaBlend = MPDirect3D.Direct3D.CheckDeviceFormat(deviceCapabilities.AdapterOrdinal,
          deviceCapabilities.DeviceType, displayMode.Format, Usage.RenderTarget | Usage.QueryPostPixelShaderBlending,
          ResourceType.Surface, Format.A8R8G8B8);
      bool supportsShaders = deviceCapabilities.PixelShaderVersion.Major >= 2 && deviceCapabilities.VertexShaderVersion.Major >= 2;
      return new DxCapabilities(maxAnisotropy, supportsFiltering, supportsAlphaBlend, supportsShaders);
    }
예제 #27
0
 public ajaxtaobaoshops()
 {
     if (display == 1) dmode = DisplayMode.ManageMode;
     currentpage = SASRequest.GetInt("currentpage", 1);
     //获取当前页数
     if (SASRequest.GetInt("postnumber", 0) > 0)
     {
         pagesize = SASRequest.GetInt("postnumber", 0);
     }
     string conditions = tpb.GetTaoBaoShopCondition(shoptitle, shopnick, province, city, startscore, endscore, startcredit, endcredit, startrate, endrate);
     int recordcount = tpb.GetTaoBaoShopCountByCondition(conditions);
     shoplist = tpb.GetTaoBaoShopsPage(conditions, pagesize, currentpage, ordercolumn, ordertype);
     pagelink = AjaxPagination(recordcount, pagesize, currentpage);
 }
예제 #28
0
        /// <summary>
        /// Initializes the Interpreter object.
        /// </summary>
        /// <param name="inputString">The program's input</param>
        /// <param name="programString">The program</param>
        /// <param name="displayMode">The selected display mode</param>
        /// <returns>returns true if the initialization succesful</returns>
        public bool Init(string inputString, string programString, DisplayMode displayMode)
        {
            if (SharedDefinies.ARRAY_LENGTH <= inputString.Length)
            {
                ShowErrorMessage("Bemenet túl hosszú");
                return false;
            }

            if (SharedDefinies.MAX_PROG_LENGTH <= programString.Length)
            {
                ShowErrorMessage("Program túl hosszú");
                return false;
            }

            if (programString.Length == 0)
            {
                ShowErrorMessage("Kérlek adj meg egy programot!");
                return false;
            }

            input = SharedDefinies.ascii.GetBytes(inputString);

            byte[] encodedBytes = SharedDefinies.ascii.GetBytes(programString);
            int size = 0;
            for (int i = 0; i < encodedBytes.Length; i++)
            {
                foreach (Byte j in SharedDefinies.allowedChars)
                    if (encodedBytes[i] == j)
                    {
                        encodedBytes[size] = encodedBytes[i];
                        size++;
                        break;
                    }
            }
            program = new byte[size];
            Array.Copy(encodedBytes, program, size);

            if (program.Length == 0)
            {
                ShowErrorMessage("Kérlek adj meg egy érvényes programot!");
                return false;
            }

            tape = new Tape();
            if (SharedDefinies.FLAG_WO_GUI == (flags & SharedDefinies.FLAG_WO_GUI))
                imageDisplayMode = ImageDisplayMode.SelectImageDisplayMode(DisplayMode.NO_DISPLAY);
            else
                imageDisplayMode = ImageDisplayMode.SelectImageDisplayMode(displayMode);
            return true;
        }
        /*
         * TODO Make sure to call this before usage!
         * TODO Maybe do some checks for that...
         * TODO Check that all inputs are valid.
         */
        public void init(DisplayMode mode, GameBoard board)
        {
            entities.Clear();

            entities.Add(EntityType.Theseus, new Point(board.theseus.startX, board.theseus.startY));
            entities.Add(EntityType.Minotaur, new Point(board.minotaur.startX, board.minotaur.startY));

            this.mode = mode;
            this.board = board;
            this.time = (double)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime()).TotalSeconds;

            InvalidateVisual();
            Focus();
        }
 public ByteViewer()
 {
     base.SuspendLayout();
     base.CellBorderStyle = TableLayoutPanelCellBorderStyle.Inset;
     base.ColumnCount = 1;
     base.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100f));
     base.RowCount = 1;
     base.RowStyles.Add(new RowStyle(SizeType.Percent, 100f));
     this.InitUI();
     base.ResumeLayout();
     this.displayMode = DisplayMode.Hexdump;
     this.realDisplayMode = DisplayMode.Hexdump;
     this.DoubleBuffered = true;
     base.SetStyle(ControlStyles.ResizeRedraw, true);
 }
예제 #31
0
 public string DisplayText(DisplayMode mode)
 {
     return($"!{Target.ToDisplayText(mode)}");
 }
예제 #32
0
        public void ToStringTest()
        {
            DisplayMode mode = new DisplayMode();

            Assert.AreEqual(mode.ToString(), "{Width:" + mode.Width + " Height:" + mode.Height + " Format:" + mode.Format + " RefreshRate" + mode.RefreshRate + "}");
        }
예제 #33
0
        /// <summary>
        /// Draws the controls inside the window.
        /// </summary>
        /// <param name="windowId"></param>
        private void DrawControls(int windowId)
        {
            DrawTitleBarButtons(_rect);


            GUILayout.BeginHorizontal( );

            GUILayout.BeginVertical(GUILayout.Width(wScale(480)), GUILayout.ExpandHeight(true));

            ProgressBar(
                wScale(new Rect(10, 27, 480, 13)),
                _filter.TotalCount == 0 ? 1 : _filter.CompleteCount,
                _filter.TotalCount == 0 ? 1 : _filter.TotalCount,
                0,
                false,
                false);

            GUILayout.Space(wScale(20));

            GUILayout.BeginHorizontal( );
            GUILayout.Label
            (
                new GUIContent(
                    string.Format("{0}/{1} complete.", _filter.CompleteCount, _filter.TotalCount),
                    string.Format("{0} remaining\n{1:0.#} mits", _filter.TotalCount - _filter.CompleteCount, _filter.TotalScience - _filter.CompletedScience)
                    ),
                _experimentProgressLabelStyle,
                GUILayout.Width(wScale(150))
            );
            GUILayout.FlexibleSpace();
            GUILayout.Label(new GUIContent(_searchTexture), _experimentProgressLabelStyle);
            string NewFilterText = GUILayout.TextField(_filter.Text, _textFieldStyle, GUILayout.Height(wScale(25)), GUILayout.Width(wScale(150)));

            if (_filter.Text != NewFilterText)
            {
                _filter.Text = NewFilterText;
                _parent.OnSettingsDirty(this, null);
            }


            if (GUILayout.Button(new GUIContent(_clearSearchTexture, "Clear search"), GUILayout.Width(wScale(25)), GUILayout.Height(wScale(25))))
            {
                _filter.Text = string.Empty;
                _parent.OnSettingsDirty(this, null);
            }

            GUILayout.EndHorizontal();

            _scrollPos = GUILayout.BeginScrollView(_scrollPos, _skin.scrollView);
            var i = 0;

            if (_filter.DisplayScienceInstances == null)
            {
                _logger.Trace("DisplayExperiments is null");
            }
            else
            {
                for ( ; i < _filter.DisplayScienceInstances.Count; i++)
                {
                    var rect = new Rect(wScale(5), wScale(20) * i, _filter.DisplayScienceInstances.Count > 13 ? wScale(490) : wScale(500), wScale(20));
                    if (rect.yMax < _scrollPos.y || rect.yMin > _scrollPos.y + wScale(400))
                    {
                        continue;
                    }

                    var experiment = _filter.DisplayScienceInstances[i];
                    DrawExperiment(experiment, rect, false, _labelStyle);
                }
            }

            GUILayout.Space(wScale(20) * i);
            GUILayout.EndScrollView();

            GUILayout.BeginHorizontal();


            var TextWidth  = wScale(290);
            var NumButtons = 3;

            GUIContent[] FilterButtons =
            {
                new GUIContent(_currentSituationTexture, "Show experiments available right now"),
                new GUIContent(_currentVesselTexture,    "Show experiments available on this vessel"),
                new GUIContent(_unlockedTexture,         "Show all unlocked experiments")
            };
            if (_parent.Config.AllFilter)
            {
                Array.Resize(ref FilterButtons, 4);
                FilterButtons[3] = new GUIContent(_allTexture, "Show all experiments");
                TextWidth        = wScale(260);
                NumButtons       = 4;
            }
            else
            {
                if (_filter.DisplayMode == DisplayMode.All)
                {
                    _filter.DisplayMode = DisplayMode.Unlocked;
                    _filter.UpdateFilter( );
                }
            }

            DisplayMode NewDisplayMode = (DisplayMode)GUILayout.SelectionGrid(
                (int)_filter.DisplayMode,
                FilterButtons,
                NumButtons,
                GUILayout.Width(wScale(36 * NumButtons)),
                GUILayout.Height(wScale(32))
                );

            if (_filter.DisplayMode != NewDisplayMode)
            {
                _filter.DisplayMode = NewDisplayMode;
                _parent.OnSettingsDirty(this, null);
            }



            GUILayout.FlexibleSpace();

            if (_filter.CurrentSituation != null)
            {
                var desc = _filter.CurrentSituation.Description;
                GUILayout.Box(char.ToUpper(desc[0]) + desc.Substring(1), _situationStyle, GUILayout.Width(TextWidth));
            }
            GUILayout.FlexibleSpace( );

            GUILayout.EndHorizontal();
            GUILayout.EndVertical();

            GUILayout.EndHorizontal();
            GUI.DragWindow();

            if (Event.current.type == EventType.Repaint && GUI.tooltip != _lastTooltip)
            {
                _lastTooltip = GUI.tooltip;
            }

            // If this window gets focus, it pushes the tooltip behind the window, which looks weird.
            // Just hide the tooltip while mouse buttons are held down to avoid this.
            if (Input.GetMouseButton(0) || Input.GetMouseButton(1) || Input.GetMouseButton(2))
            {
                _lastTooltip = string.Empty;
            }
        }
예제 #34
0
 public ColorBrewerListItem(ColorBrewer set, DisplayMode mode)
 {
     m_set  = set;
     m_mode = mode;
 }
예제 #35
0
 private static void InitIoC(DisplayMode mode)
 {
     ClientIoC.RegisterIoC(mode);
     IoCManager.BuildGraph();
     RegisterReflection();
 }
예제 #36
0
        public void TestOBJToRAMMeshConverterPerObjectVisualCool()
        {
            var textureFactory = new RAMTextureFactory();
            var c = new OBJToRAMMeshConverter(textureFactory);


            var importer = new ObjImporter();

            importer.AddMaterialFileStream("Town001.mtl", new FileStream("../GameData/Town/OBJ03/Town001.mtl", FileMode.Open));
            importer.ImportObjFile("../GameData/Town/OBJ03/Town001.obj");

            var meshes = c.CreateMeshesFromObjects(importer);

            var texturePool           = new TexturePool();
            var meshpartPool          = new MeshPartPool();
            var vertexDeclarationPool = new VertexDeclarationPool();

            var renderer = new SimpleMeshRenderer(texturePool, meshpartPool, vertexDeclarationPool);

            vertexDeclarationPool.SetVertexElements <TangentVertex>(TangentVertex.VertexElements);



            var spheres = new List <ClientPhysicsTestSphere>();
            var engine  = new PhysicsEngine();
            PhysicsDebugRendererXNA debugRenderer = null;

            var root = CreatePhysicsQuadtree(20, 5);

            var physicsElementFactoryXNA = new MeshPhysicsFactoryXNA(engine, root);
            var physicsElementFactory    = physicsElementFactoryXNA.Factory;

            var physicsElements = new List <MeshStaticPhysicsElement>();

            for (int i = 0; i < 0 * 100 + 1 * meshes.Count; i++)
            {
                var mesh = meshes[i];
                var el   = renderer.AddMesh(mesh);
                el.WorldMatrix = Matrix.CreateTranslation(Vector3.Right * 0 * 2 + Vector3.UnitZ * 0 * 2);

                var pEl = physicsElementFactory.CreateStaticElement(mesh, Matrix.Identity);
                physicsElements.Add(pEl);
            }
            var gameMeshes = new List <OBJParserTest.TestGameMesh>();

            var game = new XNAGame();

            game.IsFixedTimeStep                    = false;
            game.DrawFps                            = true;
            game.SpectaterCamera.FarClip            = 5000;
            game.Graphics1.PreparingDeviceSettings += delegate(object sender, PreparingDeviceSettingsEventArgs e)
            {
                DisplayMode displayMode = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode;
                e.GraphicsDeviceInformation.PresentationParameters.BackBufferFormat = displayMode.Format;
                e.GraphicsDeviceInformation.PresentationParameters.BackBufferWidth  = displayMode.Width;
                e.GraphicsDeviceInformation.PresentationParameters.BackBufferHeight = displayMode.Height;
                game.SpectaterCamera.AspectRatio = displayMode.Width / (float)displayMode.Height;
            };
            game.Graphics1.ToggleFullScreen();

            var barrelMesh = OBJParserTest.GetBarrelMesh(c);
            var crateMesh  = OBJParserTest.GetCrateMesh(c);

            var sphereMesh = new SphereMesh(0.3f, 20, Color.Green);
            var visualizer = new QuadTreeVisualizerXNA();

            game.AddXNAObject(physicsElementFactoryXNA);

            game.AddXNAObject(texturePool);
            game.AddXNAObject(meshpartPool);
            game.AddXNAObject(vertexDeclarationPool);
            game.AddXNAObject(renderer);


            game.InitializeEvent += delegate
            {
                engine.Initialize();
                debugRenderer = new PhysicsDebugRendererXNA(game, engine.Scene);
                debugRenderer.Initialize(game);
                sphereMesh.Initialize(game);

                for (int i = 0; i < meshes.Count; i++)
                {
                    var mesh = meshes[i];
                    var data = mesh.GetCollisionData();

                    /*if (data.TriangleMesh != null)
                     *  physicsElementFactory.MeshPhysicsPool.PreloadTriangleMesh(engine.Scene, data.TriangleMesh);*/
                }
            };

            bool showPhysics = true;

            game.DrawEvent += delegate
            {
                if (game.Keyboard.IsKeyPressed(Keys.P))
                {
                    showPhysics = !showPhysics;
                }
                if (showPhysics)
                {
                    debugRenderer.Render(game);
                }

                /*visualizer.RenderNodeGroundBoundig(game, root,
                 *  delegate(ClientPhysicsQuadTreeNode node, out Color col)
                 *  {
                 *      col = Color.Green;
                 *
                 *      return node.PhysicsObjects.Count == 0;
                 *  });
                 *
                 * visualizer.RenderNodeGroundBoundig(game, root,
                 * delegate(ClientPhysicsQuadTreeNode node, out Color col)
                 * {
                 *     col = Color.Orange;
                 *
                 *     return node.PhysicsObjects.Count > 0;
                 * });*/

                for (int i = 0; i < physicsElements.Count; i++)
                {
                    var el = physicsElements[i];
                    //game.LineManager3D.AddBox(BoundingBox.CreateFromSphere( el.BoundingSphere), Color.Orange);
                }
                for (int i = 0; i < spheres.Count; i++)
                {
                    sphereMesh.WorldMatrix = Matrix.CreateTranslation(spheres[i].Center);
                    sphereMesh.Render(game);
                }
            };
            game.UpdateEvent += delegate
            {
                engine.Update(game.Elapsed);
                sphereMesh.Update(game);
                if (game.Keyboard.IsKeyPressed(Microsoft.Xna.Framework.Input.Keys.F))
                {
                    var pEl = physicsElementFactory.CreateDynamicElement(crateMesh,
                                                                         Matrix.CreateTranslation(
                                                                             game.SpectaterCamera.CameraPosition +
                                                                             game.SpectaterCamera.CameraDirection));
                    pEl.Actor.LinearVelocity = game.SpectaterCamera.CameraDirection * 30;

                    var rEl = renderer.AddMesh(crateMesh);


                    gameMeshes.Add(new OBJParserTest.TestGameMesh(rEl, pEl));
                }
                if (game.Keyboard.IsKeyPressed(Microsoft.Xna.Framework.Input.Keys.E))
                {
                    var pEl = physicsElementFactory.CreateDynamicElement(barrelMesh,
                                                                         Matrix.CreateTranslation(
                                                                             game.SpectaterCamera.CameraPosition +
                                                                             game.SpectaterCamera.CameraDirection));
                    pEl.Actor.LinearVelocity = game.SpectaterCamera.CameraDirection * 30;

                    var rEl = renderer.AddMesh(barrelMesh);


                    gameMeshes.Add(new OBJParserTest.TestGameMesh(rEl, pEl));
                }


                for (int i = 0; i < gameMeshes.Count; i++)
                {
                    var m = gameMeshes[i];
                    m.RenderElement.WorldMatrix = m.PhysicsElement.World;
                }
            };

            game.Run();
        }
예제 #37
0
        public static bool ResolveTipState(DisplayMode masterTipState, DisplayMode groupTipState, DisplayMode tipState, bool hasFocus)
        {
            switch (masterTipState)
            {
            case DisplayMode.None:
            default:
                // Use our group state
                switch (groupTipState)
                {
                case DisplayMode.None:
                default:
                    // Use our local State
                    switch (tipState)
                    {
                    case DisplayMode.None:
                    case DisplayMode.Off:
                    default:
                        return(false);

                    case DisplayMode.On:
                        return(true);

                    case DisplayMode.OnFocus:
                        return(hasFocus);
                    }

                case DisplayMode.On:
                    return(true);

                case DisplayMode.Off:
                    return(false);

                case DisplayMode.OnFocus:
                    return(hasFocus);
                }

            case DisplayMode.On:
                return(true);

            case DisplayMode.Off:
                return(false);

            case DisplayMode.OnFocus:
                return(hasFocus);
            }
        }
예제 #38
0
        public void ByteViewer_SetDisplayMode_InvokeNoBytes_ThrowsNullReferenceException(DisplayMode value)
        {
            using var control = new ByteViewer();
            Assert.Throws <NullReferenceException>(() => control.SetDisplayMode(value));
            Assert.Equal(value, control.GetDisplayMode());
            Assert.False(control.IsHandleCreated);

            // Set same.
            Assert.Throws <NullReferenceException>(() => control.SetDisplayMode(value));
            Assert.Equal(value, control.GetDisplayMode());
            Assert.False(control.IsHandleCreated);
        }
예제 #39
0
        /// <summary>
        /// Sets up GraphicsSettings with best available windowed mode, subject to
        /// the doesRequireHardware and doesRequireReference constraints.
        /// </summary>
        /// <param name="requiresHardware">Does the device require hardware support.</param>
        /// <param name="requiresReference">Does the device require the ref device.</param>
        /// <returns>true if a mode is found, false otherwise.</returns>
        public Boolean FindBestWindowedMode(Boolean requiresHardware, Boolean requiresReference)
        {
            // Get display mode of primary adapter (which is assumed to be where the window
            // will appear)
            DisplayMode primaryDesktopDisplayMode = Manager.Adapters[0].CurrentDisplayMode;

            DisplayAdapter    bestAdapter    = null;
            DisplayDevice     bestDevice     = null;
            DisplayDeviceMode bestDeviceMode = null;

            foreach (DisplayAdapter displayAdapter in this.hardwareInfo.DisplayAdapters)
            {
                foreach (DisplayDevice displayDevice in displayAdapter.DisplayDevices)
                {
                    if (requiresHardware && displayDevice.DeviceType != DeviceType.Hardware)
                    {
                        continue;
                    }
                    if (requiresReference && displayDevice.DeviceType != DeviceType.Reference)
                    {
                        continue;
                    }

                    foreach (DisplayDeviceMode deviceMode in displayDevice.DeviceModes)
                    {
                        bool adapterMatchesBackBuffer = (deviceMode.BackBufferFormat == deviceMode.AdapterFormat);
                        if (!deviceMode.IsWindowed)
                        {
                            continue;
                        }
                        if (deviceMode.AdapterFormat != primaryDesktopDisplayMode.Format)
                        {
                            continue;
                        }
                        // If we haven't found a compatible DeviceCombo yet, or if this set
                        // is better (because it's a HAL, and/or because formats match better),
                        // save it
                        if (bestDeviceMode == null ||
                            bestDeviceMode.DeviceType != DeviceType.Hardware &&
                            displayDevice.DeviceType == DeviceType.Hardware ||
                            deviceMode.DeviceType == DeviceType.Hardware && adapterMatchesBackBuffer)
                        {
                            bestAdapter    = displayAdapter;
                            bestDevice     = displayDevice;
                            bestDeviceMode = deviceMode;
                            if (displayDevice.DeviceType == DeviceType.Hardware && adapterMatchesBackBuffer)
                            {
                                // This windowed device combo looks great -- take it
                                goto EndWindowedDeviceComboSearch;
                            }
                            // Otherwise keep looking for a better windowed device combo
                        }
                    }
                }
            }
EndWindowedDeviceComboSearch:
            if (bestDeviceMode == null)
            {
                return(false);
            }

            this.graphicsSettings.WindowedDisplayAdapter = bestAdapter;
            this.graphicsSettings.WindowedDisplayDevice  = bestDevice;
            this.graphicsSettings.WindowedDeviceMode     = bestDeviceMode;
            this.graphicsSettings.IsWindowed             = true;
            this.graphicsSettings.WindowedDisplayMode    = primaryDesktopDisplayMode;
            this.graphicsSettings.WindowedWidth          = this.viewport.ClientRectangle.Right - this.viewport.ClientRectangle.Left;
            this.graphicsSettings.WindowedHeight         = this.viewport.ClientRectangle.Bottom - this.viewport.ClientRectangle.Top;
            //	todo: fix depth buffer setting
            //if (Direct3DEnumerator.AppUsesDepthBuffer)
            graphicsSettings.WindowedDepthStencilBufferFormat  = (DepthFormat)bestDeviceMode.DepthStencilFormats[0];
            this.graphicsSettings.WindowedMultiSampleType      = (MultiSampleType)bestDeviceMode.MultiSampleTypes[0];
            this.graphicsSettings.WindowedMultiSampleQuality   = 0;
            this.graphicsSettings.WindowedVertexProcessingType = (VertexProcessingType)bestDeviceMode.VertexProcessingTypes[0];
            this.graphicsSettings.WindowedPresentInterval      = (PresentInterval)bestDeviceMode.PresentIntervals[0];

            return(true);
        }
예제 #40
0
        private void BoardOnVisibleCountChanged(object sender, EventArgs eventArgs)
        {
            var displayMode = new DisplayMode(Board.VisibleCount);

            SetGrid(displayMode.Row, displayMode.Col);
        }
예제 #41
0
 public void ByteViewer_SetDisplayMode_InvokeInvalidMode_ThrowsInvalidEnumArgumentException(DisplayMode value)
 {
     using var control = new ByteViewer();
     Assert.Throws <InvalidEnumArgumentException>("mode", () => control.SetDisplayMode(value));
 }
예제 #42
0
 /// <summary>
 /// Creates a new designer attribute for handling an enum type
 /// </summary>
 /// <param name="displayName">The name shown on the node and in the property editor for the property.</param>
 /// <param name="description">The description shown in the property editor for the property.</param>
 /// <param name="category">The category shown in the property editor for the property.</param>
 /// <param name="displayMode">Defines how the property is visualised in the editor.</param>
 /// <param name="displayOrder">Defines the order the properties will be sorted in when shown in the property grid. Lower come first.</param>
 /// <param name="flags">Defines the designer flags stored for the property.</param>
 public DesignerTypeEnum(string displayName, string description, string category, DisplayMode displayMode, int displayOrder, DesignerFlags flags)
     : base(displayName, description, category, displayMode, displayOrder, flags, typeof(DesignerTypeEnumEditor), null)
 {
 }
예제 #43
0
 public UCViewWaste(DisplayMode mode)
 {
     this.mode = mode;
     InitializeComponent();
 }
예제 #44
0
 /// <summary>
 /// Creates a new designer attribute.
 /// </summary>
 /// <param name="displayName">The name shown on the node and in the property editor for the property.</param>
 /// <param name="description">The description shown in the property editor for the property.</param>
 /// <param name="category">The category shown in the property editor for the property.</param>
 /// <param name="displayMode">Defines how the property is visualised in the editor.</param>
 /// <param name="displayOrder">Defines the order the properties will be sorted in when shown in the property grid. Lower come first.</param>
 /// <param name="flags">Defines the designer flags stored for the property.</param>
 /// <param name="editorType">The type of the editor used in the property grid.</param>
 /// <param name="linkedToProperty">The restrictions of this property are defined by another property.</param>
 protected DesignerProperty(string displayName, string description, string category, DisplayMode displayMode, int displayOrder, DesignerFlags flags, Type editorType, string linkedToProperty, ValueTypes filterType = ValueTypes.All)
 {
     _displayName      = displayName;
     _description      = description;
     _category         = category;
     _displayMode      = displayMode;
     _displayOrder     = displayOrder;
     _flags            = flags;
     _editorType       = editorType;
     _linkedToProperty = linkedToProperty;
     _valueType        = filterType;
     _filterType       = Plugin.GetTypeFromValue(filterType);
 }
예제 #45
0
        public virtual List <GraphicsDeviceInformation> FindBestDevices(GameGraphicsParameters preferredParameters)
        {
            var graphicsDeviceInfos = new List <GraphicsDeviceInformation>();

            // Iterate on each adapter
            foreach (var graphicsAdapter in GraphicsAdapterFactory.Adapters)
            {
                if (!string.IsNullOrEmpty(preferredParameters.RequiredAdapterUid) && graphicsAdapter.AdapterUid != preferredParameters.RequiredAdapterUid)
                {
                    continue;
                }

                // Skip adapeters that don't have graphics output
                // but only if no RequiredAdapterUid is provided (OculusVR at init time might be in a device with no outputs)
                if (graphicsAdapter.Outputs.Length == 0 && string.IsNullOrEmpty(preferredParameters.RequiredAdapterUid))
                {
                    continue;
                }

                var preferredGraphicsProfiles = preferredParameters.PreferredGraphicsProfile;

                // Iterate on each preferred graphics profile
                foreach (var featureLevel in preferredGraphicsProfiles)
                {
                    // Check if this profile is supported.
                    if (graphicsAdapter.IsProfileSupported(featureLevel))
                    {
                        var deviceInfo = new GraphicsDeviceInformation
                        {
                            Adapter                = graphicsAdapter,
                            GraphicsProfile        = featureLevel,
                            PresentationParameters =
                            {
                                MultisampleCount = preferredParameters.PreferredMultisampleCount,
                                IsFullScreen     = preferredParameters.IsFullScreen,
                                PreferredFullScreenOutputIndex = preferredParameters.PreferredFullScreenOutputIndex,
                                PresentationInterval           = preferredParameters.SynchronizeWithVerticalRetrace ? PresentInterval.One : PresentInterval.Immediate,
                                DeviceWindowHandle             = MainWindow.NativeWindow,
                                ColorSpace                     = preferredParameters.ColorSpace,
                            },
                        };

                        var preferredMode = new DisplayMode(preferredParameters.PreferredBackBufferFormat,
                                                            preferredParameters.PreferredBackBufferWidth,
                                                            preferredParameters.PreferredBackBufferHeight,
                                                            preferredParameters.PreferredRefreshRate);

                        // if we want to switch to fullscreen, try to find only needed output, otherwise check them all
                        if (preferredParameters.IsFullScreen)
                        {
                            if (preferredParameters.PreferredFullScreenOutputIndex < graphicsAdapter.Outputs.Length)
                            {
                                var output      = graphicsAdapter.Outputs[preferredParameters.PreferredFullScreenOutputIndex];
                                var displayMode = output.FindClosestMatchingDisplayMode(preferredGraphicsProfiles, preferredMode);
                                AddDevice(displayMode, deviceInfo, preferredParameters, graphicsDeviceInfos);
                            }
                        }
                        else
                        {
                            AddDevice(preferredMode, deviceInfo, preferredParameters, graphicsDeviceInfos);
                        }

                        // If the profile is supported, we are just using the first best one
                        break;
                    }
                }
            }

            return(graphicsDeviceInfos);
        }
예제 #46
0
        private PaletteBase ConvertColorPalettes(DisplayMode mode, ISiteModel siteModel, OverrideParameters overrides)
        {
            const double PERCENTAGE_RANGE_MIN        = 0.0;
            const double PERCENTAGE_RANGE_MAX        = 100.0;
            const ushort PASS_COUNT_TARGET_RANGE_MIN = 1;
            const ushort PASS_COUNT_TARGET_RANGE_MAX = ushort.MaxValue;
            const ushort TEMPERATURE_LEVELS_MIN      = 0;
            const ushort TEMPERATURE_LEVELS_MAX      = 100;

            PaletteBase convertedPalette;

            switch (mode)
            {
            case DisplayMode.CCA:
                convertedPalette = new CCAPalette();
                break;

            case DisplayMode.CCASummary:
                convertedPalette = new CCASummaryPalette();
                break;

            case DisplayMode.CCV:
                convertedPalette = new CMVPalette();

                var cmvPalette = ((CMVPalette)convertedPalette);

                cmvPalette.CMVPercentageRange.Min = overrides?.CMVRange.Min ?? PERCENTAGE_RANGE_MIN;
                cmvPalette.CMVPercentageRange.Max = overrides?.CMVRange.Max ?? PERCENTAGE_RANGE_MAX;

                cmvPalette.UseMachineTargetCMV = !overrides?.OverrideMachineCCV ?? true;
                cmvPalette.AbsoluteTargetCMV   = overrides?.OverridingMachineCCV ?? 0;

                cmvPalette.TargetCCVColour           = Color.Green;
                cmvPalette.DefaultDecoupledCMVColour = Color.Black;
                break;

            case DisplayMode.CCVPercent:
            case DisplayMode.CCVPercentSummary:
            case DisplayMode.CCVPercentChange:
                convertedPalette = new CCVPercentPalette();

                var cmvSummaryPalette = ((CCVPercentPalette)convertedPalette);

                cmvSummaryPalette.CMVPercentageRange.Min = overrides?.CMVRange.Min ?? PERCENTAGE_RANGE_MIN;
                cmvSummaryPalette.CMVPercentageRange.Max = overrides?.CMVRange.Max ?? PERCENTAGE_RANGE_MAX;

                cmvSummaryPalette.UseMachineTargetCMV = !overrides?.OverrideMachineCCV ?? true;
                cmvSummaryPalette.AbsoluteTargetCMV   = overrides?.OverridingMachineCCV ?? 0;
                break;

            case DisplayMode.CMVChange:
                convertedPalette = new CMVChangePalette();

                var cmvPercentChangePalette = ((CMVChangePalette)convertedPalette);

                cmvPercentChangePalette.CMVPercentageRange.Min = overrides?.CMVRange.Min ?? PERCENTAGE_RANGE_MIN;
                cmvPercentChangePalette.CMVPercentageRange.Max = overrides?.CMVRange.Max ?? PERCENTAGE_RANGE_MAX;

                cmvPercentChangePalette.UseAbsoluteValues = false;

                cmvPercentChangePalette.UseMachineTargetCMV = !overrides?.OverrideMachineCCV ?? true;
                cmvPercentChangePalette.AbsoluteTargetCMV   = overrides?.OverridingMachineCCV ?? 0;

                cmvPercentChangePalette.TargetCCVColour           = Color.Green;
                cmvPercentChangePalette.DefaultDecoupledCMVColour = Color.Black;
                break;

            case DisplayMode.CutFill:
                convertedPalette = new CutFillPalette();
                break;

            case DisplayMode.Height:
                var extent = siteModel.GetAdjustedDataModelSpatialExtents(new Guid[0]);

                convertedPalette = new HeightPalette(extent.MinZ, extent.MaxZ);
                break;

            case DisplayMode.MDP:
                convertedPalette = new MDPPalette();

                var mdpPalette = ((MDPPalette)convertedPalette);

                mdpPalette.MDPPercentageRange.Min = overrides?.MDPRange.Min ?? PERCENTAGE_RANGE_MIN;
                mdpPalette.MDPPercentageRange.Max = overrides?.MDPRange.Max ?? PERCENTAGE_RANGE_MAX;

                mdpPalette.UseMachineTargetMDP = !overrides?.OverrideMachineMDP ?? true;
                mdpPalette.AbsoluteTargetMDP   = overrides?.OverridingMachineMDP ?? 0;

                mdpPalette.TargetMDPColour = Color.Green;
                break;

            case DisplayMode.MDPPercentSummary:
                convertedPalette = new MDPSummaryPalette();

                var mdpSummaryPalette = ((MDPSummaryPalette)convertedPalette);

                mdpSummaryPalette.MDPPercentageRange.Min = overrides?.MDPRange.Min ?? PERCENTAGE_RANGE_MIN;
                mdpSummaryPalette.MDPPercentageRange.Max = overrides?.MDPRange.Max ?? PERCENTAGE_RANGE_MAX;

                mdpSummaryPalette.UseMachineTargetMDP = !overrides?.OverrideMachineMDP ?? true;
                mdpSummaryPalette.AbsoluteTargetMDP   = overrides?.OverridingMachineMDP ?? 0;
                break;

            case DisplayMode.PassCount:
                convertedPalette = new PassCountPalette();
                break;

            case DisplayMode.PassCountSummary:
                convertedPalette = new PassCountSummaryPalette();

                var passCountPalette = ((PassCountSummaryPalette)convertedPalette);

                passCountPalette.UseMachineTargetPass     = !overrides?.OverrideTargetPassCount ?? true;
                passCountPalette.TargetPassCountRange.Min = overrides?.OverridingTargetPassCountRange.Min ?? PASS_COUNT_TARGET_RANGE_MIN;
                passCountPalette.TargetPassCountRange.Max = overrides?.OverridingTargetPassCountRange.Max ?? PASS_COUNT_TARGET_RANGE_MAX;
                break;

            case DisplayMode.MachineSpeed:
                convertedPalette = new SpeedPalette();
                break;

            case DisplayMode.TargetSpeedSummary:
                convertedPalette = new SpeedSummaryPalette();

                var speedSummaryPalette = ((SpeedSummaryPalette)convertedPalette);

                speedSummaryPalette.MachineSpeedTarget.Min = overrides?.TargetMachineSpeed.Min ?? CellPassConsts.NullMachineSpeed;
                speedSummaryPalette.MachineSpeedTarget.Max = overrides?.TargetMachineSpeed.Max ?? CellPassConsts.NullMachineSpeed;
                break;

            case DisplayMode.TemperatureDetail:
                convertedPalette = new TemperaturePalette();
                break;

            case DisplayMode.TemperatureSummary:
                convertedPalette = new TemperatureSummaryPalette();

                var temperatureSummaryPalette = ((TemperatureSummaryPalette)convertedPalette);

                temperatureSummaryPalette.UseMachineTempWarningLevels = !overrides?.OverrideTemperatureWarningLevels ?? true;
                temperatureSummaryPalette.TemperatureLevels.Min       = overrides?.OverridingTemperatureWarningLevels.Min ?? TEMPERATURE_LEVELS_MIN;
                temperatureSummaryPalette.TemperatureLevels.Max       = overrides?.OverridingTemperatureWarningLevels.Max ?? TEMPERATURE_LEVELS_MAX;
                break;

            default:
                throw new TRexException($"No implemented color palette for this mode ({mode})");
            }

            return(convertedPalette);
        }
예제 #47
0
 private void LoadNavMeshFromFile(string path)
 {
     tiledNavMesh = new NavMeshJsonSerializer().Deserialize(path);
     displayMode  = DisplayMode.NavMesh;
 }
예제 #48
0
 public TreeState(DisplayMode mode, bool showHidden)
 {
     Mode       = mode;
     ShowHidden = showHidden;
 }
예제 #49
0
 public GoDiagramSequenceDiagramGenerator(DisplayMode mode, DTE2 dte, bool transparent)
 {
     _mode        = mode;
     _dte         = dte;
     _transparent = transparent;
 }
예제 #50
0
 public void SetState(DisplayMode mode)
 {
     _mode = mode;
 }
예제 #51
0
        public void ByteViewer_SetDisplayMode_InvokeWithBytesWithHandle_GetReturnsExpected(DisplayMode value, int expectedInvalidatedCallCount1, int expectedInvalidatedCallCount2)
        {
            using var control = new ByteViewer();
            control.SetBytes(new byte[] { 1, 2, 3 });
            Assert.NotEqual(IntPtr.Zero, control.Handle);
            int invalidatedCallCount = 0;

            control.Invalidated += (sender, e) => invalidatedCallCount++;
            int styleChangedCallCount = 0;

            control.StyleChanged += (sender, e) => styleChangedCallCount++;
            int createdCallCount = 0;

            control.HandleCreated += (sender, e) => createdCallCount++;

            control.SetDisplayMode(value);
            Assert.Equal(value, control.GetDisplayMode());
            Assert.True(control.IsHandleCreated);
            Assert.Equal(expectedInvalidatedCallCount1, invalidatedCallCount);
            Assert.Equal(0, styleChangedCallCount);
            Assert.Equal(0, createdCallCount);

            // Set same.
            control.SetDisplayMode(value);
            Assert.Equal(value, control.GetDisplayMode());
            Assert.True(control.IsHandleCreated);
            Assert.Equal(expectedInvalidatedCallCount2, invalidatedCallCount);
            Assert.Equal(0, styleChangedCallCount);
            Assert.Equal(0, createdCallCount);
        }
예제 #52
0
        public static DxCapabilities RequestCapabilities(Capabilities deviceCapabilities, DisplayMode displayMode)
        {
            int  maxAnisotropy     = deviceCapabilities.MaxAnisotropy;
            bool supportsFiltering = MPDirect3D.Direct3D.CheckDeviceFormat(
                deviceCapabilities.AdapterOrdinal, deviceCapabilities.DeviceType, displayMode.Format,
                Usage.RenderTarget | Usage.QueryFilter, ResourceType.Texture, Format.A8R8G8B8);

            bool supportsAlphaBlend = MPDirect3D.Direct3D.CheckDeviceFormat(deviceCapabilities.AdapterOrdinal,
                                                                            deviceCapabilities.DeviceType, displayMode.Format, Usage.RenderTarget | Usage.QueryPostPixelShaderBlending,
                                                                            ResourceType.Surface, Format.A8R8G8B8);
            bool supportsShaders = deviceCapabilities.PixelShaderVersion.Major >= 2 && deviceCapabilities.VertexShaderVersion.Major >= 2;

            return(new DxCapabilities(maxAnisotropy, supportsFiltering, supportsAlphaBlend, supportsShaders));
        }
        public ConsoleComparisonReport(DisplayMode displayMode)
        {
            _displayMode = displayMode;

            _showHeader = true;
        }
예제 #54
0
 private void ResolutionList_SelectionChanged(object sender, ListBoxSelectionChangedEventArgs e)
 {
     settingsChanged = true;
     mode            = (DisplayMode)e.NewItem.Item;
 }
예제 #55
0
        void BuildPrimaryPlane(DisplayMode displayMode)
        {
            var view = InspectView;

            if (InspectView.Layer != null)
            {
                view = InspectView.Layer;
            }

            Geometry = CreateGeometry((nfloat)view.Width, (nfloat)view.Height);

            var renderImage      = displayMode == DisplayMode.Content || displayMode == DisplayMode.FramesAndContent;
            var materialContents = InspectViewMaterial.Create(view, renderImage);

            var firstMaterial = SCNMaterial.Create();

            firstMaterial.Transparency     = renderImage ? 1 : 0;
            firstMaterial.Diffuse.Contents = materialContents;
            firstMaterial.DoubleSided      = true;

            var highightMaterial = SCNMaterial.Create();

            highightMaterial.Diffuse.ContentColor = NSColor.Blue;
            highightMaterial.Transparency         = 0;
            highightMaterial.DoubleSided          = true;

            var renderBounds   = displayMode == DisplayMode.Frames || displayMode == DisplayMode.FramesAndContent;
            var boundsMaterial = SCNMaterial.Create();

            boundsMaterial.Diffuse.Contents = renderBounds ? NSColor.LightGray : NSColor.Clear;
            boundsMaterial.Transparency     = 1;
            boundsMaterial.DoubleSided      = true;

            Geometry.Materials = new [] { highightMaterial, firstMaterial, boundsMaterial };

            // This is a hack to avoid Z-fighting of planes/frames that intersect within
            // the same node-depth level (or if we ever allow ZSpacing to drop to zero).
            // z-fighting appears on some controls such as some subviews of UISwitch.
            // A better solution would be to only apply this where an intersection exists.
            var zFightOffset = childIndex / ZFightDenominator;
            var zOffset      = ZSpacing + zFightOffset;

            //var siblingOffset = childIndex - (ParentNode as InspectViewNode)?.childIndex ?? 0;
            //var zOffset = siblingOffset * ZSpacing;

            if ((InspectView.Parent == null && !InspectView.IsFakeRoot) ||
                (InspectView.Parent?.IsFakeRoot ?? false))
            {
                var unitScale = (nfloat)(1.0 / Math.Max(view.Width, view.Height));

                var translate = SCNMatrix4.CreateTranslation(
                    (nfloat)(-view.Width / 2.0),
                    (nfloat)(-view.Height / 2.0),
                    zOffset);

                var scale = SCNMatrix4.Scale(unitScale, -unitScale, unitScale);
                Transform = SCNMatrix4.Mult(translate, scale);
            }
            else if (!view.IsFakeRoot)
            {
                if (view.Transform != null)
                {
                    var parentTransform = SCNMatrix4.Identity;
                    var render          = view.Transform;
                    var transform       = new SCNMatrix4 {
                        M11 = (nfloat)render.M11,
                        M12 = (nfloat)render.M12,
                        M13 = (nfloat)render.M13,
                        M14 = (nfloat)render.M14,
                        M21 = (nfloat)render.M21,
                        M22 = (nfloat)render.M22,
                        M23 = (nfloat)render.M23,
                        M24 = (nfloat)render.M24,
                        M31 = (nfloat)render.M31,
                        M32 = (nfloat)render.M32,
                        M33 = (nfloat)render.M33,
                        M34 = (nfloat)render.M34,
                        M41 = (nfloat)render.OffsetX,
                        M42 = (nfloat)render.OffsetY,
                        M43 = (nfloat)render.OffsetZ,
                        M44 = (nfloat)render.M44
                    };
                    transform = SCNMatrix4.Mult(parentTransform, transform);
                    Transform = SCNMatrix4.Mult(
                        transform,
                        SCNMatrix4.CreateTranslation(0, 0, zOffset));
                }
                else
                {
                    Transform = SCNMatrix4.CreateTranslation(
                        (nfloat)view.X,
                        (nfloat)view.Y,
                        zOffset);
                }
            }
        }
예제 #56
0
파일: GFX.cs 프로젝트: katalash/TAE-DX
 public static void SetFromDisplayMode(DisplayMode mode)
 {
     Width  = mode.Width;
     Height = mode.Height;
     Format = mode.Format;
 }
예제 #57
0
        public void ByteViewer_OnPaint_InvokeWithBytesWithHandle_CallsPaint(byte[] bytes, DisplayMode displayMode)
        {
            using var image         = new Bitmap(10, 10);
            using Graphics graphics = Graphics.FromImage(image);
            var eventArgs = new PaintEventArgs(graphics, Rectangle.Empty);

            using var control = new SubByteViewer();
            control.SetBytes(bytes);
            control.SetDisplayMode(displayMode);
            Assert.NotEqual(IntPtr.Zero, control.Handle);
            int invalidatedCallCount = 0;

            control.Invalidated += (sender, e) => invalidatedCallCount++;
            int styleChangedCallCount = 0;

            control.StyleChanged += (sender, e) => styleChangedCallCount++;
            int createdCallCount = 0;

            control.HandleCreated += (sender, e) => createdCallCount++;

            int callCount             = 0;
            PaintEventHandler handler = (sender, e) =>
            {
                Assert.Same(control, sender);
                Assert.Same(eventArgs, e);
                callCount++;
            };

            // Call with handler.
            control.Paint += handler;
            control.OnPaint(eventArgs);
            Assert.Equal(1, callCount);
            Assert.True(control.IsHandleCreated);
            Assert.Equal(0, invalidatedCallCount);
            Assert.Equal(0, styleChangedCallCount);
            Assert.Equal(0, createdCallCount);

            // Remove handler.
            control.Paint -= handler;
            control.OnPaint(eventArgs);
            Assert.Equal(1, callCount);
            Assert.True(control.IsHandleCreated);
            Assert.Equal(0, invalidatedCallCount);
            Assert.Equal(0, styleChangedCallCount);
            Assert.Equal(0, createdCallCount);
        }
예제 #58
0
 public void TestNumber(DisplayMode number)
 {
     Assert.True((Convert.ToInt32(number) >= 0));
 }
예제 #59
0
        public Boolean FindBestFullScreenMode(Boolean requiresHardware, Boolean requiresReference)
        {
            // For fullscreen, default to first HAL DeviceCombo that supports the current desktop
            // display mode, or any display mode if HAL is not compatible with the desktop mode, or
            // non-HAL if no HAL is available
            DisplayMode adapterDesktopDisplayMode     = new DisplayMode();
            DisplayMode bestAdapterDesktopDisplayMode = new DisplayMode();
            DisplayMode bestDisplayMode = new DisplayMode();

            bestAdapterDesktopDisplayMode.Width       = 0;
            bestAdapterDesktopDisplayMode.Height      = 0;
            bestAdapterDesktopDisplayMode.Format      = 0;
            bestAdapterDesktopDisplayMode.RefreshRate = 0;

            DisplayAdapter    bestAdapter    = null;
            DisplayDevice     bestDevice     = null;
            DisplayDeviceMode bestDeviceMode = null;

            foreach (DisplayAdapter displayAdapter in hardwareInfo.DisplayAdapters)
            {
                adapterDesktopDisplayMode = Manager.Adapters[displayAdapter.Ordinal].CurrentDisplayMode;
                foreach (DisplayDevice displayDevice in displayAdapter.DisplayDevices)
                {
                    if (requiresHardware && displayDevice.DeviceType != DeviceType.Hardware)
                    {
                        continue;
                    }
                    if (requiresReference && displayDevice.DeviceType != DeviceType.Reference)
                    {
                        continue;
                    }
                    foreach (DisplayDeviceMode deviceMode in displayDevice.DeviceModes)
                    {
                        bool adapterMatchesBackBuffer = (deviceMode.BackBufferFormat == deviceMode.AdapterFormat);
                        bool adapterMatchesDesktop    = (deviceMode.AdapterFormat == adapterDesktopDisplayMode.Format);
                        if (deviceMode.IsWindowed)
                        {
                            continue;
                        }
                        // If we haven't found a compatible set yet, or if this set
                        // is better (because it's a HAL, and/or because formats match better),
                        // save it
                        if (bestDeviceMode == null ||
                            bestDeviceMode.DeviceType != DeviceType.Hardware && displayDevice.DeviceType == DeviceType.Hardware ||
                            bestDeviceMode.DeviceType == DeviceType.Hardware && bestDeviceMode.AdapterFormat != adapterDesktopDisplayMode.Format && adapterMatchesDesktop ||
                            bestDeviceMode.DeviceType == DeviceType.Hardware && adapterMatchesDesktop && adapterMatchesBackBuffer)
                        {
                            bestAdapterDesktopDisplayMode = adapterDesktopDisplayMode;
                            bestAdapter    = displayAdapter;
                            bestDevice     = displayDevice;
                            bestDeviceMode = deviceMode;
                            if (displayDevice.DeviceType == DeviceType.Hardware && adapterMatchesDesktop && adapterMatchesBackBuffer)

                            {
                                // This fullscreen device combo looks great -- take it
                                goto EndFullScreenDeviceComboSearch;
                            }
                            // Otherwise keep looking for a better fullscreen device combo
                        }
                    }
                }
            }
EndFullScreenDeviceComboSearch:
            if (bestDeviceMode == null)
            {
                return(false);
            }

            // Need to find a display mode on the best adapter that uses pBestDeviceCombo->AdapterFormat
            // and is as close to bestAdapterDesktopDisplayMode's res as possible
            bestDisplayMode.Width       = 0;
            bestDisplayMode.Height      = 0;
            bestDisplayMode.Format      = 0;
            bestDisplayMode.RefreshRate = 0;
            foreach (DisplayMode displayMode in bestAdapter.DisplayModes)
            {
                if (displayMode.Format != bestDeviceMode.AdapterFormat)
                {
                    continue;
                }
                if (displayMode.Width == bestAdapterDesktopDisplayMode.Width &&
                    displayMode.Height == bestAdapterDesktopDisplayMode.Height &&
                    displayMode.RefreshRate == bestAdapterDesktopDisplayMode.RefreshRate)
                {
                    // found a perfect match, so stop
                    bestDisplayMode = displayMode;
                    break;
                }
                else if (displayMode.Width == bestAdapterDesktopDisplayMode.Width &&
                         displayMode.Height == bestAdapterDesktopDisplayMode.Height &&
                         displayMode.RefreshRate > bestDisplayMode.RefreshRate)
                {
                    // refresh rate doesn't match, but width/height match, so keep this
                    // and keep looking
                    bestDisplayMode = displayMode;
                }
                else if (bestDisplayMode.Width == bestAdapterDesktopDisplayMode.Width)
                {
                    // width matches, so keep this and keep looking
                    bestDisplayMode = displayMode;
                }
                else if (bestDisplayMode.Width == 0)
                {
                    // we don't have anything better yet, so keep this and keep looking
                    bestDisplayMode = displayMode;
                }
            }
            graphicsSettings.FullScreenDisplayAdapter = bestAdapter;
            graphicsSettings.FullScreenDisplayDevice  = bestDevice;
            graphicsSettings.FullScreenDeviceMode     = bestDeviceMode;

            graphicsSettings.IsWindowed            = false;
            graphicsSettings.FullScreenDisplayMode = bestDisplayMode;
            //if (hardwareInfo.AppUsesDepthBuffer)
            graphicsSettings.FullScreenDepthStencilBufferFormat = (DepthFormat)bestDeviceMode.DepthStencilFormats[0];
            graphicsSettings.FullScreenMultiSampleType          = (MultiSampleType)bestDeviceMode.MultiSampleTypes[0];
            graphicsSettings.FullScreenMultiSampleQuality       = 0;
            graphicsSettings.FullScreenVertexProcessingType     = (VertexProcessingType)bestDeviceMode.VertexProcessingTypes[0];
            graphicsSettings.FullScreenPresentInterval          = (PresentInterval)bestDeviceMode.PresentIntervals[0];
            return(true);
        }
예제 #60
0
 internal override void Reset()
 {
     _mode = Default;
 }