public void DeviceDisplay_Comparison(
            double width1,
            double height1,
            double density1,
            DisplayOrientation orientation1,
            DisplayRotation rotation1,
            double width2,
            double height2,
            double density2,
            DisplayOrientation orientation2,
            DisplayRotation rotation2,
            bool equals)
        {
            var device1 = new DisplayInfo(
                width: width1,
                height: height1,
                density: density1,
                orientation: orientation1,
                rotation: rotation1);

            var device2 = new DisplayInfo(
                width: width2,
                height: height2,
                density: density2,
                orientation: orientation2,
                rotation: rotation2);

            if (equals)
            {
                Assert.True(device1.Equals(device2));
                Assert.True(device1 == device2);
                Assert.False(device1 != device2);
                Assert.Equal(device1, device2);
                Assert.Equal(device1.GetHashCode(), device2.GetHashCode());
            }
            else
            {
                Assert.False(device1.Equals(device2));
                Assert.True(device1 != device2);
                Assert.False(device1 == device2);
                Assert.NotEqual(device1, device2);
                Assert.NotEqual(device1.GetHashCode(), device2.GetHashCode());
            }
        }
Exemple #2
0
 public bool Equals(DisplayDeviceMode other)
 {
     return(this.DeviceName.Equals(other.DeviceName, StringComparison.Ordinal) &&
            (specVersion == other.specVersion) && (driverVersion == other.driverVersion) && (structureSize == other.structureSize) && (driverExtra == other.driverExtra) &&
            (fields == other.fields) && displayInfo.Equals(other.displayInfo) && (color == other.color) && (duplex == other.duplex) &&
            (yResolution == other.yResolution) && (ttOption == other.ttOption) && (collate == other.collate) &&
            (formName == null ? other.formName == null : formName.Equals(other.formName, StringComparison.Ordinal)) &&
            (logPixels == other.logPixels) && (bitsPerPel == other.bitsPerPel) && (pelsWidth == other.pelsWidth) && (pelsHeight == other.pelsHeight) &&
            (displayFlags == other.displayFlags) && (displayFrequency == other.displayFrequency) && (icmMethod == other.icmMethod) && (icmIntent == other.icmIntent) &&
            (mediaType == other.mediaType) && (ditherType == other.ditherType) && (reserved1 == other.reserved1) && (reserved2 == other.reserved2) &&
            (panningWidth == other.panningWidth) && (panningHeight == other.panningHeight));
 }
Exemple #3
0
        private static void DrawProjectSettings(Project project)
        {
            var         em                  = project.WorldManager.EntityManager;
            var         configEntity        = project.WorldManager.GetConfigEntity();
            DisplayInfo newDisplayInfo      = new DisplayInfo();
            DisplayInfo originalDisplayInfo = em.GetComponentData <DisplayInfo>(configEntity);

            GUILayout.Label("Project Settings", DotsStyles.SettingsSection);
            EditorGUILayout.Space();
            newDisplayInfo.autoSizeToFrame = EditorGUILayout.Toggle("Auto-Resize", originalDisplayInfo.autoSizeToFrame);
            newDisplayInfo.width           = Math.Max(1, EditorGUILayout.DelayedIntField("Viewport Width", originalDisplayInfo.width));
            newDisplayInfo.height          = Math.Max(1, EditorGUILayout.DelayedIntField("Viewport Height", originalDisplayInfo.height));
            newDisplayInfo.renderMode      = (Tiny.Core2D.RenderMode)EditorGUILayout.EnumPopup("Render Mode", originalDisplayInfo.renderMode);
            TextureSettingsField(project.Settings.DefaultTextureSettings);

            // If any of our settings changes, persist the change to ECS storage
            if (!originalDisplayInfo.Equals(newDisplayInfo))
            {
                em.SetComponentData(project.WorldManager.GetConfigEntity(), newDisplayInfo);
            }
        }