예제 #1
0
        public IEditorGameFacade Create([NotNull] SharpDXElement context, [NotNull] IEnumerable <IGameComponent> components,
                                        [NotNull] World world, int dimension)
        {
            var game = new EditorGame(context, components, world, dimension);

            game.Run(context);
            return(game);
        }
예제 #2
0
        public void Dispose()
        {
            _game           = null;
            _graphicsDevice = null;
            _sharpDx        = null;
            _mouse          = null;

            _disposed = true;
        }
예제 #3
0
파일: DebugCube.cs 프로젝트: Tristyn/MCFire
        public DebugCube([NotNull] EditorGame game)
        {
            if (game == null)
            {
                throw new ArgumentNullException("game");
            }

            var vertices = game.ToDisposeContent(Buffer.Vertex.New(
                                                     game.GraphicsDevice,
                                                     new[]
            {
                new VertexPositionColor(new Vector3(1.0f, 1.0f, -1.0f), Color.Orange),     // Front
                new VertexPositionColor(new Vector3(-1.0f, 1.0f, -1.0f), Color.Orange),
                new VertexPositionColor(new Vector3(-1.0f, -1.0f, -1.0f), Color.Orange),
                new VertexPositionColor(new Vector3(1.0f, -1.0f, -1.0f), Color.Orange),
                new VertexPositionColor(new Vector3(1.0f, 1.0f, -1.0f), Color.Orange),
                new VertexPositionColor(new Vector3(-1.0f, -1.0f, -1.0f), Color.Orange),
                new VertexPositionColor(new Vector3(-1.0f, 1.0f, 1.0f), Color.Orange),     // BACK
                new VertexPositionColor(new Vector3(1.0f, 1.0f, 1.0f), Color.Orange),
                new VertexPositionColor(new Vector3(-1.0f, -1.0f, 1.0f), Color.Orange),
                new VertexPositionColor(new Vector3(1.0f, 1.0f, 1.0f), Color.Orange),
                new VertexPositionColor(new Vector3(1.0f, -1.0f, 1.0f), Color.Orange),
                new VertexPositionColor(new Vector3(-1.0f, -1.0f, 1.0f), Color.Orange),
                new VertexPositionColor(new Vector3(1.0f, 1.0f, 1.0f), Color.OrangeRed),     // Top
                new VertexPositionColor(new Vector3(-1.0f, 1.0f, 1.0f), Color.OrangeRed),
                new VertexPositionColor(new Vector3(-1.0f, 1.0f, -1.0f), Color.OrangeRed),
                new VertexPositionColor(new Vector3(1.0f, 1.0f, -1.0f), Color.OrangeRed),
                new VertexPositionColor(new Vector3(1.0f, 1.0f, 1.0f), Color.OrangeRed),
                new VertexPositionColor(new Vector3(-1.0f, 1.0f, -1.0f), Color.OrangeRed),
                new VertexPositionColor(new Vector3(-1.0f, -1.0f, 1.0f), Color.OrangeRed),     // Bottom
                new VertexPositionColor(new Vector3(1.0f, -1.0f, 1.0f), Color.OrangeRed),
                new VertexPositionColor(new Vector3(-1.0f, -1.0f, -1.0f), Color.OrangeRed),
                new VertexPositionColor(new Vector3(1.0f, -1.0f, 1.0f), Color.OrangeRed),
                new VertexPositionColor(new Vector3(1.0f, -1.0f, -1.0f), Color.OrangeRed),
                new VertexPositionColor(new Vector3(-1.0f, -1.0f, -1.0f), Color.OrangeRed),
                new VertexPositionColor(new Vector3(-1.0f, 1.0f, 1.0f), Color.DarkOrange),     // Left
                new VertexPositionColor(new Vector3(-1.0f, -1.0f, 1.0f), Color.DarkOrange),
                new VertexPositionColor(new Vector3(-1.0f, -1.0f, -1.0f), Color.DarkOrange),
                new VertexPositionColor(new Vector3(-1.0f, 1.0f, -1.0f), Color.DarkOrange),
                new VertexPositionColor(new Vector3(-1.0f, 1.0f, 1.0f), Color.DarkOrange),
                new VertexPositionColor(new Vector3(-1.0f, -1.0f, -1.0f), Color.DarkOrange),
                new VertexPositionColor(new Vector3(1.0f, -1.0f, 1.0f), Color.DarkOrange),     // Right
                new VertexPositionColor(new Vector3(1.0f, 1.0f, 1.0f), Color.DarkOrange),
                new VertexPositionColor(new Vector3(1.0f, -1.0f, -1.0f), Color.DarkOrange),
                new VertexPositionColor(new Vector3(1.0f, 1.0f, 1.0f), Color.DarkOrange),
                new VertexPositionColor(new Vector3(1.0f, 1.0f, -1.0f), Color.DarkOrange),
                new VertexPositionColor(new Vector3(1.0f, -1.0f, -1.0f), Color.DarkOrange)
            }));

            _effect = game.ToDisposeContent(new BasicEffect(game.GraphicsDevice)
            {
                VertexColorEnabled = true,
            });
            _mesh = new Mesh <VertexPositionColor>(vertices, _effect, true);
        }
예제 #4
0
        public Camera(EditorGame game)
        {
            _game           = game;
            _graphicsDevice = _game.GraphicsDevice;
            _sharpDx        = _game.SharpDxElement;
            _mouse          = _game.Mouse;

            _mouse.Right.DragStart += PerspectiveDragStart;
            _mouse.Right.DragMove  += PerspectiveDragMove;
            _mouse.Right.DragEnd   += PerspectiveDragEnd;
        }
예제 #5
0
파일: DebugCube.cs 프로젝트: Tristyn/MCFire
        public void Draw([NotNull] EditorGame game)
        {
            if (game == null)
            {
                throw new ArgumentNullException("game");
            }
            if (_disposed)
            {
                throw new ObjectDisposedException("DebugCube");
            }

            _effect.World      = Matrix.Translation(Position);
            _effect.View       = game.Camera.ViewMatrix;
            _effect.Projection = game.Camera.ProjectionMatrix;
            _mesh.Draw(game.GraphicsDevice);
        }