示例#1
0
 public void SetPosition(int x, int y)
 {
     Painter.Invalidate(new Rectangle(x - hot_x, y - hot_y, grp.Width, grp.Height));
     this.x = x;
     this.y = y;
     Painter.Invalidate(new Rectangle(x - hot_x, y - hot_y, grp.Width, grp.Height));
 }
示例#2
0
        public override void PointerMotion(MouseMotionEventArgs args)
        {
            /* if the dropdown is visible, see if we're inside it */
            if (!dropdown_visible)
            {
                return;
            }

            if (            /*
                             * starcraft doesn't include this check..  should we?
                             * args.X >= X1 && args.X < X1 + dropdownSurface.Width &&
                             */
                args.Y >= Y1 + Height && args.Y < Y1 + Height + dropdownSurface.Height)
            {
                int new_selected_item = (args.Y - (Y1 + Height)) / Font.LineSize;

                if (selected_item != new_selected_item)
                {
                    selected_item = new_selected_item;
                    CreateDropdownSurface();
                    Painter.Invalidate(new Rectangle(new Point(X1, Y1 + Height),
                                                     dropdownSurface.Size));
                }
            }
        }
示例#3
0
        void PlayerFrameReady()
        {
            if (surf != null)
            {
                surf.Dispose();
            }

            surf = new Surface(player.Surface);

            if (player.Width != Painter.Width ||
                player.Height != Painter.Height)
            {
                double horiz_zoom = (double)Painter.Width / player.Width;
                double vert_zoom  = (double)Painter.Height / player.Height;
                double zoom;

                if (horiz_zoom < vert_zoom)
                {
                    zoom = horiz_zoom;
                }
                else
                {
                    zoom = vert_zoom;
                }

                // FIXME: newSDL
                //surf.Scale (zoom);
            }

            /* signal to the painter to redraw the screen */
            Painter.Invalidate();
        }
示例#4
0
 public void SetHotSpot(int hot_x, int hot_y)
 {
     Painter.Invalidate(new Rectangle(x - hot_x, y - hot_y, grp.Width, grp.Height));
     this.hot_x = hot_x;
     this.hot_y = hot_y;
     Painter.Invalidate(new Rectangle(x - hot_x, y - hot_y, grp.Width, grp.Height));
 }
示例#5
0
 protected virtual void Invalidate()
 {
     if (visible)
     {
         Painter.Invalidate(Bounds);
     }
     surface = null;
 }
示例#6
0
 void ShowDropdown()
 {
     dropdown_visible = true;
     selected_item    = cursor;
     CreateDropdownSurface();
     Painter.Add(Layer.Popup, PaintDropdown);
     Painter.Invalidate(new Rectangle(new Point(X1, Y1 + Height),
                                      dropdownSurface.Size));
 }
示例#7
0
        protected override void Invalidate()
        {
            if (Visible)
            {
                Painter.Invalidate(Bounds);
            }

            if (Surface != null)
            {
                Surface.Fill(Color.Transparent);
            }
        }
示例#8
0
        public void CursorTick(object sender, TickEventArgs e)
        {
            totalElapsed += e.TicksElapsed;

            if (totalElapsed < millisDelay)
            {
                return;
            }

            totalElapsed = 0;
            current_frame++;
            Painter.Invalidate(new Rectangle(x - hot_x, y - hot_y, grp.Width, grp.Height));
        }
示例#9
0
		public virtual void AddToPainter ()
		{
			Painter.Painting += FirstPaint;

			if (background != null)
				Painter.Add (Layer.Background, BackgroundPainter);

			if (UIPainter != null)
				Painter.Add (Layer.UI, UIPainter.Paint);

			if (Cursor != null)
				Game.Instance.Cursor = Cursor;

			Painter.Invalidate ();
		}
示例#10
0
 void HideDropdown()
 {
     dropdown_visible = false;
     if (cursor != selected_item)
     {
         cursor = selected_item;
         if (SelectionChanged != null)
         {
             SelectionChanged(cursor);
         }
         Invalidate();
     }
     Painter.Remove(Layer.Popup, PaintDropdown);
     Painter.Invalidate(new Rectangle(new Point(X1, Y1 + Height),
                                      dropdownSurface.Size));
 }
示例#11
0
        void Recenter(int x, int y)
        {
            topleft_x = x - Painter.SCREEN_RES_X / 2;
            topleft_y = y - Painter.SCREEN_RES_Y / 2;

            ClipTopLeft();

            SpriteManager.SetUpperLeft(topleft_x, topleft_y);
            mapRenderer.SetUpperLeft(topleft_x, topleft_y);

            UpdateCursor();


            Painter.Invalidate(new Rectangle(new Point(0, 0),
                                             new Size(Painter.SCREEN_RES_X, Painter.SCREEN_RES_Y)));
        }
示例#12
0
        void AdvanceToNextPage()
        {
            Painter.Invalidate();
            while (pageEnumerator.MoveNext())
            {
                if (pageEnumerator.Current.Background != null)
                {
                    currentBackground = pageEnumerator.Current.Background;
                }
                if (pageEnumerator.Current.HasText)
                {
                    return;
                }
            }

            Console.WriteLine("finished!");
            Events.Tick -= FlipPage;
            MarkupFinished();
        }
示例#13
0
        public override void RemoveFromPainter()
        {
            if (Background != null)
            {
                Painter.Remove(Layer.DialogBackground, BackgroundPainter);
            }

            if (UIPainter != null)
            {
                Painter.Remove(Layer.DialogUI, UIPainter.Paint);
            }

            if (dimScreen)
            {
                Painter.Remove(Layer.DialogDimScreenHack, DimScreenPainter);
            }

            Painter.Invalidate();
        }
示例#14
0
        public void ScrollTick(object sender, TickEventArgs e)
        {
            scroll_elapsed += e.TicksElapsed;

            if (scroll_elapsed < 20)
            {
                return;
            }

            scroll_elapsed = 0;

            if (horiz_delta == 0 && vert_delta == 0)
            {
                return;
            }

            int old_topleft_x = topleft_x;
            int old_topleft_y = topleft_y;

            topleft_x += horiz_delta;
            topleft_y += vert_delta;

            ClipTopLeft();

            if (old_topleft_x == topleft_x &&
                old_topleft_y == topleft_y)
            {
                return;
            }

            SpriteManager.SetUpperLeft(topleft_x, topleft_y);
            mapRenderer.SetUpperLeft(topleft_x, topleft_y);

            UpdateCursor();

            Painter.Invalidate(new Rectangle(new Point(0, 0),
                                             new Size(Painter.SCREEN_RES_X, 375)));
        }
示例#15
0
        public void SetUpperLeft(int x, int y)
        {
            /* XXX be naive for now, and redraw the entire section we need */
            if (mapSurface == null)
            {
                mapSurface = new Surface(width, height);
            }

            int tl_x = x / 32;
            int tl_y = y / 32;

            for (int map_y = tl_y; map_y <= tl_y + width / 32 && map_y < chk.Height; map_y++)
            {
                for (int map_x = tl_x; map_x <= tl_x + width / 32 && map_x < chk.Width; map_x++)
                {
                    Surface tile = GetTile(chk.MapTiles[map_x, map_y]);
                    mapSurface.Blit(tile, new Point(map_x * 32 - x, map_y * 32 - y));
                }
            }

            Painter.Invalidate(new Rectangle(new Point(0, 0),
                                             new Size(width, height)));
        }
示例#16
0
 public void Invalidate()
 {
     Painter.Invalidate(new Rectangle(new Point(x - SpriteManager.X - sprite_surface.Width / 2,
                                                y - SpriteManager.Y - sprite_surface.Height / 2),
                                      sprite_surface.Size));
 }