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); }
/// <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 graphicsDevice, GraphicsDeviceManager graphics, ContentManager content) { //class initialize cube = new Cube(); lang = new Text(); camera = new Camera(); 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); }
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> /// draws the model given /// </summary> /// <param name="cube"></param> /// <param name="objectWorldMatrix"></param> /// <param name="view"></param> /// <param name="projection"></param> /// <param name="graphicsDevice"></param> public void DrawModel(Cube cube, Matrix objectWorldMatrix, Matrix view, Matrix projection) { graphicsDevice.BlendState = BlendState.Opaque; graphicsDevice.DepthStencilState = DepthStencilState.Default; for (int index = 0; index < cube.Model.Meshes.Count; index++) { ModelMesh mesh = cube.Model.Meshes[index]; foreach (BasicEffect effect in mesh.Effects) { effect.EnableDefaultLighting(); effect.World = Matrix.CreateScale(currentScale) * mesh.ParentBone.Transform * Matrix.CreateTranslation(Main.CubieSize, -Main.CubieSize, -Main.CubieSize) * cube.MeshTransforms[index] * objectWorldMatrix; effect.View = view; effect.Projection = projection; } mesh.Draw(); } }
public void DrawModel(Cube cube, Matrix objectWorldMatrix, Matrix view, Matrix projection, GraphicsDevice GraphicsDevice) { GraphicsDevice.BlendState = BlendState.Opaque; GraphicsDevice.DepthStencilState = DepthStencilState.Default; for (int index = 0; index < cube.Model.Meshes.Count; index++) { ModelMesh mesh = cube.Model.Meshes[index]; foreach (BasicEffect effect in mesh.Effects) { effect.EnableDefaultLighting(); effect.World = mesh.ParentBone.Transform * Matrix.CreateTranslation(Game1.CUBIE_SIZE, -Game1.CUBIE_SIZE, -Game1.CUBIE_SIZE) * cube.MeshTransforms[index] * objectWorldMatrix; effect.View = view; effect.Projection = projection; } mesh.Draw(); } }
public SelfSolve(Cube _cube) { cube = _cube; CubeState = cube.cubeConfig; targetState = CubeState.GetCubeState(); }