예제 #1
0
        public WorldObjects(World wld)
        {
            MetaFile = new Minecraft2DMeta();

            MetaFile.WorldSize = new Vector2i(100 * 32, 256 * 32);
            MetaFile.WorldSizeInBlocks = new Vector2i(100, 256);
            ForegroundLayerTiles = new Tile[MetaFile.WorldSizeInBlocks.Y, MetaFile.WorldSizeInBlocks.X];
            BackgroundLayerTiles = new Tile[MetaFile.WorldSizeInBlocks.Y, MetaFile.WorldSizeInBlocks.X];
            Lightmap = new int[MetaFile.WorldSizeInBlocks.Y, MetaFile.WorldSizeInBlocks.X];
            MetaFile.WorldName = "World1";

            _worldRef = wld;
            WorldIndex = 0;
        }
예제 #2
0
        public MainGameScreen(int worldLoadIndex = -1)
        {
            world = new World(worldLoadIndex);
            MainMessageQueue = new MessageQueue();
            AddControl(MainMessageQueue);

            MainGame.WindowClosing += () =>
            {
                //world.SaveWorldBinary("World1.mc2dbin");
                world.WorldObj.SaveWorld();
                MainGame.WriteSettings();
            };

            worldRenderTarget = new RenderTarget2D(MainGame.GlobalGraphicsDevice, MainGame.GlobalGraphicsDevice.Viewport.Width, MainGame.GlobalGraphicsDevice.Viewport.Height, false, MainGame.GlobalGraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24);
            worldLightmapPass = new RenderTarget2D(MainGame.GlobalGraphicsDevice, MainGame.GlobalGraphicsDevice.Viewport.Width, MainGame.GlobalGraphicsDevice.Viewport.Height, false, MainGame.GlobalGraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24);
            allTogether = new RenderTarget2D(MainGame.GlobalGraphicsDevice, MainGame.GlobalGraphicsDevice.Viewport.Width, MainGame.GlobalGraphicsDevice.Viewport.Height, false, MainGame.GlobalGraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24);

            TilesList = PresetBlocks.TilesListAsArray();
            PlacingTile = TilesList[currentTileIndex];
        }