Example #1
0
            public void WriteLine(string line)
            {
                Point p = new Point(0, (int)(scrollPos * lineHeigth));

                Lcd.WriteTextBox(f, lineSize + p, line, true);
                scrollPos++;

                Lcd.Update((int)(scrollPos * lineHeigth));
                if (scrollPos >= lines)
                {
                    scrollPos = 0;
                }
            }
Example #2
0
 public static void WriteTextBox(Font f, Rectangle r, string text, bool color, Lcd.Alignment aln)
 {
   Instance.WriteTextBox(f,r,text,color,aln);
 }
Example #3
0
 public static void DrawArrow(Rectangle r, Lcd.ArrowOrientation orientation, bool color)
 {
   Instance.DrawArrow(r,orientation,color);
 }
Example #4
0
		protected void WriteTextOnLine (string text, int lineIndex, bool color = true, Lcd.Alignment alignment = Lcd.Alignment.Center)
		{
			Font f = font;
			string s = text;
			int lineWidth = lines [lineIndex].P2.X - lines [lineIndex].P1.X;
			if (f.TextSize (text.Remove(text.Length-1)).X > lineWidth)
			{
				f = Font.SmallFont;
				while (f.TextSize (s).X > lineWidth) 
				{
					s = s.Remove(s.Length-1);
				}
			}
			Lcd.WriteTextBox(f, lines[lineIndex], s, color, alignment); 
		}
Example #5
0
 public void Clear()
 {
     Lcd.Clear();
     Reset();
 }
Example #6
0
		public void WriteTextBox(Font f, Rectangle r, string text, bool color, Lcd.Alignment aln)
		{
			DrawRectangle(r,!color, true);// Clear background
			int xpos = 0;
			if (aln == Lcd.Alignment.Left)
			{
			} 
			else if (aln == Lcd.Alignment.Center)
			{
				int width = TextWidth(f, text);
				xpos = (r.P2.X-r.P1.X)/2-width/2;
				if (xpos < 0) xpos = 0;
			}
			else 
			{
				int width = TextWidth(f, text);
				xpos = (r.P2.X-r.P1.X)-width;
				if (xpos < 0) xpos = 0;
			}
			WriteText(f, r.P1+new Point(xpos, 0) , text, color);
		}
Example #7
0
		public void DrawArrow (Rectangle r, Lcd.ArrowOrientation orientation, bool color)
		{
			int height = r.P2.Y - r.P1.Y;
			int width = r.P2.X - r.P1.X;
			float inc = 0;
			if (orientation == Lcd.ArrowOrientation.Left || orientation == Lcd.ArrowOrientation.Right) 
			{
				inc = (((float)height) / 2.0f) / ((float)width); 
			} 
			else 
			{
				inc = (((float)width) / 2.0f) / ((float)height); 
			}
			if (orientation == Lcd.ArrowOrientation.Left) 
			{
				for (int i = 0; i < width; i++) {
					SetPixel ((int)(r.P1.X + i), (int)(r.P1.Y + height/2), color);
					int points = (int)(inc*(float)i)+1;
					for (int j = 0; j < points; j++) {
						SetPixel ((int)(r.P1.X + i), (int)(r.P1.Y + height / 2 +j), color);
						SetPixel ((int)(r.P1.X + i), (int)(r.P1.Y + height / 2 -j), color);
					}
				}	
			}
			if (orientation == Lcd.ArrowOrientation.Right) {
				for (int i = 0; i < width; i++) {
					SetPixel ((int)(r.P2.X - i), (int)(r.P1.Y + height/2), color);
					int points = (int)(inc*(float)i)+1;
					for (int j = 0; j < points; j++) {
						SetPixel ((int)(r.P2.X -i), (int)(r.P1.Y + height / 2 +j), color);
						SetPixel ((int)(r.P2.X -i), (int)(r.P1.Y + height / 2 -j), color);
					}
				}	
			}
			if (orientation == Lcd.ArrowOrientation.Up) {
				for (int i = 0; i < height; i++) {

					SetPixel ((int)(r.P1.X + width/2), (int)(r.P1.Y + i), color);
					int points = (int)(inc*(float)i)+1;
					for (int j = 0; j < points; j++) {
						SetPixel ((int)(r.P1.X + width/2+j), (int)(r.P1.Y + i), color);
						SetPixel ((int)(r.P1.X + width/2-j), (int)(r.P1.Y + i), color);
					}
				}	
			}
			if (orientation == Lcd.ArrowOrientation.Down) {
				for (int i = 0; i < height; i++) {

					SetPixel ((int)(r.P1.X + width/2), (int)(r.P2.Y -i), color);
					int points = (int)(inc*(float)i)+1;
					for (int j = 0; j < points; j++) {
						SetPixel ((int)(r.P1.X + width/2+j), (int)(r.P2.Y - i), color);
						SetPixel ((int)(r.P1.X + width/2-j), (int)(r.P2.Y - i), color);
					}
				}	
			}
		}
Example #8
0
 protected void WriteTextOnLine(string text, int lineIndex, bool color = true, Lcd.Alignment alignment = Lcd.Alignment.Center)
 {
     Lcd.Instance.WriteTextBox(font, lines[lineIndex], text, color, alignment);
 }