예제 #1
0
        private void LoadTools(GameState gameState)
        {
            String      toolSpritePath = "Sprites/Tools/";
            ToolFactory toolFactory    = new ToolFactory();

            foreach (ExistingTools et in Enum.GetValues(typeof(ExistingTools)))
            {
                Texture2D toolSprite = ContentManager.Load <Texture2D>(toolSpritePath + et.ToString());
                switch (et)
                {
                case ExistingTools.pickaxe:
                    Pickaxe.ToolSprite = toolSprite;
                    break;

                case ExistingTools.rope:
                    Rope.ToolSprite = toolSprite;
                    break;

                default:
                    MyDebugger.WriteLine(
                        string.Format("GameObject '{0}' cannot be created", true));
                    break;
                }

                Tool tool = toolFactory.Create(new Obj {
                    Type = et.ToString()
                });
                gameState.AddTool(et, tool);
            }
        }
예제 #2
0
        public BitmapSource Draw(BitmapSource currentBitmap, ToolType toolType,
                                 IList <Point> drawingPoints, DrawingItemProperties properties)
        {
            IPainterTool painterTool = _toolFactory.Create(toolType);

            if (_pixelCollection == null)
            {
                _pixelCollection = BitmapConverter.ToPixelCollection(currentBitmap);
            }
            var newPixels = painterTool.Draw(_pixelCollection, drawingPoints, properties);

            // TODO Add to undo operations here
            _pixelCollection = newPixels;
            return(BitmapConverter.ToBitmap(newPixels));
        }
예제 #3
0
        static void Main(string[] args)
        {
            if (!Env.ProcessEnvArguments(args))
            {
                return;
            }


            var tool = ToolFactory.Create(Env.Tool.Value);

            if (!tool.ProcessArguments(Env.Args))
            {
                return;
            }

            tool.Run();
        }