Beispiel #1
0
        private void MainForm_Load(object sender, System.EventArgs e)
        {
            Messager.On((int)MessageCodes.LibraryModified, OnLibraryModified);

            Library.Load();

            InitPlatformContextMenu();

            InitRomContextMenu();

            UpdateControls();
        }
Beispiel #2
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();
        }