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 ;

Boolean MoveDiamond = false ;

Boolean MoveSquare = false ;

Boolean MoveBack = false ;

Boolean MoveHorizontal = false ;

//top wall

float ball1X = 215 , ball1Y = 45 ;

float ball2X = 265 , ball2Y = 45 ;

float ball3X = 315 , ball3Y = 45 ;

float ball4X = 365 , ball4Y = 45 ;

//Left Wall

float ball5X = 190 , ball5Y = 100 ;

float ball6X = 190 , ball6Y = 140 ;

float ball7X = 190 , ball7Y = 180 ;

float ball8X = 190 , ball8Y = 220 ;

//Right Wall

float ball9X = 390 , ball9Y = 100 ;

float ball10X = 390 , ball10Y = 140 ;

float ball11X = 390 , ball11Y = 180 ;

float ball12X = 390 , ball12Y = 220 ;

//Bottom Wall

float ball13X = 215 , ball13Y = 275 ;

float ball14X = 265 , ball14Y = 275 ;

float ball15X = 315 , ball15Y = 275 ;

float ball16X = 365 , ball16Y = 275 ;

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 ( 540 , 420 ) ;

horizontalLinesIcon = Content . Load < Texture2D > ( "horizontalLinesIcon" ) ;

horizontalLinesPosition = new Vector2 ( 440 , 420 ) ;

squareIcon = Content . Load < Texture2D > ( "squareIcon" ) ;

squarePosition = new Vector2 ( 340 , 420 ) ;

circleIcon = Content . Load < Texture2D > ( "circleIcon" ) ;

circlePosition = new Vector2 ( 240 , 420 ) ;

DiamondIcon = Content . Load < Texture2D > ( "DiamondIcon" ) ;

DiamondPosition = new Vector2 ( 140 , 420 ) ;

infinityIcon = Content . Load < Texture2D > ( "infinityIcon" ) ;

infinityPosition = new Vector2 ( 40 , 420 ) ;

ball1 = Content . Load < Texture2D > ( "ball" ) ;

ball1Position = new Vector2 ( ball1X, ball1Y ) ;

ball2 = Content . Load < Texture2D > ( "ball" ) ;

ball2Position = new Vector2 ( ball2X, ball2Y ) ;

ball3 = Content . Load < Texture2D > ( "ball" ) ;

ball3Position = new Vector2 ( ball3X, ball3Y ) ;

ball4 = Content . Load < Texture2D > ( "ball" ) ;

ball4Position = new Vector2 ( ball4X, ball4Y ) ;

ball5 = Content . Load < Texture2D > ( "ball" ) ;

ball5Position = new Vector2 ( ball5X, ball5Y ) ;

ball6 = Content . Load < Texture2D > ( "ball" ) ;

ball6Position = new Vector2 ( ball6X, ball6Y ) ;

ball7 = Content . Load < Texture2D > ( "ball" ) ;

ball7Position = new Vector2 ( ball7X, ball7Y ) ;

ball8 = Content . Load < Texture2D > ( "ball" ) ;

ball8Position = new Vector2 ( ball8X, ball8Y ) ;

ball9 = Content . Load < Texture2D > ( "ball" ) ;

ball9Position = new Vector2 ( ball9X, ball9Y ) ;

ball10 = Content . Load < Texture2D > ( "ball" ) ;

ball10Position = new Vector2 ( ball10X, ball10Y ) ;

ball11 = Content . Load < Texture2D > ( "ball" ) ;

ball11Position = new Vector2 ( ball11X, ball11Y ) ;

ball12 = Content . Load < Texture2D > ( "ball" ) ;

ball12Position = new Vector2 ( ball12X, ball12Y ) ;

ball13 = Content . Load < Texture2D > ( "ball" ) ;

ball13Position = new Vector2 ( ball13X, ball13Y ) ;

ball14 = Content . Load < Texture2D > ( "ball" ) ;

ball14Position = new Vector2 ( ball14X, ball14Y ) ;

ball15 = Content . Load < Texture2D > ( "ball" ) ;

ball15Position = new Vector2 ( ball15X, ball15Y ) ;

ball16 = Content . Load < Texture2D > ( "ball" ) ;

ball16Position = new Vector2 ( ball16X, ball16Y ) ;

}

protected override void UnloadContent ( )

{

}

protected override void Update ( GameTime gameTime )

{

MoverDiamond ( ) ;

MoverBack ( ) ;

MoverSquare ( ) ;

MoverHorizontal ( ) ;

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 )

{

//Diamond Button Functionality

if ( mouseX >= 140 && mouseX <= 220 && mouseY >= 420 && mouseY <= 475 )

{

backColor = new Color ( ( byte ) ( mouseX / 3 ) , ( byte ) ( mouseY / 2 ) , 0 ) ;

//MessageBox(new IntPtr(0), string.Format("Result: It worked Diamond!!!!!!"), "MessageBox title", 0);

// MoveDiamond = true;

}

//Circle Button Functionality

else if ( mouseX >= 240 && mouseX <= 320 && mouseY >= 420 && mouseY <= 475 )

{

backColor = new Color ( ( byte ) ( mouseX / 3 ) , ( byte ) ( mouseY / 2 ) , 0 ) ;

MessageBox ( new IntPtr ( 0 ) , string . Format ( "Result: It worked This is a Circle!!!!!!" ) , "MessageBox title" , 0 ) ;

}

else if ( mouseX >= 40 && mouseX <= 120 && mouseY >= 420 && mouseY <= 475 )

{

backColor = new Color ( ( byte ) ( mouseX / 3 ) , ( byte ) ( mouseY / 2 ) , 0 ) ;

MessageBox ( new IntPtr ( 0 ) , string . Format ( "Result: It worked This is a Infinity!!!!!!" ) , "MessageBox title" , 0 ) ;

}

else if ( current_mouse . X >= 340 && current_mouse . X <= 420 && current_mouse . Y >= 420 && current_mouse . Y <= 475 )

{

backColor = new Color ( ( byte ) ( mouseX / 3 ) , ( byte ) ( mouseY / 2 ) , 0 ) ;

MessageBox ( new IntPtr ( 0 ) , string . Format ( "Result: It worked This is a Square!!!!!!" ) , "MessageBox title" , 0 ) ;

MoveSquare = true ;

}

else if ( mouseX >= 440 && mouseX <= 520 && mouseY >= 420 && mouseY <= 475 )

{

backColor = new Color ( ( byte ) ( mouseX / 3 ) , ( byte ) ( mouseY / 2 ) , 0 ) ;

// MessageBox(new IntPtr(0), string.Format("Result: It worked This is a Horizontal Line!!!!!!"), "MessageBox title", 0);

MoveHorizontal = true ;

}

else if ( mouseX >= 540 && mouseX <= 620 && mouseY >= 420 && mouseY <= 475 )

{

backColor = new Color ( ( byte ) ( mouseX / 3 ) , ( byte ) ( mouseY / 2 ) , 0 ) ;

MessageBox ( new IntPtr ( 0 ) , string . Format ( "Result: It worked This is a Vertical Line!!!!!!" ) , "MessageBox title" , 0 ) ;

}

}

if ( current_mouse . RightButton == ButtonState . Pressed )

{

// MessageBox(new IntPtr(0), string.Format("Result X: {0}", mouseX), "MessageBox title", 0);

MessageBox ( new IntPtr ( 0 ) , string . Format ( "Result Y: {0}" , mouseY ) , "MessageBox title" , 0 ) ;

MoveBack = true ;

//MessageBox(new IntPtr(0), string.Format("Result X: {0}", ball1X), "MessageBox title", 0);

// 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 ) ;

}

public void MoverHorizontal ( )

{

if ( MoveHorizontal )

{

if ( ball5X < 215 )

{

ball5X = ball5X + 1F ;

}

if ( ball5Y > 100 )

{

ball5Y = ball5Y - 1 ;

}

ball5Position = new Vector2 ( ball5X, ball5Y ) ;

if ( ball6X < 265 )

{

ball6X = ball6X + 1 ;

}

if ( ball6Y > 100 )

{

ball6Y = ball6Y - 1F ;

}

ball6Position = new Vector2 ( ball6X, ball6Y ) ;

if ( ball7X < 265 )

{

ball7X = ball7X + 1F ;

}

if ( ball7Y < 220 )

{

ball7Y = ball7Y + 1f ;

}

ball7Position = new Vector2 ( ball7X, ball7Y ) ;

if ( ball8X < 215 )

{

ball8X = ball8X + 1F ;

}

if ( ball8Y < 220 )

{

ball8Y = ball8Y + 1 ;

}

ball8Position = new Vector2 ( ball8X, ball8Y ) ;

if ( ball9X > 315 )

{

ball9X = ball9X - 1 ;

}

ball9Position = new Vector2 ( ball9X, ball9Y ) ;

if ( ball10X > 365 )

{

ball10X = ball10X - 1F ;

}

if ( ball10Y > 100 )

{

ball10Y = ball10Y - 1F ;

}

ball10Position = new Vector2 ( ball10X, ball10Y ) ;

if ( ball11X > 365 )

{

ball11X = ball11X - 1F ;

}

if ( ball11Y < 220 )

{

ball11Y = ball11Y + 1F ;

}

ball11Position = new Vector2 ( ball11X, ball11Y ) ;

if ( ball12X > 315 )

ball12X = ball12X - 1F ;

ball12Position = new Vector2 ( ball12X, ball12Y ) ;

// MessageBox(new IntPtr(0), string.Format("Result Ball5X: {0}", ball5X), "MessageBox title", 0);

}

if ( ball7Y == 225 )

{

MessageBox ( new IntPtr ( 0 ) , string . Format ( "Result Ball5X: {0}" , ball5X ) , "MessageBox title" , 0 ) ;

}

}

public void MoverSquare ( )

{

/*if (ball1X == 230 && ball1Y == 100 &&

ball2X==270 && ball2Y==100 &&

ball3X==310 && ball3Y==100 &&

ball4X==350 && ball4Y==100 &&

ball13X == 230 && ball13Y == 220 &&

ball14X == 270 && ball14Y == 220 &&

ball15X==310 && ball15Y==220 &&

ball16X==350 && ball16Y==220

)

{

MessageBox(new IntPtr(0), string.Format("IT FUCKING RAN", ball1X), "MessageBox title", 0);

MoveSquare = false;

}*/

if ( MoveSquare )

{

if ( ball1X < 230 )

{

ball1X = ball1X + 1 ;

}

if ( ball1Y < 100 )

{

ball1Y = ball1Y + 1 ;

}

ball1Position = new Vector2 ( ball1X, ball1Y ) ;

if ( ball2X < 270 )

{

ball2X = ball2X + 1 ;

}

if ( ball2Y < 100 )

{

ball2Y = ball2Y + 1 ;

}

ball2Position = new Vector2 ( ball2X, ball2Y ) ;

//x=415 & Y=45

if ( ball3X < 310 )

{

ball3X = ball3X + 1 ;

}

if ( ball3Y < 100 )

{

ball3Y = ball3Y + 1 ;

}

ball3Position = new Vector2 ( ball3X, ball3Y ) ;

if ( ball4X > 350 )

{

ball4X = ball4X - 1 ;

}

if ( ball4Y < 100 )

{

ball4Y = ball4Y + 1 ;

}

ball4Position = new Vector2 ( ball4X, ball4Y ) ;

if ( ball13X < 230 )

{

ball13X = ball13X + 1 ;

}

if ( ball13Y > 220 )

{

ball13Y = ball13Y - 1 ;

}

ball13Position = new Vector2 ( ball13X, ball13Y ) ;

if ( ball14X < 270 )

{

ball14X = ball14X + 1 ;

}

if ( ball14Y > 220 )

{

ball14Y = ball14Y - 1 ;

}

ball14Position = new Vector2 ( ball14X, ball14Y ) ;

if ( ball15X < 310 )

{

ball15X = ball15X + 1 ;

}

if ( ball15Y > 220 )

{

ball15Y = ball15Y - 1 ;

}

ball15Position = new Vector2 ( ball15X, ball15Y ) ;

if ( ball16X > 350 )

{

ball16X = ball16X - 1 ;

}

if ( ball16Y > 220 )

{

ball16Y = ball16Y - 1 ;

}

ball16Position = new Vector2 ( ball16X, ball16Y ) ;

/*

//

//Stops balls from moving WIll need 4 one for every sub group.

if ((ball1X == 400) && ball2X == 300 && ball1Y == 40 && ball2Y == 35)

MoveSquare = false;

else

MoveSquare = true;*/

}

if ( ball1X == 230 && ball1Y == 100

)

{

//MessageBox(new IntPtr(0), string.Format("IT FUCKING RAN", ball1X), "MessageBox title", 0);

MoveSquare = false ;

}

}

public void MoverBack ( )

{

if ( MoveBack )

{

//top wall

ball1X = 215 ; ball1Y = 45 ;

ball2X = 265 ; ball2Y = 45 ;

ball3X = 315 ; ball3Y = 45 ;

ball4X = 365 ; ball4Y = 45 ;

//Left Wall

ball5X = 190 ; ball5Y = 100 ;

ball6X = 190 ; ball6Y = 140 ;

ball7X = 190 ; ball7Y = 180 ;

ball8X = 190 ; ball8Y = 220 ;

//Right Wall

ball9X = 390 ; ball9Y = 100 ;

ball10X = 390 ; ball10Y = 140 ;

ball11X = 390 ; ball11Y = 180 ;

ball12X = 390 ; ball12Y = 220 ;

//Bottom Wall

ball13X = 215 ; ball13Y = 275 ;

ball14X = 265 ; ball14Y = 275 ;

ball15X = 315 ; ball15Y = 275 ;

ball16X = 365 ; ball16Y = 275 ;

ball1 = Content . Load < Texture2D > ( "ball" ) ;

ball1Position = new Vector2 ( ball1X, ball1Y ) ;

ball2Position = new Vector2 ( ball2X, ball2Y ) ;

ball3Position = new Vector2 ( ball3X, ball3Y ) ;

ball4Position = new Vector2 ( ball4X, ball4Y ) ;

ball5Position = new Vector2 ( ball5X, ball5Y ) ;

ball6Position = new Vector2 ( ball6X, ball6Y ) ;

ball7Position = new Vector2 ( ball7X, ball7Y ) ;

ball8Position = new Vector2 ( ball8X, ball8Y ) ;

ball9Position = new Vector2 ( ball9X, ball9Y ) ;

ball10Position = new Vector2 ( ball10X, ball10Y ) ;

ball11Position = new Vector2 ( ball11X, ball11Y ) ;

ball12Position = new Vector2 ( ball12X, ball12Y ) ;

ball13Position = new Vector2 ( ball13X, ball13Y ) ;

ball14Position = new Vector2 ( ball14X, ball14Y ) ;

ball15Position = new Vector2 ( ball15X, ball15Y ) ;

ball16Position = new Vector2 ( ball16X, ball16Y ) ;

MoveBack = false ;

}

}

public void MoverDiamond ( )

{

if ( ( ball1X == 400 ) && ball2X == 300 && ball1Y == 40 && ball2Y == 35 )

{

MoveDiamond = false ;

}

else if ( MoveDiamond )

{

if ( ball1X < 400 )

{

ball1X = ball1X + 1 ;

}

if ( ball1Y > 40 )

{

ball1Y = ball1Y - 1 ;

}

ball1Position = new Vector2 ( ball1X,ball1Y ) ;

if ( ball2X < 375 )

{

ball2X = ball2X + 1 ;

}

if ( ball2Y > 65 )

{

ball2Y = ball2Y - 1 ;

}

ball2Position = new Vector2 ( ball2X, ball2Y ) ;

//x=415 & Y=45

ball3X = ball3X + 1 ;

ball3Y = ball3Y - 1 ;

ball3Position = new Vector2 ( ball3X, ball3Y ) ;

ball4X = ball4X + 1 ;

ball4Y = ball4Y - 1 ;

ball4Position = new Vector2 ( ball4X, ball4Y ) ;

ball5X = ball5X + 1 ;

ball5Y = ball5Y - 1 ;

ball5Position = new Vector2 ( ball5X, ball5Y ) ;

ball6X = ball6X + 1 ;

ball6Y = ball6Y - 1 ;

ball6Position = new Vector2 ( ball6X, ball6Y ) ;

ball7X = ball7X + 1 ;

ball7Y = ball7Y - 1 ;

ball7Position = new Vector2 ( ball7X, ball7Y ) ;

ball8X = ball8X + 1 ;

ball8Y = ball8Y - 1 ;

ball8Position = new Vector2 ( ball8X, ball8Y ) ;

ball9X = ball9X + 1 ;

ball9Y = ball9Y - 1 ;

ball9Position = new Vector2 ( ball9X, ball9Y ) ;

ball10X = ball10X + 1 ;

ball10Y = ball10Y - 1 ;

ball10Position = new Vector2 ( ball10X, ball10Y ) ;

ball11X = ball11X + 1 ;

ball11Y = ball11Y - 1 ;

ball11Position = new Vector2 ( ball11X, ball11Y ) ;

ball12X = ball12X + 1 ;

ball12Y = ball12Y - 1 ;

ball12Position = new Vector2 ( ball12X, ball12Y ) ;

ball13X = ball13X + 1 ;

ball13Y = ball13Y - 1 ;

ball13Position = new Vector2 ( ball13X, ball13Y ) ;

ball14X = ball14X + 1 ;

ball14Y = ball14Y - 1 ;

ball14Position = new Vector2 ( ball14X, ball14Y ) ;

ball15X = ball15X + 1 ;

ball15Y = ball15Y - 1 ;

ball15Position = new Vector2 ( ball15X, ball15Y ) ;

ball16X = ball16X + 1 ;

ball16Y = ball16Y - 1 ;

ball16Position = new Vector2 ( ball16X, ball16Y ) ;

//MessageBox(new IntPtr(0), string.Format("Result X: {0}", ball1X), "MessageBox title", 0);

//Stops balls from moving WIll need 4 one for every sub group.

if ( ( ball1X == 400 ) && ball2X == 300 && ball1Y == 40 && ball2Y == 35 )

MoveDiamond = false ;

else

MoveDiamond = true ;

}

}

}