Esempio n. 1
0
 public Blockset(String Name, Tileset TilesetMain)
 {
     this.Name = Name;
     this.TilesetMain = TilesetMain;
     Blocks.Add(new Block("null", 0, TilesetMain, false, false));
     Blocks.Add(new Block("null_solid", 0, TilesetMain, false, true));
     Blocks.Add(new Block("standard", 1, TilesetMain, true, true));
 }
Esempio n. 2
0
        public BlockDesigner(Engine engine, Tileset tileset, BlockPlacer parentScreen)
            : base("Block Designer")
        {
            this.parentScreen = parentScreen;
            this.tileset = tileset;
            this.EditMode = false;
            this.CurrentBlock = new Block("", 0, tileset, true, true);

            SetUpScreen(engine);
        }
Esempio n. 3
0
        public BlockDesigner(Engine engine, Tileset tileset, BlockPlacer parentScreen, Block block)
            : base("Block Designer")
        {
            this.parentScreen = parentScreen;
            this.tileset = tileset;
            this.EditMode = true;
            this.CurrentBlock = block;

            SetUpScreen(engine);

            ScreenButton _but = new ScreenButton(this, "Delete", "Del", engine.FontMain);
            _but.Position.X = Screen.boarderSize * 6 + 2 * 32 + 48 + 64 + 48;
            _but.Position.Y = PrevBox.Y + PrevBoxSize + boarderSize;;
            _but.Size.X = 32;
            this.AddElement(_but);
        }
Esempio n. 4
0
 public Block(String Name, int[] Tex, short[] SideProperty, Tileset TilesetMain, bool Culling, bool Solid)
 {
     this.Name = Name;
     this.TilesetMain = TilesetMain;
     this.Tex = Tex;
     this.SideProperty = SideProperty;
     this.Culling = Culling;
     this.Solid = Solid;
 }
Esempio n. 5
0
 /// <summary>
 /// Constructs a new block.
 /// </summary>
 public Block(String Name, int Tex, Tileset TilesetMain, bool Culling, bool Solid)
 {
     this.Name = Name;
     this.TilesetMain = TilesetMain;
     this.Tex = new int[6] { Tex, Tex, Tex, Tex, Tex, Tex };
     this.SideProperty = new short[6];
     this.Culling = Culling;
     this.Solid = Solid;
 }
Esempio n. 6
0
        private void LoadTileset(String Filename, Texture2D Texture, int GridWidth)
        {
            // The filename should not have the extension.

            Tileset _newTileset = new Tileset(Filename, Texture, Texture.Width / GridWidth);
            TilesetList.Add(_newTileset);

            TextReader tilesetFile = new StreamReader("Content/Texts/" + Filename + ".tlin");
            String line;
            int lineNum = 0;
            do
            {
                line = tilesetFile.ReadLine();
                if (line != null)
                {
                    String[] _lineSplit = line.Split(' ');
                    for (int i = 0; i < _lineSplit.Length; i++)
                    {
                        TextureData _newTexture = new TextureData(_lineSplit[i], Texture, new Vector2((float)i / (float)GridWidth, (float)lineNum / (float)GridWidth), new Vector2(1f / (float)GridWidth, 1f / (float)GridWidth));
                        _newTileset.Tiles.Add(_newTexture);
                    }

                    for (int i = _lineSplit.Length; i < GridWidth; i++)
                    {
                        _newTileset.Tiles.Add(null);
                    }
                }
                lineNum += 1;
            }
            while (line != null);

            tilesetFile.Close();
        }