//void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) //{ // //DisplayMode displayMode = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode; // //e.GraphicsDeviceInformation.PresentationParameters.BackBufferFormat = displayMode.Format; // //int screenHeight = displayMode.Height; // //int screenWidth = displayMode.Width; // //e.GraphicsDeviceInformation.PresentationParameters.BackBufferWidth = screenWidth; // //e.GraphicsDeviceInformation.PresentationParameters.BackBufferHeight = screenHeight; // PresentationParameters pp = // e.GraphicsDeviceInformation.PresentationParameters; // int quality = 0; // GraphicsAdapter adapter = e.GraphicsDeviceInformation.Adapter; // SurfaceFormat format = adapter.CurrentDisplayMode.Format; // // Check for 4xAA // if (adapter.CheckDeviceMultiSampleType(DeviceType.Hardware, format, // false, MultiSampleType.FourSamples, out quality)) // { // // even if a greater quality is returned, we only want quality 0 // pp.MultiSampleQuality = 0; // pp.MultiSampleType = // MultiSampleType.FourSamples; // } // // Check for 2xAA // else if (adapter.CheckDeviceMultiSampleType(DeviceType.Hardware, // format, false, MultiSampleType.TwoSamples, out quality)) // { // // even if a greater quality is returned, we only want quality 0 // pp.MultiSampleQuality = 0; // pp.MultiSampleType = // MultiSampleType.TwoSamples; // } // return; //} private void setChessboard() { //ChessboardFactory chessboardFactory = new BasicChessboardFactory(Game, "GameLogic/gameLayout.xml", 0.06f, 0.7f, 0.7f); chessboard = chessboardFactory.getChessboard(this); History.VChessboard = chessboard; panelTime = new PanelTime(Game, this, abstractTimeScheme); if (Game.Services.GetService(typeof(PanelTime)) != null) { Game.Services.RemoveService(typeof(PanelTime)); } Game.Services.AddService(typeof(PanelTime), panelTime); PanelHistory.resetReference(); PanelHistory.createReference(Game, this); //this is sufficient for adding the only PanelHistory object to SubComponents panel2d = new Panel2D(Game, this); panelPause = new PanelPause(Game, this); panelPause.Visible = false; panelPause.Enabled = false; panelFinish = new PanelFinish(Game, this); panelFinish.Visible = false; panelFinish.Enabled = false; panelExit = new PanelExit(Game, this); panelExit.Visible = false; panelExit.Enabled = false; }
public static void resetReference() { if (panelInfo != null) { panelInfo.Dispose(); panelInfo = null; } }
public static PanelHistory createReference(Game game, CompoundGameComponent parent) { if (panelInfo == null) { panelInfo = new PanelHistory(game, parent); } return(panelInfo); }