Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Runtime.InteropServices;
- using System.Collections.Generic;
- using System.Linq;
- using Microsoft.Xna.Framework;
- using Microsoft.Xna.Framework.Audio;
- using Microsoft.Xna.Framework.Content;
- using Microsoft.Xna.Framework.GamerServices;
- using Microsoft.Xna.Framework.Graphics;
- using Microsoft.Xna.Framework.Input;
- using Microsoft.Xna.Framework.Media;
- namespace Breakout
- {
- public class Game1 : Microsoft.Xna.Framework.Game
- {
- [DllImport("user32.dll", CharSet = CharSet.Auto)]
- public static extern uint MessageBox(IntPtr hWnd, String text, String caption, uint type);
- GraphicsDeviceManager graphics;
- SpriteBatch spriteBatch;
- Texture2D verticalLinesIcon;
- Vector2 verticalLinesPosition = Vector2.Zero;
- Texture2D horizontalLinesIcon;
- Vector2 horizontalLinesPosition = Vector2.Zero;
- Texture2D squareIcon;
- Vector2 squarePosition = Vector2.Zero;
- Texture2D circleIcon;
- Vector2 circlePosition = Vector2.Zero;
- Texture2D infinityIcon;
- Vector2 infinityPosition = Vector2.Zero;
- Texture2D DiamondIcon;
- Vector2 DiamondPosition = Vector2.Zero;
- Texture2D ball1;
- Vector2 ball1Position = Vector2.Zero;
- Texture2D ball2;
- Vector2 ball2Position = Vector2.Zero;
- Texture2D ball3;
- Vector2 ball3Position = Vector2.Zero;
- Texture2D ball4;
- Vector2 ball4Position = Vector2.Zero;
- Texture2D ball5;
- Vector2 ball5Position = Vector2.Zero;
- Texture2D ball6;
- Vector2 ball6Position = Vector2.Zero;
- Texture2D ball7;
- Vector2 ball7Position = Vector2.Zero;
- Texture2D ball8;
- Vector2 ball8Position = Vector2.Zero;
- Texture2D ball9;
- Vector2 ball9Position = Vector2.Zero;
- Texture2D ball10;
- Vector2 ball10Position = Vector2.Zero;
- Texture2D ball11;
- Vector2 ball11Position = Vector2.Zero;
- Texture2D ball12;
- Vector2 ball12Position = Vector2.Zero;
- Texture2D ball13;
- Vector2 ball13Position = Vector2.Zero;
- Texture2D ball14;
- Vector2 ball14Position = Vector2.Zero;
- Texture2D ball15;
- Vector2 ball15Position = Vector2.Zero;
- Texture2D ball16;
- Vector2 ball16Position = Vector2.Zero;
- Color backColor = Color.CornflowerBlue;
- public Game1()
- {
- graphics = new GraphicsDeviceManager(this);
- Content.RootDirectory = "Content";
- }
- protected override void Initialize()
- {
- base.Initialize();
- this.IsMouseVisible = true;
- // MessageBox(new IntPtr(0), string.Format("graphics.GraphicsDevice.Viewport.Width"), "MessageBox title", 0);
- }
- protected override void LoadContent()
- {
- spriteBatch = new SpriteBatch(GraphicsDevice);
- verticalLinesIcon = Content.Load<Texture2D>("verticalLinesIcon");
- verticalLinesPosition = new Vector2((graphics.GraphicsDevice.Viewport.Width / 2) - ((verticalLinesIcon.Width / 2) - 150), graphics.GraphicsDevice.Viewport.Height - 60);
- horizontalLinesIcon = Content.Load<Texture2D>("horizontalLinesIcon");
- horizontalLinesPosition = new Vector2((graphics.GraphicsDevice.Viewport.Width / 2) - ((horizontalLinesIcon.Width / 2) - 50), graphics.GraphicsDevice.Viewport.Height - 60);
- squareIcon = Content.Load<Texture2D>("squareIcon");
- squarePosition = new Vector2((graphics.GraphicsDevice.Viewport.Width / 2) - ((squareIcon.Width / 2) + 50), graphics.GraphicsDevice.Viewport.Height - 60);
- circleIcon = Content.Load<Texture2D>("circleIcon");
- circlePosition = new Vector2((graphics.GraphicsDevice.Viewport.Width / 2) - ((circleIcon.Width / 2)+350), graphics.GraphicsDevice.Viewport.Height -60);
- DiamondIcon = Content.Load<Texture2D>("DiamondIcon");
- DiamondPosition = new Vector2((graphics.GraphicsDevice.Viewport.Width / 2) - ((DiamondIcon.Width / 2) + 250), graphics.GraphicsDevice.Viewport.Height - 60);
- infinityIcon = Content.Load<Texture2D>("infinityIcon");
- infinityPosition = new Vector2((graphics.GraphicsDevice.Viewport.Width / 2) - ((infinityIcon.Width / 2) + 150), graphics.GraphicsDevice.Viewport.Height - 60);
- ball1 = Content.Load<Texture2D>("ball");
- ball1Position = new Vector2((graphics.GraphicsDevice.Viewport.Width / 2) - (ball1.Width / 2), graphics.GraphicsDevice.Viewport.Height - 115);
- ball2 = Content.Load<Texture2D>("ball");
- ball2Position = new Vector2((graphics.GraphicsDevice.Viewport.Width / 2) - ((ball2.Width / 2) + 250), graphics.GraphicsDevice.Viewport.Height - 115);
- ball3 = Content.Load<Texture2D>("ball");
- ball3Position = new Vector2((graphics.GraphicsDevice.Viewport.Width / 2) - ((ball2.Width / 2) + 300), graphics.GraphicsDevice.Viewport.Height - 115);
- ball4 = Content.Load<Texture2D>("ball");
- ball4Position = new Vector2((graphics.GraphicsDevice.Viewport.Width / 2) - ((ball2.Width / 2) + 350), graphics.GraphicsDevice.Viewport.Height - 115);
- ball5 = Content.Load<Texture2D>("ball");
- ball5Position = new Vector2((graphics.GraphicsDevice.Viewport.Width / 2) - ((ball2.Width / 2) + 200), graphics.GraphicsDevice.Viewport.Height - 115);
- ball6 = Content.Load<Texture2D>("ball");
- ball6Position = new Vector2((graphics.GraphicsDevice.Viewport.Width / 2) - ((ball2.Width / 2) + 150), graphics.GraphicsDevice.Viewport.Height - 115);
- ball7 = Content.Load<Texture2D>("ball");
- ball7Position = new Vector2((graphics.GraphicsDevice.Viewport.Width / 2) - ((ball2.Width / 2) + 100), graphics.GraphicsDevice.Viewport.Height - 115);
- ball8 = Content.Load<Texture2D>("ball");
- ball8Position = new Vector2((graphics.GraphicsDevice.Viewport.Width / 2) - ((ball2.Width / 2) + 50), graphics.GraphicsDevice.Viewport.Height - 115);
- ball9 = Content.Load<Texture2D>("ball");
- ball9Position = new Vector2((graphics.GraphicsDevice.Viewport.Width / 2) - (ball1.Width / 2), graphics.GraphicsDevice.Viewport.Height - 215);
- ball10 = Content.Load<Texture2D>("ball");
- ball10Position = new Vector2((graphics.GraphicsDevice.Viewport.Width / 2) - ((ball2.Width / 2) + 250), graphics.GraphicsDevice.Viewport.Height - 215);
- ball11 = Content.Load<Texture2D>("ball");
- ball11Position = new Vector2((graphics.GraphicsDevice.Viewport.Width / 2) - ((ball2.Width / 2) + 300), graphics.GraphicsDevice.Viewport.Height - 215);
- ball12 = Content.Load<Texture2D>("ball");
- ball12Position = new Vector2((graphics.GraphicsDevice.Viewport.Width / 2) - ((ball2.Width / 2) + 350), graphics.GraphicsDevice.Viewport.Height - 215);
- ball13 = Content.Load<Texture2D>("ball");
- ball13Position = new Vector2((graphics.GraphicsDevice.Viewport.Width / 2) - ((ball2.Width / 2) + 200), graphics.GraphicsDevice.Viewport.Height - 215);
- ball14 = Content.Load<Texture2D>("ball");
- ball14Position = new Vector2((graphics.GraphicsDevice.Viewport.Width / 2) - ((ball2.Width / 2) + 150), graphics.GraphicsDevice.Viewport.Height - 215);
- ball15 = Content.Load<Texture2D>("ball");
- ball15Position = new Vector2((graphics.GraphicsDevice.Viewport.Width / 2) - ((ball2.Width / 2) + 100), graphics.GraphicsDevice.Viewport.Height - 215);
- ball16 = Content.Load<Texture2D>("ball");
- ball16Position = new Vector2((graphics.GraphicsDevice.Viewport.Width / 2) - ((ball2.Width / 2) + 50), graphics.GraphicsDevice.Viewport.Height - 215);
- }
- protected override void UnloadContent()
- {
- }
- protected override void Update(GameTime gameTime)
- {
- if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
- this.Exit();
- UpdateMouse();
- base.Update(gameTime);
- }
- protected void UpdateMouse()
- {
- MouseState current_mouse = Mouse.GetState();
- // The mouse x and y positions are returned relative to the
- // upper-left corner of the game window.
- int mouseX = current_mouse.X;
- int mouseY = current_mouse.Y;
- // Change background color based on mouse position.
- if (current_mouse.LeftButton == ButtonState.Pressed)
- {
- backColor = new Color((byte)(mouseX / 3), (byte)(mouseY / 2), 0);
- }
- }
- protected override void Draw(GameTime gameTime)
- {
- GraphicsDevice.Clear(backColor);
- spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
- spriteBatch.Draw(verticalLinesIcon, verticalLinesPosition, Color.White);
- spriteBatch.Draw(horizontalLinesIcon, horizontalLinesPosition, Color.White);
- spriteBatch.Draw(squareIcon, squarePosition, Color.White);
- spriteBatch.Draw(infinityIcon, infinityPosition, Color.White);
- spriteBatch.Draw(DiamondIcon, DiamondPosition, Color.White);
- spriteBatch.Draw(circleIcon, circlePosition, Color.White);
- spriteBatch.Draw(ball1, ball1Position, Color.White);
- spriteBatch.Draw(ball2, ball2Position, Color.White);
- spriteBatch.Draw(ball3, ball3Position, Color.White);
- spriteBatch.Draw(ball4, ball4Position, Color.White);
- spriteBatch.Draw(ball5, ball5Position, Color.White);
- spriteBatch.Draw(ball6, ball6Position, Color.White);
- spriteBatch.Draw(ball7, ball7Position, Color.White);
- spriteBatch.Draw(ball8, ball8Position, Color.White);
- spriteBatch.Draw(ball9, ball9Position, Color.White);
- spriteBatch.Draw(ball10, ball10Position, Color.White);
- spriteBatch.Draw(ball11, ball11Position, Color.White);
- spriteBatch.Draw(ball12, ball12Position, Color.White);
- spriteBatch.Draw(ball13, ball13Position, Color.White);
- spriteBatch.Draw(ball14, ball14Position, Color.White);
- spriteBatch.Draw(ball15, ball15Position, Color.White);
- spriteBatch.Draw(ball16, ball16Position, Color.White);
- spriteBatch.End();
- base.Draw(gameTime);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement