protected override void LoadContent() { cDrawBatch = new SpriteBatch(cGraphDevMgr.GraphicsDevice); cSolidTexture = new Texture2D(cGraphDevMgr.GraphicsDevice, 1, 1); //cSolidTexture.SetData (new[] { new Color(255, 255, 255, 100) }); //cSolidTexture.SetData (new[] { new Color(0, 0, 0, 100) }); cSolidTexture.SetData(new[] { Color.White }); foreach (Textures CurrTexture in Enum.GetValues(typeof(Textures))) { cTextureDict.Add(CurrTexture, Content.Load <Texture2D>(Tools.EnumTools.GetEnumDescriptionAttribute(CurrTexture))); } //cShader = Content.Load<Effect>("ShaderEffect"); //cShipShader = Content.Load<Effect>("BumpMap"); //cShipShader.Parameters["NormalMap"].SetValue(cTextureDict[Textures.ShipNormal]); cFont = new TextureFont(cTextureDict[Textures.Font]); cDevConsole = new MDLN.MGTools.GameConsole(cGraphDevMgr.GraphicsDevice, Content, Content.RootDirectory + "\\Font.png", 0, 0, cGraphDevMgr.GraphicsDevice.Viewport.Bounds.Width, cGraphDevMgr.GraphicsDevice.Viewport.Bounds.Height / 2); cDevConsole.CommandSent += CommandSentEventHandler; cDevConsole.OpenEffect = DisplayEffect.SlideDown; cDevConsole.CloseEffect = DisplayEffect.SlideUp; cPlayerShip = new Ship(cGraphDevMgr.GraphicsDevice, 50); cPlayerShip.BackgroundColor = new Color(100, 100, 100, 0); //Set background completely transparent cPlayerShip.ShipTexture = cTextureDict[Textures.Ship]; cPlayerShip.Visible = true; cPlayerShip.Top = cGraphDevMgr.GraphicsDevice.Viewport.Bounds.Height / 2; cPlayerShip.Left = cGraphDevMgr.GraphicsDevice.Viewport.Bounds.Width / 2; //cPlayerShip.ImageInitialAngle = 1.570796f; //Offset for image pointing up instead of right cPlayerShip.MouseRotate = true; cPlayerBullets = new ParticleEngine2D(cGraphDevMgr.GraphicsDevice); cPlayerBullets.DrawBlendingMode = BlendState.Additive; //cPlayerBullets.ShaderEffect = cShader; cEnemyBullets = new ParticleEngine2D(cGraphDevMgr.GraphicsDevice); cEnemyBullets.DrawBlendingMode = BlendState.Additive; cAsteroids = new ParticleEngine2D(cGraphDevMgr.GraphicsDevice); cAsteroids.WrapScreenEdges = true; cUFOs = new ParticleEngine2D(cGraphDevMgr.GraphicsDevice); //cUFOs.ShaderEffect = cShipShader; cUFOs.WrapScreenEdges = true; cSparkles = new ParticleEngine2D(cGraphDevMgr.GraphicsDevice); cSparkles.DrawBlendingMode = BlendState.Additive; }
/// <summary> /// Initializes the game class /// </summary> protected override void Initialize() { IsMouseVisible = true; FrameNum = 1; DevConsole = new MDLN.MGTools.GameConsole(GraphicsDevice, Content, "Font.png", 0, 0, GraphicsDevice.Viewport.Bounds.Width, GraphicsDevice.Viewport.Bounds.Height / 2); DevConsole.CommandSent += CommandSentEventHandler; DevConsole.OpenEffect = DisplayEffect.SlideDown; DevConsole.CloseEffect = DisplayEffect.SlideUp; cMouseEnterTime = -1; //Initializes monogame base.Initialize(); }
protected override void LoadContent() { cTextureDict = new Dictionary<Textures, Texture2D>(); foreach (Textures CurrTexture in Enum.GetValues(typeof(Textures))) { cTextureDict.Add(CurrTexture, Content.Load<Texture2D>(Tools.Tools.GetEnumDescriptionAttribute(CurrTexture))); } cDevConsole = new GameConsole(cGraphDevMgr.GraphicsDevice, Content, Tools.Tools.GetEnumDescriptionAttribute(Textures.Font), 0, 0, cGraphDevMgr.GraphicsDevice.Viewport.Bounds.Width, cGraphDevMgr.GraphicsDevice.Viewport.Bounds.Height / 2); cDevConsole.CommandSent += new CommandSentEventHandler(CommandSentEventHandler); cDevConsole.OpenEffect = DisplayEffect.SlideDown; cDevConsole.CloseEffect = DisplayEffect.SlideUp; cDevConsole.AccessKey = Keys.OemTilde; cDevConsole.UseAccessKey = true; cSquares = new MarchingSquares2D(cGraphDevMgr.GraphicsDevice, cGraphDevMgr.GraphicsDevice.Viewport.Height, cGraphDevMgr.GraphicsDevice.Viewport.Height + (cGraphDevMgr.GraphicsDevice.Viewport.Height / 10)); cSquares.CornerTexture = cTextureDict[Textures.Circle]; cSquares.WallTexture = cTextureDict[Textures.Squares]; cSquares.Top = 0; cSquares.Left = 0; cSquares.Visible = true; cSquares.ColumnCount = 11 * 4; cSquares.RowCount = 10 * 4; cSquares.SendMouseEvents = true; cSquares.CellDisplayHeight = 150; cSquares.CellDisplayWidth = 150; cSquares.DisplayCenterCoords = new Vector2(0, 0); cSquares.MouseUp += new ContainerMouseButtonEventHandler(SquaresClick); cNewMap = new Button(cGraphDevMgr.GraphicsDevice, null, 10, cSquares.Width + 40, 50, 150); cNewMap.BackgroundColor = Color.BlueViolet; cNewMap.Text = "New Map"; cNewMap.Font = new TextureFont(cTextureDict[Textures.Font]); cNewMap.FontColor = Color.White; cNewMap.Visible = true; cNewMap.Click += NewMapClicked; cFlyMap = new Button(cGraphDevMgr.GraphicsDevice, null, 70, cSquares.Width + 40, 50, 150); cFlyMap.BackgroundColor = Color.BlueViolet; cFlyMap.Text = "Fly Map"; cFlyMap.Font = new TextureFont(cTextureDict[Textures.Font]); cFlyMap.FontColor = Color.White; cFlyMap.Visible = true; cFlyMap.Click += FlyMapClicked; //Call monogame base base.LoadContent(); }
protected override void LoadContent() { Rectangle ButtonArea = new Rectangle(); int MiniCardHeight, MiniCardWidth; Content.RootDirectory = INTERFACECONTENTDIR; foreach (Textures CurrTexture in Enum.GetValues(typeof(Textures))) { cTextureDict.Add(CurrTexture, Content.Load<Texture2D>(Tools.Tools.GetEnumDescriptionAttribute(CurrTexture))); } cFont = new TextureFont(cTextureDict[Textures.Font]); ButtonArea.Width = (int)(cGraphDevMgr.GraphicsDevice.Viewport.Width * BUTTONWIDTHPERCENT); ButtonArea.Height = (cGraphDevMgr.GraphicsDevice.Viewport.Height - Enum.GetValues(typeof(MenuButtons)).Length) / Enum.GetValues(typeof(MenuButtons)).Length; ButtonArea.X = cGraphDevMgr.GraphicsDevice.Viewport.Width - ButtonArea.Width; ButtonArea.Y = 0; foreach (MenuButtons CurrBtn in Enum.GetValues(typeof(MenuButtons))) { cMenuBtns.Add(CurrBtn, new Button(cGraphDevMgr.GraphicsDevice, null, ButtonArea.Y, ButtonArea.X, ButtonArea.Height, ButtonArea.Width)); cMenuBtns[CurrBtn].Text = Tools.Tools.GetEnumDescriptionAttribute(CurrBtn); cMenuBtns[CurrBtn].Font = cFont; cMenuBtns[CurrBtn].Visible = true; cMenuBtns[CurrBtn].BackgroundColor = Color.Navy; cMenuBtns[CurrBtn].FontColor = Color.AntiqueWhite; ButtonArea.Y += ButtonArea.Height + 1; } cMenuBtns[MenuButtons.Menu].Click += new ClickEvent(MenuClick); cMenuBtns[MenuButtons.OpenDoor].Click += new ClickEvent(OpenDoorClick); cMenuBtns[MenuButtons.DrawMonster].Click += new ClickEvent(SpawnMonsterClick); cMenuBtns[MenuButtons.Abilities].Click += new ClickEvent(AbilitiesClick); cMenuBtns[MenuButtons.Treasure].Click += new ClickEvent(TreasureClick); cFullCardFrame = new FullCardPanel(cGraphDevMgr.GraphicsDevice, cGraphDevMgr.GraphicsDevice.Viewport.Height, (int)(cGraphDevMgr.GraphicsDevice.Viewport.Width / 3)); cFullCardFrame.BackgroundColor = Color.DarkViolet; cFullCardFrame.Font = cFont; cDevConsole = new GameConsole(cGraphDevMgr.GraphicsDevice, Content, "Font.png", cGraphDevMgr.GraphicsDevice.Viewport.Width, cGraphDevMgr.GraphicsDevice.Viewport.Height / 2); cDevConsole.AccessKey = Keys.OemTilde; cDevConsole.UseAccessKey = true; cDevConsole.OpenEffect = DisplayEffect.SlideDown; cDevConsole.CloseEffect = DisplayEffect.SlideUp; cDevConsole.CommandSent += new CommandSentEventHandler(CommandEvent); cDevConsole.AddText(String.Format("Viewport Height={0} Width={1}", cGraphDevMgr.GraphicsDevice.Viewport.Height, cGraphDevMgr.GraphicsDevice.Viewport.Width)); MiniCardHeight = (int)(((cGraphDevMgr.GraphicsDevice.Viewport.Height - 10) / 3) - 10); MiniCardWidth = (int)(200f * ((float)MiniCardHeight / 175f)); for (int Ctr = 0; Ctr < 3; Ctr++) { cCardsInPlay.Add(new CardMini(cGraphDevMgr.GraphicsDevice, MiniCardHeight, MiniCardWidth)); cCardsInPlay[Ctr].Font = cFont; cCardsInPlay[Ctr].FontColor = Color.DarkSlateGray; cCardsInPlay[Ctr].Visible = true; cCardsInPlay[Ctr].BackgroundColor = new Color(0, 0, 0, 0); cCardsInPlay[Ctr].Top = 3; cCardsInPlay[Ctr].Left = 3 + (Ctr * (MiniCardWidth + 3)); cCardsInPlay[Ctr].Click += new ClickEvent(CardInPlayClick); } LoadMonsterDeck(DECKXMLFILE); }
/// <summary> /// Load all external content files that are needed /// </summary> protected override void LoadContent() { TextureFont Font; Content.RootDirectory = INTERFACECONTENTDIR; Font = new TextureFont(Content.Load<Texture2D>("Font.png")); try { cDevConsole = new GameConsole(cGraphDevMgr.GraphicsDevice, Content, "Font.png", cGraphDevMgr.GraphicsDevice.Viewport.Width, cGraphDevMgr.GraphicsDevice.Viewport.Height / 2); cDevConsole.AccessKey = Keys.OemTilde; cDevConsole.UseAccessKey = true; cDevConsole.OpenEffect = DisplayEffect.SlideDown; cDevConsole.CloseEffect = DisplayEffect.SlideUp; cDevConsole.CommandSent += new CommandSentEventHandler(CommandEvent); } catch (Exception ExErr) { System.Windows.Forms.MessageBox.Show("Failed to initialize console: " + ExErr.GetType().ToString() + " - " + ExErr.Message); Exit(); return; } cDevConsole.AddText(String.Format("Viewport Height={0} Width={1}", cGraphDevMgr.GraphicsDevice.Viewport.Height, cGraphDevMgr.GraphicsDevice.Viewport.Width)); //Build card deck frames cAOFrame = new DeckFrame(cGraphDevMgr.GraphicsDevice, cGraphDevMgr.GraphicsDevice.Viewport.Height, cGraphDevMgr.GraphicsDevice.Viewport.Width / 2); cAOFrame.Visible = true; cAOFrame.CloseEffect = DisplayEffect.SlideUp; cAOFrame.OpenEffect = DisplayEffect.SlideDown; cAOFrame.Font = Font; cAOFrame.MaxCardsShown = 1; cOLFrame = new DeckFrame(cGraphDevMgr.GraphicsDevice, cGraphDevMgr.GraphicsDevice.Viewport.Height, cGraphDevMgr.GraphicsDevice.Viewport.Width / 2); cOLFrame.Left = cGraphDevMgr.GraphicsDevice.Viewport.Width / 2; cOLFrame.Visible = true; cOLFrame.CloseEffect = DisplayEffect.SlideUp; cOLFrame.OpenEffect = DisplayEffect.SlideDown; cOLFrame.Font = Font; cOLFrame.CardClick += OLCardClickedHandler; //build config frame cOpenConfig = new Button(cGraphDevMgr.GraphicsDevice, null, 0, 0, 100, 100); cOpenConfig.Font = Font; cOpenConfig.FontColor = new Color(0.1f, 0.1f, 0.1f, 1.0f); cOpenConfig.BackgroundColor = new Color(0.7f, 0.7f, 0.7f, 0.7f); cOpenConfig.Text = "Config"; cOpenConfig.Visible = true; cOpenConfig.Click += ConfigClickHandler; cOLConfigFrame = new OverlordDecksFrame(cGraphDevMgr.GraphicsDevice, cGraphDevMgr.GraphicsDevice.Viewport.Height, cGraphDevMgr.GraphicsDevice.Viewport.Width); cOLConfigFrame.Visible = false; cOLConfigFrame.OpenEffect = DisplayEffect.SlideUp; cOLConfigFrame.CloseEffect = DisplayEffect.SlideDown; cOLConfigFrame.Font = Font; //Load config files cDevConsole.AddText(LoadGameDecks(Content, INTERFACECONTENTDIR + Path.DirectorySeparatorChar + "AOCardsList.xml")); cAOFrame.ShuffleCompleteDeck(true, false); cAOFrame.SelectRandomCardBack(); cOLFrame.ShuffleCompleteDeck(true, false); cOLFrame.SelectRandomCardBack(); cOLConfigFrame.SetIconImageSet(cIconImages); }
protected override void LoadContent() { cDrawBatch = new SpriteBatch(cGraphDevMgr.GraphicsDevice); cSolidTexture = new Texture2D(cGraphDevMgr.GraphicsDevice, 1, 1); //cSolidTexture.SetData (new[] { new Color(255, 255, 255, 100) }); //cSolidTexture.SetData (new[] { new Color(0, 0, 0, 100) }); cSolidTexture.SetData (new[] { Color.White }); foreach (Textures CurrTexture in Enum.GetValues(typeof(Textures))) { cTextureDict.Add(CurrTexture, Content.Load<Texture2D>(Tools.Tools.GetEnumDescriptionAttribute(CurrTexture))); } cShader = Content.Load<Effect>("ShaderEffect"); cShipShader = Content.Load<Effect>("BumpMap"); cShipShader.Parameters["NormalMap"].SetValue(cTextureDict[Textures.ShipNormal]); cFont = new TextureFont(cTextureDict[Textures.Font]); cDevConsole = new MDLN.MGTools.GameConsole(cGraphDevMgr.GraphicsDevice, Content, "Font.png", 0, 0, cGraphDevMgr.GraphicsDevice.Viewport.Bounds.Width, cGraphDevMgr.GraphicsDevice.Viewport.Bounds.Height / 2); cDevConsole.CommandSent += CommandSentEventHandler; cDevConsole.OpenEffect = DisplayEffect.SlideDown; cDevConsole.CloseEffect = DisplayEffect.SlideUp; cPlayerShip = new Ship(cGraphDevMgr.GraphicsDevice, 50); cPlayerShip.BackgroundColor = new Color(100, 100, 100, 0); //Set background completely transparent cPlayerShip.ShipTexture = cTextureDict[Textures.Ship]; cPlayerShip.Visible = true; cPlayerShip.Top = cGraphDevMgr.GraphicsDevice.Viewport.Bounds.Height / 2; cPlayerShip.Left = cGraphDevMgr.GraphicsDevice.Viewport.Bounds.Width / 2; //cPlayerShip.ImageInitialAngle = 1.570796f; //Offset for image pointing up instead of right cPlayerShip.MouseRotate = true; cPlayerBullets = new ParticleEngine2D(cGraphDevMgr.GraphicsDevice); cPlayerBullets.DrawBlendingMode = BlendState.Additive; cPlayerBullets.ShaderEffect = cShader; cEnemyBullets = new ParticleEngine2D(cGraphDevMgr.GraphicsDevice); cEnemyBullets.DrawBlendingMode = BlendState.Additive; cAsteroids = new ParticleEngine2D(cGraphDevMgr.GraphicsDevice); cAsteroids.WrapScreenEdges = true; cUFOs = new ParticleEngine2D(cGraphDevMgr.GraphicsDevice); //cUFOs.ShaderEffect = cShipShader; cUFOs.WrapScreenEdges = true; cSparkles = new ParticleEngine2D(cGraphDevMgr.GraphicsDevice); cSparkles.DrawBlendingMode = BlendState.Additive; }