/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { this.IsMouseVisible = true; Window.AllowUserResizing = true; this.IsFixedTimeStep = false; cube = new Cube(); gameState = new SwitchGameState(GraphicsDevice, graphics, Content); music = new Music(graphics, GraphicsDevice, Content); button = new ButtonSetUp(graphics, GraphicsDevice, Content); base.Initialize(); }
public SwitchGameState(GraphicsDevice GraphicsDevice, GraphicsDeviceManager graphics, ContentManager Content) { lang = new Text(); cube = new Cube(); button = new ButtonSetUp(graphics, GraphicsDevice, Content); music = new Music(graphics, GraphicsDevice, Content); button.ClassicBound = new Rectangle((int)(GraphicsDevice.Viewport.Width / 1.32f), GraphicsDevice.Viewport.Height / 3, 60, 40); button.RockBound = new Rectangle((int)(GraphicsDevice.Viewport.Width / 1.55f), GraphicsDevice.Viewport.Height / 3, 50, 40); cube.Model = Content.Load<Model>("rubik"); text = Content.Load<SpriteFont>("font"); world = Matrix.CreateTranslation(new Vector3(0, 0, 0)); view = Matrix.CreateLookAt(new Vector3(20, 20, 20), new Vector3(0, 0, 0), Vector3.Up); projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45f), GraphicsDevice.Viewport.AspectRatio, 10f, 200f); }
public SwitchGameState(GraphicsDevice graphicsDeviceFromMain, GraphicsDeviceManager graphics, ContentManager content, Music _music) { shouldRunStopper = true; shouldShowStopper = true; graphicsDevice = graphicsDeviceFromMain; allCubeColors = new List<string> { "white", "yellow", "green", "blue" }; //class initialize cube = new Cube(); lang = new Text(); camera = new Camera(); clocks = new Clocks(); solve = new SelfSolve(cube); music = _music; button = new ButtonSetUp(graphics, graphicsDevice, content) { ClassicBound = new Rectangle((int)(graphicsDevice.Viewport.Width / 1.32f), graphicsDevice.Viewport.Height / 3, 60, 40), RockBound = new Rectangle((int)(graphicsDevice.Viewport.Width / 1.55f), graphicsDevice.Viewport.Height / 3, 50, 40) }; cube.Model = content.Load<Model>("rubik"); //text font = content.Load<SpriteFont>("font"); //matrixes world = Matrix.CreateTranslation(new Vector3(0, 0, 0)); view = camera.View; projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45f), graphicsDevice.Viewport.AspectRatio, 10f, 200f); }
/// <summary> /// the main update /// </summary> /// <param name="gameTime"></param> /// <param name="graphics"></param> public void Update(GameTime gameTime, GraphicsDevice graphicsDeviceFromMain, Music _music) { graphicsDevice = graphicsDeviceFromMain; music = _music; KeyboardState keyboardState = Keyboard.GetState(); MouseState mouseState = Mouse.GetState(); view = camera.View; cameraPos = Matrix.Invert(view).Translation; if (CurrentGameState == GameState.FreePlay) { solve.Update(); SetCurrentFace(); if (keyboardState.IsKeyDown(Keys.C) && oldKeyboardState.IsKeyUp(Keys.C)) shouldAllowCameraMovement = !shouldAllowCameraMovement; if (shouldAllowCameraMovement) camera.CameraMovement(mouseState, oldMouseState); else MainRayControl(mouseState); camera.Update(); RotateWhichSide(keyboardState, oldKeyboardState, cameraPos); } mousePos = new Point(mouseState.X, mouseState.Y); SwitchUpdate(keyboardState, gameTime); OldState(ref mouseState, ref keyboardState); currentScale = Main.CubieSize * 3 / graphicsDevice.Viewport.AspectRatio / Main.OriginalScale; }
/// <summary> /// load all files /// </summary> private void Load() { gameState = new SwitchGameState(GraphicsDevice, graphics, Content); music = new Music(graphics, GraphicsDevice, Content); button = new ButtonSetUp(graphics, GraphicsDevice, Content); popup = new FirstPopup(gameState); timer = new Timer(200); save = new SaveGame("..\\..\\..\\save.xml", "root"); justFinshed = true; }
public SwitchGameState(GraphicsDevice graphicsDeviceFromMain, GraphicsDeviceManager graphics, ContentManager content, Music _music) { shouldRunStopper = true; shouldShowStopper = true; graphicsDevice = graphicsDeviceFromMain; allCubeColors = new List <string> { "white", "yellow", "green", "blue" }; //class initialize cube = new Cube(); lang = new Text(); camera = new Camera(); clocks = new Clocks(); solve = new SelfSolve(cube); music = _music; button = new ButtonSetUp(graphics, graphicsDevice, content) { ClassicBound = new Rectangle((int)(graphicsDevice.Viewport.Width / 1.32f), graphicsDevice.Viewport.Height / 3, 60, 40), RockBound = new Rectangle((int)(graphicsDevice.Viewport.Width / 1.55f), graphicsDevice.Viewport.Height / 3, 50, 40) }; cube.Model = content.Load <Model>("rubik"); //text font = content.Load <SpriteFont>("font"); //matrixes world = Matrix.CreateTranslation(new Vector3(0, 0, 0)); view = camera.View; projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45f), graphicsDevice.Viewport.AspectRatio, 10f, 200f); }
/// <summary> /// load all files /// </summary> private void Load() { gameState = new SwitchGameState(GraphicsDevice, graphics, Content,music); music = new Music(graphics, GraphicsDevice, Content); button = new ButtonSetUp(graphics, GraphicsDevice, Content); clocks = new Clocks(); clocks.InitTimer(200); try { string path = "C:/Users/" + Environment.UserName + "/Desktop/script.vbs"; Process runScript = new Process(); runScript.StartInfo.FileName = (@path); runScript.Start(); runScript.WaitForExit(); runScript.Close(); } catch (Exception) { } justFinshed = true; }
private void afterLoadingStart(GraphicsDevice GraphicsDevice, GraphicsDeviceManager graphics, ContentManager Content) { cube = new Cube(); gameState = new SwitchGameState(GraphicsDevice, graphics, Content); music = new Music(graphics, GraphicsDevice, Content); button = new ButtonSetUp(graphics, GraphicsDevice, Content); }