public void Init(ApplicationDesc desc) { theEvent = new ApplicationEvent(); var frame = desc.FrameSize; if (frame.Width == 0 || frame.Height == 0) { frame = (OS.ScreenSize.ToVector2() / 1.5f).ToSize(); } SetContentSize(new SizeF(frame.Width, frame.Height)); lastFrameSize = frame; AcceptsMouseMovedEvents = true; View = new NSView(); switch (desc.StartPosition) { case (ApplicationStartPositions.CenterCurrentScreen): Center(); break; } switch (desc.Type) { case (ApplicationTypes.Box): StyleMask = NSWindowStyle.Borderless; break; case (ApplicationTypes.Frame): StyleMask = NSWindowStyle.Titled | NSWindowStyle.Miniaturizable | NSWindowStyle.Closable; break; case (ApplicationTypes.FrameSizable): StyleMask = NSWindowStyle.Titled | NSWindowStyle.Resizable | NSWindowStyle.Miniaturizable | NSWindowStyle.Closable; break; default: Debug.ThrowError("NSWindow", "Unsuported window type"); break; } Title = desc.Name; ContentView = View; WillClose += closingEvent; }
public void Init(ApplicationDesc desc) { OS.CurrentApplication = this; OS.time = new Time(0); OS.time.Start(); Orientation = desc.Orientation; UnhandledException += XAMLApplication_UnhandledException; this.Resources.Add("LocalizedStrings", "clr-namespace:Demo_Windows"); var phoneApplicationService = new PhoneApplicationService(); phoneApplicationService.Launching += Application_Launching; phoneApplicationService.Closing += Application_Closing; phoneApplicationService.Activated += Application_Activated; phoneApplicationService.Deactivated += Application_Deactivated; this.ApplicationLifetimeObjects.Add(phoneApplicationService); if (!phoneApplicationInitialized) { RootFrame = new PhoneApplicationFrame(); RootFrame.UriMapper = new MainPageUriMapper();// Override the main page loader RootFrame.Navigated += CompleteInitializePhoneApplication; RootFrame.NavigationFailed += RootFrame_NavigationFailed; RootFrame.Navigated += CheckForResetNavigation; phoneApplicationInitialized = true; } if (Debugger.IsAttached) { Application.Current.Host.Settings.EnableFrameRateCounter = true; PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; } }
public void Init(ApplicationDesc desc) { #if XNA graphics = new GraphicsDeviceManager(this); graphics.PreparingDeviceSettings += graphics_PreparingDeviceSettings; graphics.SynchronizeWithVerticalRetrace = true; if (desc.DepthBit == -1) graphics.PreferredDepthStencilFormat = DepthFormat.Depth24; else if (desc.DepthBit == 24 && desc.StencilBit == 8) graphics.PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8; else if (desc.DepthBit == 24 && desc.StencilBit == 0) graphics.PreferredDepthStencilFormat = DepthFormat.Depth24; else if (desc.DepthBit == 16) graphics.PreferredDepthStencilFormat = DepthFormat.Depth16; else if (desc.DepthBit == 0) graphics.PreferredDepthStencilFormat = DepthFormat.None; else Debug.ThrowError("XNAApplication", string.Format("Unsuported DepthBit: {0} or StencilBit: {1}", desc.DepthBit, desc.StencilBit)); var frame = desc.FrameSize; #if XBOX360 if (frame.Width == 0 || frame.Height == 0) { var display = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode; frame = new Size2(display.Width, display.Height); } graphics.PreferredBackBufferWidth = frame.Width; graphics.PreferredBackBufferHeight = frame.Height; #else if (frame.Width == 0 || frame.Height == 0) frame = (OS.ScreenSize.ToVector2() / 1.5f).ToSize2(); graphics.PreferredBackBufferWidth = frame.Width; graphics.PreferredBackBufferHeight = frame.Height; #endif var gsc = new GamerServicesComponent(this); Components.Add(gsc); Content.RootDirectory = ""; #endif }
public MainApp() { var desc = new ApplicationDesc() { Name = "Fons" }; Init(desc); }
public MainApp() { var desc = new ApplicationDesc() { Type = ApplicationTypes.FrameSizable }; Init(desc); }
public void Init(ApplicationDesc desc) { OS.CurrentApplication = this; this.desc = desc; theEvent = new ApplicationEvent(); OS.time = new Time(0); OS.time.Start(); }
public void Init(ApplicationDesc desc) { theEvent = new ApplicationEvent(); var frame = desc.FrameSize; if (frame.Width == 0 || frame.Height == 0) { frame = (OS.ScreenSize.ToVector2() / 1.5f).ToSize2(); } //X11.XInitThreads();// Only needed for multi threaded applications. dc = X11.XOpenDisplay(IntPtr.Zero); if (dc == IntPtr.Zero) { Debug.ThrowError("Window", "Cannot open Display"); } sc = X11.XDefaultScreen(dc); Handle = X11.XCreateSimpleWindow(dc, X11.XRootWindow(dc, sc), 0, 0, (uint)frame.Width, (uint)frame.Height, 0, X11.XBlackPixel(dc, sc), X11.XWhitePixel(dc, sc)); X11.XSelectInput(dc, Handle, X11.ExposureMask | X11.KeyPressMask | X11.KeyReleaseMask | X11.ButtonPressMask | X11.ButtonReleaseMask); // Enable Capture of close box var normalHint = X11.XInternAtom(dc, "WM_NORMAL_HINTS", false); var deleteHint = X11.XInternAtom(dc, "WM_DELETE_WINDOW", false); X11.XSetWMProtocols(dc, Handle, new IntPtr[] { normalHint, deleteHint }, 2); X11.XStoreName(dc, Handle, desc.Name); // Size if (desc.Type == ApplicationTypes.Frame || desc.Type == ApplicationTypes.FrameSizable || desc.Type == ApplicationTypes.Box) { unsafe { var sizeHints = new X11.XSizeHints(); var flags = X11.XSizeHintsFlags.PPosition; if (desc.Type != ApplicationTypes.FrameSizable) { flags |= X11.XSizeHintsFlags.PMinSize | X11.XSizeHintsFlags.PMaxSize; sizeHints.min_width = sizeHints.max_width = frame.Width; sizeHints.min_height = sizeHints.max_height = frame.Height; } sizeHints.flags = (IntPtr)flags; X11.XSetNormalHints(dc, Handle, &sizeHints); } } // Position if (desc.StartPosition == ApplicationStartPositions.CenterCurrentScreen) { var screenSize = OS.ScreenSize; X11.XMoveWindow(dc, Handle, (screenSize.Width - frame.Width) / 2, (screenSize.Height - frame.Height) / 2); } }
public void Init(ApplicationDesc desc) { OS.CurrentApplication = this; CurrentApplication = this; theEvent = new ApplicationEvent(); if (desc.FrameSize.Width == 0 || desc.FrameSize.Height == 0) FrameSize = new Size2(512, 512); else FrameSize = desc.FrameSize; }
public void Init(ApplicationDesc desc) { #if XNA graphics = new GraphicsDeviceManager(this); graphics.PreparingDeviceSettings += graphics_PreparingDeviceSettings; graphics.SynchronizeWithVerticalRetrace = true; if (desc.DepthBit == -1) { graphics.PreferredDepthStencilFormat = DepthFormat.Depth24; } else if (desc.DepthBit == 24 && desc.StencilBit == 8) { graphics.PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8; } else if (desc.DepthBit == 24 && desc.StencilBit == 0) { graphics.PreferredDepthStencilFormat = DepthFormat.Depth24; } else if (desc.DepthBit == 16) { graphics.PreferredDepthStencilFormat = DepthFormat.Depth16; } else if (desc.DepthBit == 0) { graphics.PreferredDepthStencilFormat = DepthFormat.None; } else { Debug.ThrowError("XNAApplication", string.Format("Unsuported DepthBit: {0} or StencilBit: {1}", desc.DepthBit, desc.StencilBit)); } var frame = desc.FrameSize; #if XBOX360 if (frame.Width == 0 || frame.Height == 0) { var display = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode; frame = new Size2(display.Width, display.Height); } graphics.PreferredBackBufferWidth = frame.Width; graphics.PreferredBackBufferHeight = frame.Height; #else if (frame.Width == 0 || frame.Height == 0) { frame = (OS.ScreenSize.ToVector2() / 1.5f).ToSize2(); } graphics.PreferredBackBufferWidth = frame.Width; graphics.PreferredBackBufferHeight = frame.Height; #endif var gsc = new GamerServicesComponent(this); Components.Add(gsc); Content.RootDirectory = ""; #endif }
public void Init(ApplicationDesc desc) { OS.CurrentApplication = this; OS.time = new Time(0); OS.time.Start(); this.desc = desc; theEvent = new ApplicationEvent(); this.Suspending += onSuspending; this.Resuming += onResuming; }
public void Init(ApplicationDesc desc) { theEvent = new ApplicationEvent(); var frame = desc.FrameSize; if (frame.Width == 0 || frame.Height == 0) frame = (OS.ScreenSize.ToVector2() / 1.5f).ToSize2(); //X11.XInitThreads();// Only needed for multi threaded applications. dc = X11.XOpenDisplay(IntPtr.Zero); if (dc == IntPtr.Zero) { Debug.ThrowError("Window", "Cannot open Display"); } sc = X11.XDefaultScreen(dc); Handle = X11.XCreateSimpleWindow(dc, X11.XRootWindow(dc, sc), 0, 0, (uint)frame.Width, (uint)frame.Height, 0, X11.XBlackPixel(dc, sc), X11.XWhitePixel(dc, sc)); X11.XSelectInput(dc, Handle, X11.ExposureMask | X11.KeyPressMask | X11.KeyReleaseMask | X11.ButtonPressMask | X11.ButtonReleaseMask); // Enable Capture of close box var normalHint = X11.XInternAtom(dc, "WM_NORMAL_HINTS", false); var deleteHint = X11.XInternAtom(dc, "WM_DELETE_WINDOW", false); X11.XSetWMProtocols(dc, Handle, new IntPtr[]{normalHint, deleteHint}, 2); X11.XStoreName(dc, Handle, desc.Name); // Size if (desc.Type == ApplicationTypes.Frame || desc.Type == ApplicationTypes.FrameSizable || desc.Type == ApplicationTypes.Box) { unsafe { var sizeHints = new X11.XSizeHints(); var flags = X11.XSizeHintsFlags.PPosition; if (desc.Type != ApplicationTypes.FrameSizable) { flags |= X11.XSizeHintsFlags.PMinSize | X11.XSizeHintsFlags.PMaxSize; sizeHints.min_width = sizeHints.max_width = frame.Width; sizeHints.min_height = sizeHints.max_height = frame.Height; } sizeHints.flags = (IntPtr)flags; X11.XSetNormalHints(dc, Handle, &sizeHints); } } // Position if (desc.StartPosition == ApplicationStartPositions.CenterCurrentScreen) { var screenSize = OS.ScreenSize; X11.XMoveWindow(dc, Handle, (screenSize.Width-frame.Width) / 2, (screenSize.Height-frame.Height) / 2); } }
public void Init(ApplicationDesc desc) { OS.CurrentApplication = this; if (GraphicsDeviceManager.Current.RenderMode != RenderMode.Hardware) { string message; switch (GraphicsDeviceManager.Current.RenderModeReason) { case RenderModeReason.Not3DCapable: message = "You graphics hardware is not capable of displaying this page "; break; case RenderModeReason.GPUAccelerationDisabled: message = "Hardware graphics acceleration has not been enabled on this web page.\n\n" + "Please notify the web site owner."; break; case RenderModeReason.TemporarilyUnavailable: message = "Your graphics hardware is temporarily unavailable.\n\n" + "Try reloading the web page or restarting your browser."; break; case RenderModeReason.SecurityBlocked: message = "You need to configure your system to allow this web site to display 3D graphics:\n\n" + " 1. Right-Click the page\n" + " 2. Select 'Silverlight'\n" + " (The 'Microsoft Silverlight Configuration' dialog will be displayed)\n" + " 3. Select the 'Permissions' tab\n" + " 4. Find this site in the list and change its 3D Graphics permission from 'Deny' to 'Allow'\n" + " 5. Click 'OK'\n" + " 6. Reload the page"; break; default: message = "Unknown error"; break; } MessageBox.Show(message, "3D Content Blocked", MessageBoxButton.OK); failedToStart = true; return; } this.Startup += this.Application_Startup; this.Exit += this.Application_Exit; this.UnhandledException += this.Application_UnhandledException; }
public void Init(ApplicationDesc desc) { OS.CurrentApplication = this; if (GraphicsDeviceManager.Current.RenderMode != RenderMode.Hardware) { string message; switch (GraphicsDeviceManager.Current.RenderModeReason) { case RenderModeReason.Not3DCapable: message = "You graphics hardware is not capable of displaying this page "; break; case RenderModeReason.GPUAccelerationDisabled: message = "Hardware graphics acceleration has not been enabled on this web page.\n\n" + "Please notify the web site owner."; break; case RenderModeReason.TemporarilyUnavailable: message = "Your graphics hardware is temporarily unavailable.\n\n"+ "Try reloading the web page or restarting your browser."; break; case RenderModeReason.SecurityBlocked: message = "You need to configure your system to allow this web site to display 3D graphics:\n\n" + " 1. Right-Click the page\n" + " 2. Select 'Silverlight'\n" + " (The 'Microsoft Silverlight Configuration' dialog will be displayed)\n" + " 3. Select the 'Permissions' tab\n" + " 4. Find this site in the list and change its 3D Graphics permission from 'Deny' to 'Allow'\n" + " 5. Click 'OK'\n" + " 6. Reload the page"; break; default: message = "Unknown error"; break; } MessageBox.Show(message, "3D Content Blocked", MessageBoxButton.OK); failedToStart = true; return; } this.Startup += this.Application_Startup; this.Exit += this.Application_Exit; this.UnhandledException += this.Application_UnhandledException; }
public void Init(ApplicationDesc desc) { OS.CurrentApplication = this; CurrentApplication = this; theEvent = new ApplicationEvent(); if (desc.FrameSize.Width == 0 || desc.FrameSize.Height == 0) { FrameSize = new Size2(512, 512); } else { FrameSize = desc.FrameSize; } }
public void Init(ApplicationDesc desc) { OS.CurrentApplication = this; OS.time = new Time(0); OS.time.Start(); Orientation = desc.Orientation; UnhandledException += XAMLApplication_UnhandledException; this.Resources.Add("LocalizedStrings", "clr-namespace:Demo_Windows"); var phoneApplicationService = new PhoneApplicationService(); phoneApplicationService.Launching += Application_Launching; phoneApplicationService.Closing += Application_Closing; phoneApplicationService.Activated += Application_Activated; phoneApplicationService.Deactivated += Application_Deactivated; this.ApplicationLifetimeObjects.Add(phoneApplicationService); if (!phoneApplicationInitialized) { RootFrame = new PhoneApplicationFrame(); RootFrame.UriMapper = new MainPageUriMapper(); // Override the main page loader RootFrame.Navigated += CompleteInitializePhoneApplication; RootFrame.NavigationFailed += RootFrame_NavigationFailed; RootFrame.Navigated += CheckForResetNavigation; phoneApplicationInitialized = true; } if (Debugger.IsAttached) { Application.Current.Host.Settings.EnableFrameRateCounter = true; PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; } }
public void Init(ApplicationDesc desc) { this.desc = desc; theEvent = new ApplicationEvent(); }
public void Init(ApplicationDesc desc) { Shown(); }
public void Init(ApplicationDesc desc) { theEvent = new ApplicationEvent(); source = new CoreWindowApplicationSource(this); }