Exemplo n.º 1
0
        private void DrawMapObjectAtLayer(Graphics g, int layer, int x, int y)
        {
            TileGraphics tileGfx = Map.Layers[layer].GetObject(x, y).Graphics;

            Tileset[tileGfx.Index].Draw(g, x, y, PixelWidth, PixelHeight,
                                        Palette[tileGfx.Color1], Palette[tileGfx.Color2], Palette[tileGfx.Color3], true);
        }
Exemplo n.º 2
0
        private void SetObjectTile(int x, int y, TileGraphics tile)
        {
            if (x < 0 || y < 0 || x >= Map.Width || y >= Map.Height)
            {
                return;
            }

            CurrentMapLayer.SetObjectTile(x, y, tile);

            InvalidatedMapPositions.Add(new Point(x, y));
            Refresh();
        }
Exemplo n.º 3
0
        public Tile(Grid parent, TilePos index)
            : base(parent.Game)
        {
            Parent  = parent;
            Context = parent.GenerationContext;
            Index   = index;
            Offset  = index.ToBlockPos();

            Centroid = EntityPosition.Create(Index, RealSize * 0.5f);

            Graphics = new TileGraphics(this);

            List <ConcurrentQueue <Action> > acts = new List <ConcurrentQueue <Action> >();

            foreach (var v in Enum.GetValues(typeof(GenerationStage)))
            {
                acts.Add(new ConcurrentQueue <Action>());
            }

            _pendingActions = acts.ToArray();
        }
Exemplo n.º 4
0
        public MainWindow()
        {
            InitializeComponent();

            DataDirectory      = Path.Combine(@"C:\Fernando\Proj\Windows\TileStudio\TileStudio\bin\Debug", "data");
            TilesetFile        = Path.Combine(DataDirectory, "tileset.dat");
            DefaultTilesetFile = Path.Combine(DataDirectory, "default_tileset.dat");
            PaletteFile        = Path.Combine(DataDirectory, "palette.dat");

            ClearLog();
            ClearStatusBar();

            Palette = new Palette();
            Palette.Load(PaletteFile);
            Log("Palette loaded from " + PaletteFile);

            Tileset = new Tileset();
            Tileset.Load(TilesetFile);
            Log("Tileset loaded from " + TilesetFile);
            TilesetBox.EditorWindow = this;
            TilesetBox.Tileset      = Tileset;
            UpdateTilesetPageIndicator();

            Map = new Map();
            MapBox.SetMap(Map);
            MapBox.EditorWindow = this;
            MapBox.Tileset      = Tileset;
            MapBox.Palette      = Palette;

            MouseWheel        += Map_MouseWheel;
            MapBox.MouseWheel += Map_MouseWheel;

            UpdateMapLayerList();

            TileGraphics    = new TileGraphics();
            TxtMapName.Text = Map.Name;
            SetCurrentMapFile(null);

            TxtCommand.Text = "";
        }
Exemplo n.º 5
0
 private void BtnEraseObject_Click(object sender, EventArgs e)
 {
     TileGraphics = new TileGraphics();
     ObjectBytes  = new List <byte>();
 }