示例#1
0
        public void Render(Player player, List <Ball> balls, List <Monster> monsters)
        {
            Gdk.Window canvas = area.GdkWindow;
            if (canvas != null)
            {
                using (Cairo.Context context = Gdk.CairoHelper.Create(canvas)) {
                    canvas.BeginPaintRegion(new Gdk.Region());
                    context.SetSourceSurface(background, 0, 0);
                    context.Paint();

                    foreach (Field field in player.Trail)
                    {
                        paintTrail(context, field.X * fieldSize, field.Y * fieldSize);
                    }

                    foreach (Ball ball in balls)
                    {
                        context.SetSourceRGB(1, 0, 0);
                        paintCircle(context, ball.X, ball.Y);
                    }

                    foreach (Monster monster in monsters)
                    {
                        paintMonster(context, monster);
                    }

                    context.SetSourceRGB(0, 0, 1);
                    paintPlayer(context, player);

                    canvas.EndPaint();
                }
            }
        }
示例#2
0
文件: Area.cs 项目: centic9/bless-ppa
        void BeginPaintRegion(Gdk.Region r)
        {
            Gdk.Window win = areaGroup.DrawingArea.GdkWindow;

            win.BeginPaintRegion(r);
        }