Example #1
0
 public void ValueType()
 {
     Point p = new Point ();
     Point b = p;
     b.X = 30;
     Assert.AreEqual (0, p.X);
 }
Example #2
0
 public void CreationNoParameters()
 {
     Point p = new Point ();
     Assert.AreEqual (0, p.X);
     Assert.AreEqual (0, p.Y);
 }
Example #3
0
 public void Creation()
 {
     Point p = new Point (30, 20);
     Assert.AreEqual (30, p.X);
     Assert.AreEqual (20, p.Y);
 }
Example #4
0
        protected override bool OnButtonPressEvent(EventButton args)
        {
            base.GrabFocus ();

            if (args.Button != 3)
                return false;

            Point grid = WindowCoordsToGridPoint ( (int) args.X, (int) args.Y);
            if (map.GetGridInformation (grid) == GridInformation.Invalid)
                return false;

            highlight_grid = grid;
            UIActions.Instance.WorldViewContextMenu.Popup ();

            return true;
        }
Example #5
0
 private void QueueDrawGrid(Point grid)
 {
     int x, y;
     GridPointToWindowCoords (grid, out x, out y);
     base.QueueDrawArea (x, y, tileset.Width, tileset.Height);
 }
Example #6
0
 private void GridPointToWindowCoords(Point p, out int x, out int y)
 {
     x = (p.X - offset_x) * tileset.Width - poffset_x;
     y = (p.Y - offset_y) * tileset.Height - poffset_y;
 }
Example #7
0
        private void DrawGrid(Context context, Point grid)
        {
            int x, y;
            GridPointToWindowCoords (grid, out x, out y);

            foreach (string tile in map[grid].Tiles) {
                DrawTile (tile, x, y);
            }

            bool in_fov = center.FieldOfView
                .Select (l => l.Position).Contains (grid);

            if (in_fov && map[grid].HasActor) {
                DrawTile (map[grid].Actor.Tile, x, y);
            }

            if (!in_fov) {
                context.Color = fog_color;
                context.Rectangle (x, y, tileset.Width, tileset.Height);
                context.Fill ();
            }

            if (grid_lines) {
                context.Color = grid_line_color;
                context.LineWidth = tileset.ZoomPercentage;
                context.Rectangle (x, y, tileset.Width, tileset.Height);
                context.Stroke ();
            }
        }