예제 #1
0
        public TileSetMenu(Vector2 position, TileMap tileset)
        {
            this.position = position;
            this.tileset = tileset;

            tileset.CreateNewTileSet(tileIndex);

            menu = GameUsage.tileSetMenu;

            right = new Button(GameButtons.rightTex, new Vector2(position.X + menu.Width - 32, position.Y + menu.Height - 16), GameButtons.srcRight);
            left = new Button(GameButtons.leftTex, new Vector2(position.X + 16, position.Y + menu.Height - 16), GameButtons.srcLeft);
            down = new Button(GameButtons.downTex, new Vector2(position.X + menu.Width - 16, position.Y + menu.Height - 32), GameButtons.srcDown);
            up = new Button(GameButtons.upTex, new Vector2(position.X + menu.Width - 16, position.Y + 16), GameButtons.srcUp);

            nextTileset = new Button(GameButtons.grayRightTex, new Vector2(position.X + menu.Width - 32, position.Y + 0), GameButtons.srcGrayRight);
            prevTileset = new Button(GameButtons.grayRightTex, new Vector2(position.X + 16, position.Y + 0), GameButtons.srcGrayLeft);

            right.Click += new ClickEvent(ScrollRight);
            left.Click += new ClickEvent(ScrollLeft);
            down.Click += new ClickEvent(Scrolldown);
            up.Click += new ClickEvent(Scrollup);

            nextTileset.Click += new ClickEvent(NextTileSet);
            prevTileset.Click += new ClickEvent(PrevTileSet);

            background = new MovingBackground(new Vector2(position.X + 16, position.Y + 16), GameUsage.backTile2, 16, 16, 7, 208, 80);
        }
예제 #2
0
파일: Editor.cs 프로젝트: TevenxD/Portfolio
        public Editor()
        {
            // new selected tile menu
            selected = new Selected(GameUsage.selectedPos);

            // new tileset
            Rectangle tilesetRect = GameUsage.tilesetRect;
            tileset = new TileMap(new Vector2(tilesetRect.X, tilesetRect.Y), selected.tile, tilesetRect.Width, tilesetRect.Height);

            // new map
            Rectangle mapRect = GameUsage.mapRect;
            for (int i = 0; i < 3; i++)
            {
                map.Add(new TileMap(new Vector2(mapRect.X, mapRect.Y), selected.tile, mapRect.Width, mapRect.Height));
                map[i].CreateNewMap(640, 320, i != 0);
            }

            // new tileset menu
            tileSetMenu = new TileSetMenu(GameUsage.tilesetMenuPos, tileset);

            // new map menu
            mapMenu = new MapMenu(GameUsage.MapMenuPos, map);

            // new layer/edit menu
            layerMenu = new EditMenu(GameUsage.layerMenuPos, map);

            // new file menu
            fileMenu = new FileMenu(GameUsage.fileMenuPos, map);

            // background
            background = new MovingBackground(new Vector2(0,0), GameUsage.backTile1, 16, 16, 3, GameUsage.GameWidth, GameUsage.GameHeight);
        }