public void Draw() { DrawGrid(); // draw Buttons spritebatch.Draw(gamecontent.button_load, new Vector2(width - ((gamecontent.button_load.Width + 5) * 4), height - gamecontent.button_load.Height - 5), Color.White); spritebatch.Draw(gamecontent.button_save, new Vector2(width - ((gamecontent.button_load.Width + 5) * 3), height - gamecontent.button_load.Height - 5), Color.White); spritebatch.Draw(gamecontent.button_test, new Vector2(width - ((gamecontent.button_load.Width + 5) * 2), height - gamecontent.button_load.Height - 5), Color.White); spritebatch.Draw(gamecontent.button_clear, new Vector2(width - ((gamecontent.button_load.Width + 5)), height - gamecontent.button_load.Height - 5), Color.White); if (button_hover > 0) { spritebatch.Draw(gamecontent.button_outline, new Vector2(width - ((gamecontent.button_load.Width + 5) * (5 - button_hover)), height - gamecontent.button_load.Height - 5), Color.White); } level.Draw(spritebatch); if (ongrid && !overblock) { GameContent.DrawText(level.cursor[cursorindex].editordesc, level.cursor[cursorindex].color, GameContent.textposition.BottomLeft, gamecontent.font_GoodDog, spritebatch, width, height); level.cursor[cursorindex].Draw(spritebatch); } else { if (overblock) { // selectedblock = level.blocks.Find(x => x.position.Equals(snapped)); GameContent.DrawText(selectedblock.editordesc, selectedblock.color, GameContent.textposition.BottomLeft, gamecontent.font_GoodDog, spritebatch, width, height); } else { GameContent.DrawText("Current Level : " + level.number, Color.White, GameContent.textposition.BottomLeft, gamecontent.font_GoodDog, spritebatch, width, height); } spritebatch.Draw(gamecontent.pointer, new Vector2(currentmousestate.X, currentmousestate.Y), Color.White); } }
protected override void Initialize() { int currentwidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width; if (currentwidth == 1920) { wide = true; } else { wide = false; } // start in windowed mode full = false; if (wide) { vwidth = 960; vheight = 540; graphics.PreferredBackBufferWidth = vwidth; graphics.PreferredBackBufferHeight = vheight; } else { vwidth = 640; vheight = 512; graphics.PreferredBackBufferWidth = vwidth; graphics.PreferredBackBufferHeight = vheight; } graphics.ApplyChanges(); spritebatch = new SpriteBatch(GraphicsDevice); gamecontent = new GameContent(Content.ServiceProvider, wide); r = new Random(); fx_volume = 1.0f; fx_pitch = -1.0f; fx_pan = 0.0f; editor = new Editor(gamecontent, spritebatch, vwidth, vheight, wide, full); currentstate = gamestate.WaitingBall; score = 0; ballsleft = 5; level = new Level(0, "Game Level", vwidth, vheight, wide, full, gamecontent); level.Load(); MediaPlayer.Play(gamecontent.music); MediaPlayer.IsRepeating = true; MediaPlayer.Volume = fx_volume; base.Initialize(); }
public Editor(GameContent gamecontent, SpriteBatch spritebatch, int width, int height, bool wide, bool full) { this.gamecontent = gamecontent; this.spritebatch = spritebatch; this.width = width; this.height = height; this.wide = wide; this.full = full; cursorindex = 0; button_hover = 0; testlevel = false; level = new Level(0, "Editor Level", width, height, wide, full, gamecontent); level.Load(); }
/// <summary /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { // GraphicsDevice.Clear(Color.Black); spritebatch.Begin(); spritebatch.Draw(level.background, new Vector2(0, 0), null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); switch (currentstate) { case gamestate.MainMenu: GameContent.DrawText("Main Menu", Color.MonoGameOrange, GameContent.textposition.TopMiddle, gamecontent.font_GoodDog, spritebatch, vwidth, vheight); break; case gamestate.Editor: editor.Draw(); break; case gamestate.WaitingBall: level.paddle.Draw(spritebatch); level.Draw(spritebatch); DrawGameInfo(); GameContent.DrawText("Left Click to Launch Ball", Color.MonoGameOrange, GameContent.textposition.BottomRight, gamecontent.font_GoodDog, spritebatch, vwidth, vheight); break; case gamestate.BallLaunched: level.paddle.Draw(spritebatch); level.Draw(spritebatch); DrawGameInfo(); break; case gamestate.GameOver: level.Draw(spritebatch); GameContent.DrawText("Game Over", Color.Red, GameContent.textposition.Middle, gamecontent.font_GoodDog, spritebatch, vwidth, vheight); DrawGameInfo(); break; } spritebatch.End(); base.Draw(gameTime); }
public Level(int number, string name, int width, int height, bool wide, bool full, GameContent gamecontent) { this.number = number; this.name = name; this.width = width; this.height = height; this.wide = wide; this.full = full; this.gamecontent = gamecontent; paddle = new GameObject(Color.AliceBlue, gamecontent.paddle_sm, new Vector2(width / 2, height - (gamecontent.paddle_sm.Height * 2))); blocks = new List <GameObject>(); blocksremove = new List <GameObject>(); balls = new List <GameObject>(); ballsremove = new List <GameObject>(); cursor = new GameObject[7]; cursor[0] = new GameObject(Color.Red, gamecontent.block_sm, 0, "Block Red", 0); cursor[1] = new GameObject(Color.Orange, gamecontent.block_sm, 1, "Block Orange", 1); cursor[2] = new GameObject(Color.Yellow, gamecontent.block_sm, 2, "Block Yellow", 2); cursor[3] = new GameObject(Color.Green, gamecontent.block_sm, 3, "Block Green", 3); cursor[4] = new GameObject(Color.Blue, gamecontent.block_sm, 4, "Block Blue", 4); cursor[5] = new GameObject(Color.Purple, gamecontent.block_sm, 5, "Block Purple", 5); cursor[6] = new GameObject(Color.Yellow, gamecontent.ball_sm, 6, "Ball Yellow", 0); background = gamecontent.background_sm; }