Exemplo n.º 1
0
        private void CreateNewPlaylistBtnClick(object sender, RoutedEventArgs e)
        {
            AddPlaylistWindow addPlaylistWindow = new AddPlaylistWindow();

            addPlaylistWindow.ShowDialog();
            Displayer.Display(PlaylistsListBox, DisplayTag, MyDataStorage);
        }
Exemplo n.º 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;
                }
            }
        }
Exemplo n.º 3
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;
                }
            }
        }
Exemplo n.º 4
0
        private void RenderHorizontalLine(IDisplayer displayer, int x1, int x2, int y, double z1, double z2,
                                          Color color, List <Light> lights, Color gourandIntensity1, Color gourandIntensity2, Vector normal1, Vector normal2,
                                          Vector cameraPos, Vector world1, Vector world2)
        {
            double z = 0;

            if (x1 > x2)
            {
                int tmp = x1;
                x1 = x2;
                x2 = tmp;
                double tmp2 = z1;
                z1 = z2;
                z2 = tmp2;
                Color tmp3 = gourandIntensity1;
                gourandIntensity1 = gourandIntensity2;
                gourandIntensity2 = tmp3;
                Vector nTmp = null;
                if (normal1 != null)
                {
                    nTmp    = normal1.Clone();
                    normal1 = normal2.Clone();
                    normal2 = nTmp;
                }
                Vector wTmp = null;
                if (world1 != null)
                {
                    wTmp   = world1.Clone();
                    world1 = world2.Clone();
                    world2 = wTmp;
                }
            }
            for (int x = x1; x <= x2; ++x)
            {
                Color usedColor = new Color();
                if (displayer.GetShading() == Shading.Gourand)
                {
                    usedColor = InterpolateColorGourandShading(x2, x1, x, gourandIntensity2, gourandIntensity1);
                }
                else if (displayer.GetShading() == Shading.Phong)
                {
                    Vector normal = InterpolateNormalPhongShading(x2, x1, x, normal2, normal1);
                    Vector world  = InterpolateWorldPhongShading(x2, x1, x, world2, world1);
                    usedColor = ComputeColorPhongModel(color, lights, world, cameraPos, normal, displayer.IsFog());
                }
                else
                {
                    usedColor = color;
                }
                double q = x2 == x1 ? 0 : (x - x1) / (x2 - x1);
                z = InterpolateZ(z1, z2, q);
                displayer.Display(x, y, z, usedColor); // TODO: consider changing to primitive types instead of passing Vector
            }
        }
Exemplo n.º 5
0
        public void GameLogic()
        {
            while (!_board.IsComplete())
            {
                _currentRound++;
                _playerOne.Play(_board);
                _playerTwo.Play(_board);
                _displayer.Display(_board, _currentRound);

                Console.ReadLine();
            }
        }
Exemplo n.º 6
0
        public MainWindow()
        {
            InitializeComponent();

            playBitmapImage.BeginInit();// creating play Bitmap image
            playBitmapImage.UriSource = new Uri("/images/play.png", UriKind.Relative);
            playBitmapImage.EndInit();

            pauseBitmapImage.BeginInit();// creating pause Bitmap image
            pauseBitmapImage.UriSource = new Uri("/images/pause.png", UriKind.Relative);
            pauseBitmapImage.EndInit();

            MyPlayer      = Player.getInstance();
            MyDataStorage = DataStorage.getInstance();
            Displayer     = new PlaylistDisplayer();
            Displayer.Display(PlaylistsListBox, DisplayTag, MyDataStorage);

            Slidertimer.Interval = new TimeSpan(0, 0, 1);
            Slidertimer.Tick    += MoveSliderByOneSecondEvent;
        }
Exemplo n.º 7
0
        private void Initializated()
        {
            FinderStatus finderStatus;
            ColorStatus  colorStatus;
            bool         error = _comand.ReturnCommands(out finderStatus, out colorStatus, out _chain, out _path);

            _displayer = new ConsolDisplayer(_chain, ColorConsoleFactory.GetColor(colorStatus));
            if (error)
            {
                _displayer.Display(new string[] { "Incorret data" });
                Environment.Exit(1);
            }
            _finder = FinderFactory.GetFinder(finderStatus);
            if (_path.Equals(string.Empty))
            {
                _reader = new ConsoleReader();
            }
            else
            {
                _reader = new FileTxtReader();
            }
        }
Exemplo n.º 8
0
 public void Render()
 {
     _displayer.Display(this);
 }
Exemplo n.º 9
0
 private void Display()
 {
     _displayer.Display(_findedText);
 }
Exemplo n.º 10
0
 public void Test()
 {
     _displayer.Display(Msg);
 }
Exemplo n.º 11
0
 public void Test()
 {
     displayer.Display(msg);
 }
Exemplo n.º 12
0
 private void DisplayByAlbumsBtnClick(object sender, RoutedEventArgs e)
 {
     Displayer = new AlbumDisplayer();
     Displayer.Display(PlaylistsListBox, DisplayTag, MyDataStorage);
 }