예제 #1
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            GraphicsDevice.Textures[0] = null;

            var MouseImage = MouseTexture.Compile(GraphicsDevice);

            // TODO: Add your drawing code here
            spriteBatch.Begin();

            var v00 = new Vector2(0, 0);

            if (MapTexture != null)
            {
                spriteBatch.Draw(MapTexture, v00, Color.White);

                foreach (var t in Map.GetLayerTextures(GraphicsDevice))
                {
                    spriteBatch.Draw(t, v00, Color.White);
                }
            }

            if (MouseTexture != null)
            {
                spriteBatch.Draw(MouseImage, MousePos, Color.White);
            }

            spriteBatch.End();

            //if (MapPreview != null) {
            //    spriteBatch.Begin();

            //    spriteBatch.Draw(MapPreview, MousePos, Color.White);

            //    spriteBatch.End();
            //}


            //if (VoxelContent != null) {
            //    worldMatrix = Matrix.Identity * Matrix.CreateScale(scale);

            //    effect.World = worldMatrix;

            //    projectionMatrix = Matrix.CreateOrthographic((float)GraphicsDevice.Viewport.Width, (float)GraphicsDevice.Viewport.Height, -1000.0f, 1000.0f);

            //    effect.Projection = projectionMatrix;

            //    viewMatrix = Matrix.CreateRotationX(rotation.X) * Matrix.CreateRotationY(rotation.Y) * Matrix.CreateRotationZ(rotation.Z) * Matrix.CreateTranslation(offX, offY, 0);

            //    effect.View = viewMatrix;


            //    GraphicsDevice.SetVertexBuffer(vertexBuffer);
            //    GraphicsDevice.Indices = indexBuffer;

            //    foreach (EffectPass pass in effect.CurrentTechnique.Passes) {
            //        pass.Apply();

            //        GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, VoxelContent.Length, 0, VoxelIndices.Length / 3);
            //    }
            //}

            base.Draw(gameTime);
        }