예제 #1
0
        private void btnDrawMask_Click(object sender, EventArgs e)
        {
            //clear background
            drawer.Clear(Colors.White);

            //render
            DrawMaskRegion();

            //show to screen
            DisplayBuffer(buffer);
        }
예제 #2
0
        void DrawLion()
        {
            //set gamma settings
            drawer.GammaCorrected = chkUseGamma.Checked;
            drawer.SetGamma(gammaFactorRed, gammaFactorGreen, gammaFactorBlue);

            //clear background
            drawer.Clear(Colors.White);

            //get coordinates and colors
            double[][] polygons = LionPathHelper.GetLionPolygons();
            Color[]    colors   = LionPathHelper.GetLionColors();

            //iterate all polygons and draw them
            double[] coordinates = null;
            for (int i = 0; i < polygons.Length; i++)
            {
                coordinates = polygons[i];
                Fill fill = new Fill(colors[i]);
                drawer.DrawPolygon(fill, coordinates);
            }

            //show to screen
            DisplayBuffer(buffer);
        }
예제 #3
0
        public void StartGame()
        {
            // *Intro to the game
            // *Play Music

            //GET USER INFO
            consoleDrawer.DrawText("Enter user name: ");
            user = new User(consoleReader.GetUsername());
            consoleDrawer.DrawText("Enter field size: ");
            user.FieldSize = consoleReader.GetFieldSize();

            //INITIALIZE GAMEFIELD AND EXPLOSION MANAGER
            //TODO: Menu
            gameField = new GameField(user.FieldSize);
            int minesOnFieldCount = PopulateField();

            explostionManager = new ExplosionManager(gameField);

            //TODO: Draw ingame menu (star/stop music)
            while (minesOnFieldCount > 0)
            {
                consoleDrawer.Clear();
                ShowLastHit();//TODO: FIX -> cant easely see what this method needs to do it's work
                consoleDrawer.DrawObject(gameField);

                do
                {
                    AskForPosition();
                    user.LastInput = consoleReader.GetPositon();
                }while (!IsValidPosition());//TODO: FIX -> cant easely see what this method needs to do it's work
                finalScore++;

                bool isMineHit = IsMineHit();//TODO: FIX -> cant easely see what this method needs to do it's work

                if (isMineHit)
                {
                    //generate mine
                    string mineHitOnField = gameField[user.LastInput.PosX, user.LastInput.PosY].ToString();
                    int    mineHit        = int.Parse(mineHitOnField);
                    var    currentMine    = mineFactory.CreateMine((MinePower)mineHit);

                    //configure(reconfigure) the explosion manager
                    explostionManager.SetMine(currentMine);
                    explostionManager.SetHitPosition(user.LastInput);

                    //blow the mine up
                    int minesTakenOut = explostionManager.HandleExplosion();
                    minesOnFieldCount -= minesTakenOut;
                }
            }

            //TODO: change with highscore logic
            consoleDrawer.DrawText(string.Format("You made it with: {0} tries", finalScore));//this is only a test

            // *Save Highscore USE HighScore
            // *Show highscore USE HighScore
        }
예제 #4
0
        private void Draw()
        {
            //clear background
            drawer.Clear(Colors.White);

            //draw test
            coordinates = GetPath();
            Fill fill = GetFill();

            drawer.DrawPolygon(fill, coordinates);

            //show to form
            DisplayBuffer(buffer);
        }
예제 #5
0
        void Prepare()
        {
            cx = w / 2;
            cy = h / 2;

            //clear background
            drawer.Clear(Colors.White);

            //draw a black rectangle in center
            Fill fill = Fills.Gray;
            int  size = 15;

            drawer.DrawRectangle(fill, cx - size, cy - size, size * 2, size * 2);
        }
예제 #6
0
        public void DrawChanges()
        {
            Map.RecalcVisibleRect(_hero.Position);

            _drawer.Clear();
            if (_isKnowledgesShown)
            {
                _drawer.DrawKnowledges();
            }
            else if (_hero.IsHalt())
            {
                SetPaused(true);
                _drawer.DrawHaltScreen(_hero.GetAllKnowledges(), newKnowledges =>
                {
                    _hero.RewriteKnowledges(newKnowledges);
                    SetPaused(false);
                });
            }
            else
            {
                DrawSurface();
            }

            IEnumerable <MenuItems> groupedItems = _hero.GetContainerItems()
                                                   .GroupBy(go => GetDrawingCode(go),
                                                            (id, gos) =>
                                                            new MenuItems
            {
                Name             = $"{GetScreenName(gos.First())}({gos.Count()})",
                Id               = id,
                GetClientActions = GetFuncForClientActions(gos.First())
            });

            _drawer.DrawContainer(groupedItems);

            _drawer.DrawHeroProperties(_hero.GetProperties());

            _drawer.DrawTime(_dayNightCycle.CurrentGameDate);
        }