public override AbstractPainter CreatePainter(IFormFigure currentFigure, Color currentColor, int currentSize, Point startPoint, AbstractFilling typeOfFilling) { Brush brush = new Brush(currentColor, currentSize); abstractPainter = new LinePainter(brush, currentFigure, startPoint); return(abstractPainter); }
/// <summary> /// Paints the control's window area. Strategy is to find the spans that make up /// the whole segment, and paint them one at a time. /// </summary> /// <param name="g"></param> public Address PaintWindow(Graphics g, Size cellSize, Point ptAddr, bool render) { this.cellSize = cellSize; GetColorPreferences(); if (ctrl.arch == null || ctrl.imageMap == null) { return(null); } // Enumerate all segments visible on screen. ulong laEnd = ctrl.addrMin.ToLinear() + ctrl.memSize; if (ctrl.addrTopVisible.ToLinear() >= laEnd) { return(null); } var addrStart = Address.Max(ctrl.addrTopVisible, ctrl.mem.BaseAddress); EndianImageReader rdr = ctrl.arch.CreateImageReader(ctrl.mem, addrStart); Rectangle rcClient = ctrl.ClientRectangle; Rectangle rc = rcClient; Size cell = ctrl.CellSize; rc.Height = cell.Height; ulong laSegEnd = 0; while (rc.Top < ctrl.Height && (laEnd == 0 || rdr.Address.ToLinear() < laEnd)) { if (ctrl.SegmentMap.TryFindSegment(ctrl.addrTopVisible, out ImageSegment seg)) { if (rdr.Address.ToLinear() >= laSegEnd) { laSegEnd = seg.Address.ToLinear() + seg.Size; rdr = ctrl.arch.CreateImageReader(ctrl.mem, seg.Address + (rdr.Address - seg.Address)); } } var formatter = ctrl.mem.Formatter; var linePainter = new LinePainter(this, g, rc, ptAddr, render); var addr = linePainter.Paint(formatter, rdr, ctrl.Encoding); if (!render && addr != null) { return(addr); } rc.Offset(0, ctrl.CellSize.Height); } var dyLeft = rcClient.Bottom - rc.Top; if (dyLeft > 0) { var theme = GetBrushTheme(null, false); g.FillRectangle(theme.Background, rcClient.X, rc.Top, rcClient.Width, dyLeft); } return(null); }
void Start() { sprites = new Sprite[20]; sprites[0] = s0; sprites[1] = s1; sprites[2] = s2; sprites[3] = s3; sprites[4] = s4; sprites[5] = s5; sprites[6] = s6; sprites[7] = s7; sprites[8] = s8; sprites[9] = s9; sprites[10] = s10; sprites[11] = s11; sprites[12] = s12; sprites[13] = s13; sprites[14] = s14; GameObject.Find("Start").GetComponent <Button>().onClick.AddListener(Restart); GameObject.Find("Exit").GetComponent <Button>().onClick.AddListener( delegate { SceneManager.LoadScene("Menu"); } ); //int ms, ic; if (PlayerPrefs.HasKey("MAP_SIZE")) { mapSize = PlayerPrefs.GetInt("MAP_SIZE"); } if (PlayerPrefs.HasKey("IMAGE_COUNT")) { imageCount = PlayerPrefs.GetInt("IMAGE_COUNT"); } if (PlayerPrefs.HasKey("GAME_MODE")) { gameMode = PlayerPrefs.GetInt("GAME_MODE"); } linePainter = GameObject.Find("LinePainter").GetComponent <LinePainter>(); StartGame(mapSize, imageCount, gameMode); }
public void ShouldGetRedLine() { var painter = new LinePainter(new ColorB()); Assert.Equal("a paper with green line", painter.Draw()); }
public void ShouldGetGreenLine() { var painter = new LinePainter(new ColorA()); Assert.Equal("a paper with red line", painter.Draw()); }