Пример #1
0
 protected override void OnDraw(Canvas canvas)
 {
     base.OnDraw(canvas);
     var paint = new Paint();
     paint.SetColor(Color);
     canvas.DrawCircle(Width / 2, Height / 2, Width / 2, paint);
 }
Пример #2
0
       private void DoDraw(Canvas canvas, double stepFactor)
         {
            double width = canvas.GetWidth();
            double height = canvas.GetHeight();

            double x = width/2;
            double y = height/2;

            x += xOrientation * stepFactor;
            y += yOrientation * stepFactor;

            // Set background color
            canvas.DrawColor(Color.BLUE);
            var paint = new Paint();
            paint.SetTextAlign(Paint.Align.CENTER);

            // Draw a circle
            paint.SetColor(Color.ParseColor("#ffd700"));
            canvas.DrawCircle((float) x, (float) y, 30, paint);
         }
Пример #3
0
        public GameScreen(IGame game)
            : base(game)
        {
            // Initialize game objects here

            bg1 = new Background(0, 0);
            bg2 = new Background(2160, 0);
            robot = new Robot();
            hb = new Heliboy(340, 360);
            hb2 = new Heliboy(700, 360);

            character = Assets.character;
            character2 = Assets.character2;
            character3 = Assets.character3;

            heliboy = Assets.heliboy;
            heliboy2 = Assets.heliboy2;
            heliboy3 = Assets.heliboy3;
            heliboy4 = Assets.heliboy4;
            heliboy5 = Assets.heliboy5;

            anim = new Animation();
            anim.addFrame(character, 1250);
            anim.addFrame(character2, 50);
            anim.addFrame(character3, 50);
            anim.addFrame(character2, 50);

            hanim = new Animation();
            hanim.addFrame(heliboy, 100);
            hanim.addFrame(heliboy2, 100);
            hanim.addFrame(heliboy3, 100);
            hanim.addFrame(heliboy4, 100);
            hanim.addFrame(heliboy5, 100);
            hanim.addFrame(heliboy4, 100);
            hanim.addFrame(heliboy3, 100);
            hanim.addFrame(heliboy2, 100);

            currentSprite = anim.getImage();

            loadMap();

            // Defining a paint object
            paint1 = new Paint();
            paint1.SetTextSize(30);
            paint1.SetTextAlign(Paint.Align.CENTER);
            paint1.SetAntiAlias(true);
            paint1.SetColor(Color.WHITE);

            paint2 = new Paint();
            paint2.SetTextSize(100);
            paint2.SetTextAlign(Paint.Align.CENTER);
            paint2.SetAntiAlias(true);
            paint2.SetColor(Color.WHITE);

        }
Пример #4
0
        private void DoDraw(Canvas canvas)
        {
			// Increment / reset
            size += delta;
            if (size > 250)
            {
				delta = -1;
            } 
			else if (size < 30) 
			{
				delta = 1;
			}

            // Set background color
            canvas.DrawColor(Color.BLUE); 
            var paint = new Paint();
            paint.SetTextAlign(Paint.Align.CENTER);

            // Draw some lines
            canvas.DrawLine(mX, mY, mY + 33, mX + 100, paint);
            paint.SetColor(Color.RED);
            paint.SetStrokeWidth(10);
            canvas.DrawLine(87, 0, 75, 100, paint);
            paint.SetColor(Color.GREEN);
            paint.SetStrokeWidth(5);
            for (int y = 30, alpha = 128; alpha > 2; alpha >>= 1, y += 10)
            {
                paint.SetAlpha(alpha);

                canvas.DrawLine(mY, y, mY + 100, y, paint);
            }

            // Draw a red rectangle
            paint.SetColor(Color.RED);
            var rect = new Rect();
            rect.Set(size + 120, 130, size + 156, 156);
            canvas.DrawRect(rect, paint);

            // Draw a circle
            paint.SetColor(Color.ParseColor("#ffd700"));
            canvas.DrawCircle(size * 2, 220, 30, paint); //faster circle

            // Draw red'ish rectangle
            paint.SetColor(Color.Rgb(128, 20, 20));
            canvas.DrawRect(size, 67, 68, 45, paint);

            // Draw green circle
            paint.SetColor(Color.GREEN);
            canvas.DrawCircle(size, 140.0f - size / 3, 45.0f, paint); //move circle across screen
            paint.SetColor(Color.RED);
            canvas.DrawText("Dot42", size, 140.0f - size / 3, paint);

            // Draw magenta circle
            paint.SetColor(Color.MAGENTA);
            canvas.DrawCircle(mX, mY, size / 4.0f, paint); //move circle down screen
            paint.SetColor(Color.GREEN);
            canvas.DrawText("is", mX, mY, paint);

            // Draw yellow rectangle
            paint.SetAlpha(64);
            paint.SetColor(Color.YELLOW);
            canvas.DrawRect(size, size, size + 45, size + 45, paint);
            // Draw text on rectangle
            paint.SetAlpha(255);
            paint.SetColor(Color.DKGRAY);
            canvas.DrawText("fun!", size + 45 / 2, size + 45 / 2, paint);
        }