Beispiel #1
0
 internal void RenderFilling(IDisplayer displayer, PipelineInfo info, Color color)
 {
     if (shouldBeDisplayed)
     {
         RenderFillingScanLine(displayer, color, info.GetLights(), info.GetCameraPosition());
     }
 }
Beispiel #2
0
        private void RenderLineBresenhamHigh(IDisplayer displayer, int x0, int y0, int x1, int y1, double z0, double z1)
        {
            int dx = x1 - x0;
            int dy = y1 - y0;
            int xi = 1;

            if (dx < 0)
            {
                xi = -1;
                dx = -dx;
            }
            int d        = (2 * dx) - dy;
            int incrH    = 2 * dx;
            int incrDiag = 2 * (dx - dy);
            int x        = x0;

            double tmpZ = 0;

            for (int y = y0; y < y1; ++y)
            {
                tmpZ = InterpolateZ(z0, z1, (double)(y - y0) / (double)(y1 - y0));
                displayer.Display(x, y, tmpZ, lineColor);
                if (d > 0)
                {
                    x += xi;
                    d += incrDiag;
                }
                else
                {
                    d += incrH;
                }
            }
        }
 public override BaseDanmakuParser SetDisplayer(IDisplayer disp)
 {
     base.SetDisplayer(disp);
     DispScaleX = MDispWidth / DanmakuFactory.BiliPlayerWidth;
     DispScaleY = MDispHeight / DanmakuFactory.BiliPlayerHeight;
     return(this);
 }
Beispiel #4
0
 private void RenderLineBresenham(IDisplayer displayer, int x0, int y0, int x1, int y1, double z0, double z1)
 {
     if (Math.Abs(y1 - y0) < Math.Abs(x1 - x0))
     {
         if (x0 > x1)
         {
             RenderLineBresenhamLow(displayer, x1, y1, x0, y0, z1, z0);
         }
         else
         {
             RenderLineBresenhamLow(displayer, x0, y0, x1, y1, z0, z1);
         }
     }
     else
     {
         if (y0 > y1)
         {
             RenderLineBresenhamHigh(displayer, x1, y1, x0, y0, z1, z0);
         }
         else
         {
             RenderLineBresenhamHigh(displayer, x0, y0, x1, y1, z0, z1);
         }
     }
 }
Beispiel #5
0
        /// <summary>
        /// Display entity at specified displayer 
        /// </summary>
        /// <param name="objectToDisplay">entity to be displayed</param>
        /// <param name="destination">destination displayer</param>
        /// <param name="displayerText">text of displayer's header</param>
        internal void DisplayAt(IDisplayingEntity objectToDisplay, IDisplayer destination, string displayerText)
        {
            if (destination == null) throw new ArgumentNullException("destination");

            destination.Text = displayerText;
            DisplayAt(objectToDisplay, destination);
        }
Beispiel #6
0
        private void RenderLineBresenhamLow(IDisplayer displayer, int x0, int y0, int x1, int y1, double z0, double z1)
        {
            int dx = x1 - x0;
            int dy = y1 - y0;
            int yi = 1;

            if (dy < 0)
            {
                yi = -1;
                dy = -dy;
            }
            int d        = (2 * dy) - dx;
            int incrV    = 2 * dy;
            int incrDiag = 2 * (dy - dx);
            int y        = y0;

            for (int x = x0; x < x1; ++x)
            {
                double tmpZ = InterpolateZ(z0, z1, (double)(x - x0) / (double)(x1 - x0));
                displayer.Display(x, y, tmpZ, lineColor);
                if (d > 0)
                {
                    y += yi;
                    d += incrDiag;
                }
                else
                {
                    d += incrV;
                }
            }
        }
Beispiel #7
0
 /// <summary>
 /// Creates new instance of reference avbutton
 /// </summary>
 /// <param name="displayer">Displayer in which entity should be displayed</param>
 /// <param name="entity">Entity to display</param>
 /// <param name="reflectionType">Type of displaying</param>
 /// <param name="displayerText">Text to display</param>
 public ReferenceStatusImageLinkLabel(IDisplayer displayer, IDisplayingEntity entity, ReflectionTypes reflectionType, string displayerText)
 {
     Displayer      = displayer;
     Entity         = entity;
     ReflectionType = reflectionType;
     DisplayerText  = displayerText;
 }
 /// <summary>
 /// Creates new instance of reference avbutton
 /// </summary>
 /// <param name="displayer">Displayer in which entity should be displayed</param>
 /// <param name="entity">Entity to display</param>
 /// <param name="reflectionType">Type of displaying</param>
 /// <param name="displayerText">Text to display</param>
 public ReferenceAvalonButtonM(IDisplayer displayer, IDisplayingEntity entity, ReflectionTypes reflectionType, string displayerText)
 {
     this.displayer      = displayer;
     this.entity         = entity;
     this.reflectionType = reflectionType;
     this.displayerText  = displayerText;
 }
Beispiel #9
0
        /*internal Vector MakeModelCleanRotation(PipelineInfo info)
         * {
         *  Vector rotated = info.GetModelMatrix().CleanRotation().MultipliedBy(this);
         *  return rotated;
         * }*/

        internal Vector Render(IDisplayer displayer, PipelineInfo info)
        {
            Vector viewVector = info.GetViewMatrix().MultipliedBy(this);
            Vector clipVector = info.GetProjectionMatrix().MultipliedBy(viewVector);

            if (!IsInView(clipVector))
            {
                return(null);
            }
            Vector ndcVector    = clipVector.Clone().DivideByW();
            Matrix screenMatrix = Matrix.Screen(info.GetScreenWidth(), info.GetScreenHeight());
            Vector screenVector = screenMatrix.MultipliedBy(ndcVector);

            screenVector.y = info.GetScreenHeight() - screenVector.y; // TODO: Beware of exception

            /*if (x == 4 && y == 10 && z == 3)
             * {
             *  Console.WriteLine("world = " + ToString());
             *  Console.WriteLine("VIEW MATRIX: \n" + info.GetViewMatrix());
             *  Console.WriteLine("view = " + viewVector);
             *  Console.WriteLine("PROJECTION MATRIX: \n" + info.GetProjectionMatrix());
             *  Console.WriteLine("clip = " + clipVector);
             *  Console.WriteLine("ndc = " + ndcVector);
             *  Console.WriteLine("screen = " + screenVector);
             *  Console.WriteLine();
             * }*/
            /*if (info.ShouldRenderLines())
             * {
             *  displayer.Display((int)screenVector.x, (int)screenVector.y, screenVector.z, Color.Black);
             * }*/
            return(screenVector);
        }
Beispiel #10
0
 public MazeFactory(string[] arguments, string loaderOption, string solverOption, string displayerOption)
 {
     this.arguments = arguments;
     loader = GetLoader(loaderOption);
     solver = GetSolver(solverOption);
     displayer = GetDisplayer(displayerOption);
 }
Beispiel #11
0
        /// <summary>
        /// Constructor voor de simulatie
        /// </summary>
        /// <param name="aantalklanten">Het aantal klanten dat per tijdseenheid aan het systeem wordt toegevoegd</param>
        /// <param name="rijen">Het aantal rijen voor deze simulatie</param>
        public Simulatie(int rijen, int geslotenrijen, int aantalklanten, int iteraties, int seed = 1, bool visualiseer = true)
        {
            Visualiseer = visualiseer;
            Display     = new ConsoleDisplayer();

            R           = new Random(seed);
            CurrentTime = 0;
            Klanten     = new List <Klant>();
            Rijen       = new List <Rij>();

            for (int i = 0; i < rijen; i++)
            {
                Rijen.Add(new Rij(R.Next(1, 25), string.Format("Kassa {0:00}", i + 1)));
            }

            for (int i = 0; i < geslotenrijen; i++)
            {
                Rijen.Add(new Rij(R.Next(1, 25), string.Format("Kassa {0:00}", i + rijen + 1), false, false));
            }

            Iteraties         = iteraties;
            IntroductionTimes = new int[Iteraties];

            for (int i = 0; i < Iteraties; i++)
            {
                IntroductionTimes[i] = 0;
            }

            for (int i = 0; i < aantalklanten; i++)
            {
                IntroductionTimes[R.Next(Iteraties)] += 1;
            }

            Uitgestapt = new List <Klant>();
        }
Beispiel #12
0
 /// <summary>
 /// Creates new instance of ReferenceEventArgs
 /// </summary>
 /// <param name="requestedEntity">Entity to display</param>
 /// <param name="typeOfReflection">Displaying parameters</param>
 /// <param name="destinationDisplayer">Displayer where entity must be displayed</param>
 /// <param name="displayerText">Text of displayer's header</param>
 public ReferenceEventArgs(IDisplayingEntity requestedEntity, ReflectionTypes typeOfReflection, IDisplayer destinationDisplayer, string displayerText)
 {
     this.requestedEntity      = requestedEntity;
     this.typeOfReflection     = typeOfReflection;
     this.destinationDisplayer = destinationDisplayer;
     this.displayerText        = displayerText;
 }
        /// <summary>
        /// ћетод вызывающийс¤ перед закрытием вкладки
        /// </summary>
        /// <param name="e"></param>
        protected override void OnClosing(AvMultitabControlCancelEventArgs e)
        {
            IDisplayer associatedDisplayer = e.TabPage as IDisplayer;

            if (associatedDisplayer == null)
            {
                return;
            }
            if (!associatedDisplayer.PerformCloseChecking)
            {
                return;
            }
            DisplayerCancelEventArgs eventArguments =
                new DisplayerCancelEventArgs(associatedDisplayer, DisplayerAction.Removing);

            if (DisplayerDeleting != null && associatedDisplayer != null)
            {
                DisplayerDeleting(this, eventArguments);
            }
            associatedDisplayer.OnDisplayerRemoved(eventArguments);
            e.Cancel = eventArguments.Cancel;
            base.OnClosing(e);
            if (!eventArguments.Cancel)
            {
                if (DisplayerDeleted != null)
                {
                    DisplayerDeleted(this, new DisplayerEventArgs(associatedDisplayer));
                }
            }
        }
Beispiel #14
0
        /// <summary>
        /// ¬ытаетс¤ выбрать отображатель дл¤ содержимого или создать новый отображатель
        /// </summary>
        /// <param name="objectToDisplay">—одержимое дл¤ отображател¤</param>
        /// <param name="displayerText">“екст отображател¤ (вкладки)</param>
        internal void Display(IDisplayingEntity objectToDisplay, string displayerText)
        {
            if (objectToDisplay == null) //throw new ArgumentNullException("objectToDisplay");
                return;

            foreach (IDisplayer displayer in defaultProxy.ContainedDisplayers)
            {
                //if (displayer.Entity.ContainedDataEquals(objectToDisplay))
                if (displayer.Text == displayerText)
                {
                    // displayer.Text = displayerText;
                    defaultProxy.Select(displayer);
                    StorePageOrder(displayer);
                    return;
                }
            }
            IDisplayer newDisplayer = defaultProxy.CreateNewDisplayer(objectToDisplay, displayerText);
            defaultProxy.Add(newDisplayer);
            defaultProxy.Select(newDisplayer);
            StorePageOrder(newDisplayer);



            objectToDisplay.OnInitCompletion(defaultProxy);
        }
 /// <summary>
 /// Sets focus to IDisplayer contained at collection
 /// </summary>
 /// <param name="objectToSelect"><see cref="IDisplayer">IDisplayer</see> that gets focus</param>
 public void Select(IDisplayer objectToSelect)
 {
     if (objectToSelect is MultitabPage)
     {
         SelectTab(objectToSelect as MultitabPage);
     }
 }
Beispiel #16
0
 /// <summary>
 /// Creates new instance of reference avbutton
 /// </summary>
 /// <param name="displayer">Displayer in which entity should be displayed</param>
 /// <param name="entity">Entity to display</param>
 /// <param name="reflectionType">Type of displaying</param>
 /// <param name="displayerText">Text to display</param>
 public RichReferenceButton(IDisplayer displayer, IDisplayingEntity entity, ReflectionTypes reflectionType, string displayerText)
 {
     Displayer      = displayer;
     Entity         = entity;
     ReflectionType = reflectionType;
     DisplayerText  = displayerText;
     Click         += RichReferenceButtonClick;
 }
Beispiel #17
0
 /// <summary>
 /// Creates new instance of reference avbutton
 /// </summary>
 /// <param name="displayer">Displayer in which entity should be displayed</param>
 /// <param name="entity">Entity to display</param>
 /// <param name="reflectionType">Type of displaying</param>
 /// <param name="displayerText">Text to display</param>
 public RichReferenceButton(IDisplayer displayer, IDisplayingEntity entity, ReflectionTypes reflectionType, string displayerText)
 {
     this.displayer      = displayer;
     this.entity         = entity;
     this.reflectionType = reflectionType;
     this.displayerText  = displayerText;
     Click += RichReferenceButton_Click;
 }
Beispiel #18
0
        public void AnotherPersonInput_NoMore()
        {
            _consoleWrapper.Setup(c => c.ReadLine()).Returns("n");

            _displayer = new Displayer(_nameGenerator.Object, _taxCalculator.Object, _consoleWrapper.Object);

            Assert.IsFalse(_displayer.AnotherPerson());
        }
Beispiel #19
0
 void DefaultProxyDisplayerSelected(object sender, DisplayerEventArgs e)
 {
     if (!_useEvent)
     {
         IDisplayer displayer = e.Displayer;
         StorePageOrder(displayer);
     }
 }
Beispiel #20
0
 private void CloseAllButSome(IDisplayer notClosedDisplayer)
 {
     for (int i = 0; i < defaultProxy.ContainedDisplayers.Length; i++)
     {
         IDisplayer displayer = defaultProxy.ContainedDisplayers[i];
         if (notClosedDisplayer != displayer)
             defaultProxy.Remove(displayer, true);
     }
 }
Beispiel #21
0
 internal CubeController(Cube cube, CubeView view, IDisplayer displayer)
 {
     this.cube = cube;
     this.view = view;
     moveSfx   = displayer.GetManager().Load <SoundEffect>("Sound/Move");
     rotateSfx = displayer.GetManager().Load <SoundEffect>("Sound/Rotate");
     CubeView.Init(displayer.GetManager());
     UpdateView();
 }
Beispiel #22
0
 public WPTest(IDisplayer displayer, IStorage storage, CancellationTokenSource tokenSource)
 {
     TokenSource             = tokenSource ?? new CancellationTokenSource();
     Displayer               = displayer;
     Storage                 = storage;
     Tester                  = new WebTester(TokenSource, null);
     Tester.PageTestedAsync += Tester_PageTestedAsync;
     Formater                = new TestResultFormater();
 }
        /// <summary>
        /// Event of control removed
        /// </summary>
        /// <param name="e">Event arguments</param>
        protected override void OnControlRemoved(ControlEventArgs e)
        {
            IDisplayer associatedDisplayer = e.Control as IDisplayer;

            base.OnControlRemoved(e);
            if (DisplayerDeleted != null)
            {
                DisplayerDeleted(this, new DisplayerEventArgs(associatedDisplayer));
            }
        }
Beispiel #24
0
 public TicTacToeGame(IReader reader, IDisplayer displayer, IBoardFormatter formatter, IPlayerFactory player_factory, IRoundFactory round_factory, Game game, IGameRepository game_repository)
 {
     _game            = game;
     _reader          = reader;
     _displayer       = displayer;
     _formatter       = formatter;
     _player_factory  = player_factory;
     _round_factory   = round_factory;
     _game_repository = game_repository;
 }
Beispiel #25
0
 /// <summary>Compares the sort order of editable attributes.</summary>
 public int CompareTo(IDisplayer other)
 {
     if (Title != null && other.Title != null)
         return Title.CompareTo(other.Title);
     if (Title != null)
         return -1;
     if (other.Title != null)
         return 1;
     return 0;
 }
        /// <summary>
        /// Event of page already selected
        /// </summary>
        /// <param name="e">Event arguments</param>
        protected override void OnSelected(AvMultitabControlEventArgs e)
        {
            IDisplayer associatedDisplayer = e.TabPage as IDisplayer;

            base.OnSelected(e);
            if (DisplayerSelected != null)
            {
                DisplayerSelected(this, new DisplayerEventArgs(associatedDisplayer));
            }
        }
Beispiel #27
0
		public TicTacToeGame (IReader reader, IDisplayer displayer, IBoardFormatter formatter, IPlayerFactory player_factory, IRoundFactory round_factory, Game game, IGameRepository game_repository)
		{
			_game = game;
			_reader = reader;
			_displayer = displayer;
			_formatter = formatter;
			_player_factory = player_factory;
			_round_factory = round_factory;
			_game_repository = game_repository;
		}
Beispiel #28
0
 public TicTacToeRound(IReader reader, IDisplayer displayer, IBoardFormatter formatter, Game game, IGameRepository game_repository)
 {
     _reader          = reader;
     _displayer       = displayer;
     _game            = game;
     _round           = _game.Current;
     _checker         = new BoardWinChecker(_round.Board);
     _formatter       = formatter;
     _game_repository = game_repository;
 }
Beispiel #29
0
		public TicTacToeRound (IReader reader, IDisplayer displayer, IBoardFormatter formatter, Game game, IGameRepository game_repository)
		{
			_reader = reader;
			_displayer = displayer;
			_game = game;
			_round = _game.Current;
			_checker = new BoardWinChecker (_round.Board);
			_formatter = formatter;
			_game_repository = game_repository;
		}
Beispiel #30
0
 public Game(IDisplayer displayer, IUserInput userInput)
 {
     isFirstRun   = true;            // Starts with informing the game that it's first run!
     gameBoard    = new Shape[3, 3]; // Define the 'GameTable' property
     gameWins     = new int[2];      // Define the 'GameWins' property
     playerTurn   = Shape.X;         // Starts with the first player
     playsCounter = 0;               // Starts with 0 play counts in the game!
     Displayer    = displayer;       // Reference to the implementations of the Displayer!
     UserInput    = userInput;       // Reference to the implementations of the UserInput!
 }
        /// <summary>
        /// Event of page selecting
        /// </summary>
        /// <param name="e">Event arguments</param>
        protected override void OnSelecting(AvMultitabControlCancelEventArgs e)
        {
            IDisplayer associatedDisplayer = e.TabPage as IDisplayer;

            base.OnSelecting(e);
            if (DisplayerSelecting != null)
            {
                DisplayerSelecting(this, new DisplayerCancelEventArgs(associatedDisplayer, DisplayerAction.Selecting));
            }
        }
        /// <summary>
        /// Checks if displayer is contained
        /// </summary>
        /// <param name="displayer">Displayer to be checked</param>
        /// <returns></returns>
        public bool Contains(IDisplayer displayer)
        {
            MultitabPage displayerPage = displayer as MultitabPage;

            if (displayerPage != null)
            {
                return(TabPages.Contains(displayerPage));
            }
            return(false);
        }
Beispiel #33
0
 /// <summary>
 /// Request operation to display specified entity at specified displayer
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="displayer"></param>
 /// <param name="displayerText">text of displayer's header</param>
 private void DisplayAtExisting(IDisplayingEntity entity, IDisplayer displayer, string displayerText)
 {
     if (displayer != null)
     {
         DisplayAt(entity, displayer, displayerText);
     }
     else
     {
         Display(entity, displayerText);
     }
 }
Beispiel #34
0
        internal bool Render(IDisplayer displayer, PipelineInfo info)
        {
            Vector isInCameraView = worldPosition.Render(displayer, info);

            if (isInCameraView == null)
            {
                return(false);
            }
            screenPosition = isInCameraView;
            return(true);
        }
Beispiel #35
0
        public MainForm()
        {
            InitializeComponent();

            WindowState = FormWindowState.Maximized;

            var settings = new DisplayerFields
                {
                    BalckAndWhitePictureBox = BlackAndWhitePictureBox,
                    CorrectedBrightnessPictureBox = CorrectedBrightnessPictureBox,
                    ResultPictureBox = ResultPictureBox,
                    OriginalPictureBox = OriginalImagePictureBox
                };

            _clusterizer = new Clusterizer();
            _displayer = new Displayer(settings);
        }
Beispiel #36
0
		public TicTacToeRunner (IReader reader, IDisplayer displayer, IBoardFormatter formatter, IPlayerFactory player_factory, IRoundFactory round_factory, IGameFactory game_factory, IGameRepository game_repository)
		{
			_reader = reader;
			_displayer = displayer;
			_game_repository = game_repository;
			_game_factory = game_factory;
			_formatter = formatter;
			_round_factory = round_factory;
			_player_factory = player_factory;

			//on charge la partie dans le repo
			_game_model = _game_repository.Load();

			if(_game_model == null)
				_game_model = game_factory.Create (NUMBER_ROUND);
			
			_game = new TicTacToeGame (_reader, _displayer, formatter, player_factory, round_factory, _game_model, _game_repository);
		}
 public DisplayerFactory(IDisplayer displayer)
 {
     this.Displayer = displayer;
     BindDisplayer();
 }