Esempio n. 1
0
        static Bootstrap()
        {
            rng                = new Random();
            clock              = new BridgeClock();
            config             = TreeEnvironmentConfigs.Release;
            sharedDrawingState = new SharedDrawingState();

            treeStateFactory = new TreeStateFactory(rng, clock, config);
            treeStateStore   = new TreeStateStore(config.SettingPrefix);
        }
Esempio n. 2
0
 public TreeAppContext(
     IClock clock,
     TreeEnvironmentConfig config,
     TreeStateStore treeStateStore,
     TreeStateFactory treeStateFactory,
     SharedDrawingState sharedDrawingState
     )
 {
     this.clock              = clock ?? throw new ArgumentNullException(nameof(clock));
     this.config             = config ?? throw new ArgumentNullException(nameof(config));
     this.treeStateStore     = treeStateStore ?? throw new ArgumentNullException(nameof(treeStateStore));
     this.treeStateFactory   = treeStateFactory ?? throw new ArgumentNullException(nameof(treeStateFactory));
     this.sharedDrawingState = sharedDrawingState ?? throw new ArgumentNullException(nameof(sharedDrawingState));
 }
Esempio n. 3
0
        public TreeDrawer(
            HTMLCanvasElement canvas,
            HTMLImageElement water,
            HTMLImageElement reset,
            SharedDrawingState sharedDrawingState
            )
        {
            this.water = water ?? throw new ArgumentNullException(nameof(water));
            this.reset = reset ?? throw new ArgumentNullException(nameof(reset));
            this.sharedDrawingState = sharedDrawingState ?? throw new ArgumentNullException(nameof(sharedDrawingState));

            canvas.Width  = CanvasWidth;
            canvas.Height = CanvasHeight;

            ctx = canvas.GetContext(CanvasTypes.CanvasContext2DType.CanvasRenderingContext2D);

            treeDrawingContext = new TreeDrawingContext(ctx)
            {
                ScaleFactor = ScaleFactor,
                StartX      = CanvasWidth / 2,
                StartY      = TreeYOffset,
                LeafLimit   = 0.02
            };
        }