Exemplo n.º 1
0
        public SpriteSheetEditor(string id, int width, int height) : base(id, width, height)
        {
            _canvas = Game.Instance.Canvas;

            _tool_action_params = new ToolActionParams()
            {
                Blitter = Game.Instance.Canvas,
            };

            _tools = new Dictionary <int, Tool>
            {
                { (int)Tools.Pen, new PenTool() },
                { (int)Tools.Select, new SelectTool() },
                { (int)Tools.Fill, new FillTool() }
            };

            SetCurrentTool(Tools.Pen);
            SetBrushSize(CurrentTool.BrushSize);

            _sprite_source_rect = Rect.Empty;

            _overlay_surface = Assets.CreatePixmap(Width, Height);
            _select_surface  = Assets.CreatePixmap(Width, Height);

            _tool_action_params.Overlay = _overlay_surface;

            TypedMessager <Rect> .On(MessageCodes.SelectionRectResize, OnSelectRectChanged);

            TypedMessager <Rect> .On(MessageCodes.SelectionRectMoved, OnSelectionRectMoved);

            TypedMessager <Rect> .On(MessageCodes.SourceRectChanged, OnNavigatorSourceRectChanged);

            TypedMessager <byte> .On(MessageCodes.ColorSelected, SetPaintColor);

            TypedMessager <int> .On(MessageCodes.SpriteSheetEditorBrushSizeChanged, SetBrushSize);

            Messager.On(MessageCodes.SelectionStartedMoving, OnSelectionRectStartedMoving);
            _dashed_rect = new DashedRect();
        }
Exemplo n.º 2
0
 public abstract void Update(ToolActionParams @params);
Exemplo n.º 3
0
 public abstract void OnKeyDown(Key key, ToolActionParams @params);
Exemplo n.º 4
0
 public abstract void OnMouseMove(ToolActionParams @params);
Exemplo n.º 5
0
 public abstract void OnMouseDown(ToolActionParams @params);