Example #1
0
        public Chunk(int x, int z, World wld)
        {
            X = x;
            Z = z;
            world = wld;
            blocks = new Block[CHUNK_SIZE, CHUNK_HEIGHT, CHUNK_SIZE];

            blockLight = new float[CHUNK_SIZE * CHUNK_HEIGHT * CHUNK_SIZE];
            skyLight = new float[CHUNK_SIZE * CHUNK_HEIGHT * CHUNK_SIZE];
        }
Example #2
0
        internal void loadGame()
        {
            world = new World(5);
            world.sunRenderTarget = new RenderTarget2D(GraphicsDevice, Window.ClientBounds.Width, Window.ClientBounds.Height, false, GraphicsDevice.PresentationParameters.BackBufferFormat, GraphicsDevice.PresentationParameters.DepthStencilFormat);
            world.postfxRenderTarget1 = new RenderTarget2D(GraphicsDevice, Window.ClientBounds.Width, Window.ClientBounds.Height, false, GraphicsDevice.PresentationParameters.BackBufferFormat, GraphicsDevice.PresentationParameters.DepthStencilFormat);
            world.postfxRenderTarget2 = new RenderTarget2D(GraphicsDevice, Window.ClientBounds.Width, Window.ClientBounds.Height, false, GraphicsDevice.PresentationParameters.BackBufferFormat, GraphicsDevice.PresentationParameters.DepthStencilFormat);
            world.sceneRenderTarget = new RenderTarget2D(GraphicsDevice, Window.ClientBounds.Width, Window.ClientBounds.Height, false, GraphicsDevice.PresentationParameters.BackBufferFormat, GraphicsDevice.PresentationParameters.DepthStencilFormat);
            //world.depthRenderTarget = new RenderTarget2D(GraphicsDevice, 4096, 4096, false, SurfaceFormat.Single, DepthFormat.Depth24Stencil8);

            player = new Player(world);
            player.Position = new Vector3(0, Chunk.CHUNK_HEIGHT, 0);
            player.Camera = new Camera((float)graphics.PreferredBackBufferWidth / graphics.PreferredBackBufferHeight);

            Mouse.SetPosition(Window.ClientBounds.Center.X, Window.ClientBounds.Center.Y);
            IsMouseVisible = false;

            GameState = GameState.InGame;

            Screen.Screens["Main Menu"].Visible = false;
            Screen.Screens["Loading"].Visible = false;
        }
Example #3
0
 public Player(World world)
 {
     Width = .6f;
     Height = 1.8f;
     this.world = world;
 }