public EGLSurface CreateSurface(SwapChainPanel panel, Size?renderSurfaceSize, float?resolutionScale) { if (panel == null) { throw new ArgumentException("SwapChainPanel parameter is invalid"); } if (renderSurfaceSize != null && resolutionScale != null) { throw new ArgumentException("A size and a scale can't both be specified"); } EGLSurface surface = EGL.NO_SURFACE; int[] surfaceAttributes = { // EGL.ANGLE_SURFACE_RENDER_TO_BACK_BUFFER is part of the same optimization as EGL.ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER (see above). // If you have compilation issues with it then please update your Visual Studio templates. EGL.ANGLE_SURFACE_RENDER_TO_BACK_BUFFER, EGL.TRUE, EGL.NONE }; // Create a PropertySet and initialize with the EGLNativeWindowType. PropertySet surfaceCreationProperties = new PropertySet(); surfaceCreationProperties.Add(ANGLEWindowsStore.EGLNativeWindowTypeProperty, panel); // If a render surface size is specified, add it to the surface creation properties if (renderSurfaceSize != null) { surfaceCreationProperties.Add(ANGLEWindowsStore.EGLRenderSurfaceSizeProperty, PropertyValue.CreateSize((Size)renderSurfaceSize)); } #if TODO // If a resolution scale is specified, add it to the surface creation properties if (resolutionScale != null) { surfaceCreationProperties.Add(ANGLEWindowsStore.EGLRenderResolutionScaleProperty, PropertyValue.CreateSingle(resolutionScale)); } #endif surface = EGL.CreateWindowSurface(mEglDisplay, mEglConfig, surfaceCreationProperties, surfaceAttributes); if (surface == EGL.NO_SURFACE) { throw new ApplicationException("Failed to create EGL surface"); } return(surface); }
public void SaveState() { IPropertySet state = ApplicationData.Current.LocalSettings.Values; if (state.ContainsKey(AngleKey)) { state.Remove(AngleKey); } if (state.ContainsKey(TrackingKey)) { state.Remove(TrackingKey); } state.Add(AngleKey, PropertyValue.CreateSingle(_rotationY)); state.Add(TrackingKey, PropertyValue.CreateBoolean(_tracking)); }
public static object Parse(AppDataType.Type type, string s) { object obj = null; switch (type) { case AppDataType.Type.Empty: obj = PropertyValue.CreateEmpty();; break; case AppDataType.Type.UInt8: obj = PropertyValue.CreateUInt8(s.IsEmpty() ? (byte)0 : Byte.Parse(s)); break; case AppDataType.Type.Int16: obj = PropertyValue.CreateInt16(s.IsEmpty() ? (short)0 : Int16.Parse(s)); break; case AppDataType.Type.UInt16: obj = PropertyValue.CreateUInt16(s.IsEmpty() ? (ushort)0 : UInt16.Parse(s)); break; case AppDataType.Type.Int32: obj = PropertyValue.CreateInt32(s.IsEmpty() ? 0 : Int32.Parse(s)); break; case AppDataType.Type.UInt32: obj = PropertyValue.CreateUInt32(s.IsEmpty() ? 0 : UInt32.Parse(s)); break; case AppDataType.Type.Int64: obj = PropertyValue.CreateInt64(s.IsEmpty() ? 0 : Int64.Parse(s)); break; case AppDataType.Type.UInt64: obj = PropertyValue.CreateUInt64(s.IsEmpty() ? 0 : UInt64.Parse(s)); break; case AppDataType.Type.Single: obj = PropertyValue.CreateSingle(s.IsEmpty() ? 0 : Single.Parse(s)); break; case AppDataType.Type.Double: obj = PropertyValue.CreateDouble(s.IsEmpty() ? 0 : Double.Parse(s)); break; case AppDataType.Type.Char16: obj = PropertyValue.CreateChar16(Char.Parse(s)); break; case AppDataType.Type.Boolean: obj = PropertyValue.CreateBoolean(s.IsEmpty() ? false : Boolean.Parse(s)); break; case AppDataType.Type.String: obj = s; break; default: break; } return(obj); }