public void FormatLine(DrawBuffer DrawBuf, int LinePtr, int Width, ushort Colors) { int OutCnt = 0; int OutPtr = 0; int idxPos = LinePtr; ushort attr = (ushort)((Colors & 0x00FF)); if (FormatUntil((int)SelStart, DrawBuf, Width, ref OutCnt, ref OutPtr, ref idxPos, attr)) { return; } attr = (ushort)((Colors & 0xFF00) >> 8); if (FormatUntil((int)CurPtr, DrawBuf, Width, ref OutCnt, ref OutPtr, ref idxPos, attr)) { return; } idxPos += (int)GapLen; if (FormatUntil((int)(SelEnd + GapLen), DrawBuf, Width, ref OutCnt, ref OutPtr, ref idxPos, attr)) { return; } attr = (ushort)((Colors & 0x00FF)); if (FormatUntil((int)BufSize, DrawBuf, Width, ref OutCnt, ref OutPtr, ref idxPos, attr)) { return; } }
public override void Draw() { DrawBuffer B = new DrawBuffer(Size.X * Size.Y); B.FillChar((char)pattern, (byte)GetColor(1), (int)Size.X); WriteLine(0, 0, (int)Size.X, (int)Size.Y, B); }
public void DrawToPane(Pane p) { var x = p.Origin.X; var y = p.Origin.Y; for (var i = 0; i < Lines.Count; i++) { var line = Lines[i]; DrawBuffer.DrawString(Color.White, line, FontSize, x, y); y += FontSize; } x = p.Origin.X; y = p.Origin.Y; for (var i = 0; i < Lines.Count; i++) { var line = Lines[i]; y += FontSize; if (i == Line) { var size = DrawBuffer.MesureString(Col != line.Length ? line.Remove(Col) : line, FontSize); if (DateTime.Now.Millisecond >= 500) { DrawBuffer.DrawRect(Color.White, x + size.Width, y - FontSize + 2, 2, FontSize); } //@HACK @TMP just to test var words = line[..Col].Split(' ');
public override void Draw() { DrawBuffer B = new DrawBuffer(Size.X * Size.Y); string DisplayString = ""; if (CurrentDecimals == 0) { DisplayString = string.Format("{0," + (Size.X - 2).ToString() + ":N0}" + System.Globalization.CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator + " ", Value); } else if (CurrentDecimals < 0) { DisplayString = string.Format("{0," + (Size.X - 1).ToString() + ":N0} ", Value); } else { DisplayString = string.Format("{0," + (Size.X - 1).ToString() + ":N" + CurrentDecimals.ToString() + "} ", Value); } if ((State & StateFlags.Selected) != 0) { B.FillStr(DisplayString, (byte)GetColor(1), 0); ShowCursor(); } else { B.FillStr(DisplayString, (byte)GetColor(1), 0); HideCursor(); } WriteLine(0, 0, (int)Size.X, (int)Size.Y, B); }
public override void Draw() { DrawBuffer B = new DrawBuffer(Size.X * Size.Y); B.FillCStr(ldHistoryDropDown, GetColor(0x0102), 0); WriteLine(0, 0, (int)Size.X, (int)Size.Y, B); }
public override void Draw() { byte C; DrawBuffer B = new DrawBuffer(Size.X * Size.Y); B.FillChar((char)' ', 0x70, (int)Size.X); for (int i = 0; i <= Size.Y; i++) { if (i < 4) { for (int j = 0; j <= 3; j++) { C = (byte)(i * 4 + j); B.FillChar((char)ldBlockFull, C, 3, j * 3); if (C == Color) { B.drawBuffer[j * 3 + 1].AsciiChar = '\x08'; if (C == 0) { B.drawBuffer[j * 3 + 1].Attribute = '\x70'; } } } } WriteLine(0, i, (int)Size.X, 1, B); } }
public override void Draw() { byte Color; char Frame; long[] L = new long[2]; string S; DrawBuffer B = new DrawBuffer(Size.X * Size.Y); if ((State & StateFlags.Dragging) == 0) { Color = (byte)GetColor(1); Frame = ldDblHorizontalBar; } else { Color = (byte)GetColor(2); Frame = ldHorizontalBar; } B.FillChar((char)Frame, Color, (int)Size.X); if (Modified) { B.drawBuffer[0].AsciiChar = (char)ldModified; } L[0] = Location.Y + 1; L[1] = Location.X + 1; S = string.Format("{0:G}:{1:G}", L[0], L[1]); B.FillStr(S, Color, 8 - S.IndexOf(':', 0) + 1); WriteBuf(0, 0, (int)Size.X, 1, B); }
public override void Draw() { DrawBuffer B = new DrawBuffer(Size.X * Size.Y); B.FillBuf(Program.SaveConsoleBuffer, (uint)(Size.X * Size.Y), 0); WriteBuf(0, 0, Size.X, Size.Y, B); }
public override void Draw() { uint Color; DrawBuffer B = new DrawBuffer(Size.X * Size.Y); byte SCOff; if (Light) { Color = GetColor(0x0402); SCOff = 0; } else { Color = GetColor(0x0301); SCOff = 4; } B.FillChar(' ', Color, (int)Size.X); if (Text != "") { B.FillCStr(Text, Color, 0); } if (ShowMarkers) { B.drawBuffer[0].AsciiChar = (char)SpecialChars[SCOff]; } WriteLine(0, 0, (int)Size.X, 1, B); }
public override void Draw() { DrawBuffer B = new DrawBuffer(Size.X * Size.Y); uint C = GetColor(2); B.FillChar((char)' ', (byte)C, (int)Size.X); B.FillStr(TimeStr, (byte)C, 0); WriteLine(0, 0, (int)Size.X, 1, B); }
public override void Draw() { int X, L; uint CNormal, CSelect, CNormDisabled, CSelDisabled, Color; MenuItem P; DrawBuffer B = new DrawBuffer(Size.X * Size.Y); CNormal = GetColor(0x0301); CSelect = GetColor(0x0604); CNormDisabled = GetColor(0x0202); CSelDisabled = GetColor(0x0505); B.FillChar(' ', CNormal, (byte)Size.X); if (Menu != null) { X = 1; P = Menu.Items; while (P != null) { if (P.Name != "") { L = P.CNameLen(); if ((X + L) < Size.X) { if (P.Disabled) { if (P == Current) { Color = CSelect; } else { Color = CNormDisabled; } } else if (P == Current) { Color = CSelect; } else { Color = CNormal; } B.FillChar(' ', Color, 1, X); B.FillCStr(P.Name, Color, X + 1); B.FillChar(' ', Color, 1, X + L + 1); } X += L + 2; } P = P.Next; } } WriteBuf(0, 0, (byte)Size.X, 1, B); }
private void FillSpace(int i, ref int OutCnt, ref int OutPtr, ushort attr, DrawBuffer DrawBuf) { OutCnt += i; while (i > 0) { DrawBuf.drawBuffer[OutPtr].AsciiChar = ' '; DrawBuf.drawBuffer[OutPtr].Attribute = attr; OutPtr++; i--; } }
public override void Draw() { DrawBuffer B = new DrawBuffer(Size.X * Size.Y); OldMem = GC.GetTotalMemory(false); string S = string.Format("{0:G" + Size.X.ToString() + "}", OldMem); byte C = (byte)GetColor(2); B.FillChar((char)' ', C, (int)Size.X); B.FillStr(S, C, 0); WriteLine(0, 0, (int)Size.X, 1, B); }
public override void Draw() { byte Color; int I; DrawBuffer B = new DrawBuffer(Size.X * Size.Y); Color = (byte)GetColor(1); I = (int)(Size.X - Number.Length - 2); B.FillChar(' ', Color, (int)Size.X); B.FillChar(Sign, Color, 1, I); B.FillStr(Number, Color, I + 1); WriteBuf(0, 0, (int)Size.X, 1, B); }
public void DrawMultiBox(string Icon, string Marker) { int Cur, Col; uint CNorm, CSel, CDis, Color; DrawBuffer B = new DrawBuffer(Size.X * Size.Y); CNorm = GetColor(0x0301); CSel = GetColor(0x0402); CDis = GetColor(0x0505); for (int i = 0; i <= Size.Y; i++) { B.FillChar(' ', (byte)CNorm, Size.X); for (int j = 0; j <= ((Strings.Count / Size.Y) + 1); j++) { Cur = (int)(j * Size.Y + i); if (Cur < Strings.Count) { Col = Column(Cur); if (((Col + ItemCLen(Strings[Cur]) + 5) < (B.drawBuffer.Length)) && (Col < Size.X)) { if (!ButtonState(Cur)) { Color = CDis; } else if ((Cur == Sel) && ((State & StateFlags.Focused) != 0)) { Color = CSel; } else { Color = CNorm; } B.FillChar((char)' ', (byte)Color, (int)Size.X - Col, Col); B.FillStr(Icon, (byte)Color, Col); B.drawBuffer[Col + 2].AsciiChar = (char)Marker[MultiMark(Cur)]; B.FillCStr(Strings[Cur], (uint)Color, Col + 5); if (ShowMarkers && ((State & StateFlags.Focused) != 0) && (Cur == Sel)) { B.drawBuffer[Col].AsciiChar = (char)SpecialChars[0]; B.drawBuffer[Column((int)(Cur + Size.Y)) - 1].AsciiChar = (char)SpecialChars[1]; } } } } WriteBuf(0, i, (int)Size.X, 1, B); } SetCursor(Column(Sel) + 2, Row(Sel)); }
public OpenGLFramebuffer(int width, int height, GLint colourTextures, TextureFormat textureColourFormat, TextureFormat?textureDepthFormat = null) { if (colourTextures < 1) { throw new CKGLException("Must have at least 1 colour texture."); } if (colourTextures > GL.MaxColourAttachments || colourTextures > GL.MaxDrawBuffers) { throw new CKGLException("Too many colour textures."); } if (textureColourFormat.ToOpenGL().PixelFormat() == PixelFormat.Depth || textureColourFormat.ToOpenGL().PixelFormat() == PixelFormat.DepthStencil) { throw new CKGLException("textureColourFormat cannot be a depth(stencil) texture."); } if (textureDepthFormat.HasValue && !(textureDepthFormat.Value.ToOpenGL().PixelFormat() == PixelFormat.Depth || textureDepthFormat.Value.ToOpenGL().PixelFormat() == PixelFormat.DepthStencil)) { throw new CKGLException("textureDepthFormat is not a depth(stencil) texture."); } this.width = width; this.height = height; camera2D.Width = width; camera2D.Height = height; id = GL.GenFramebuffer(); Bind(); Textures = new Texture[colourTextures]; DrawBuffer[] drawBuffers = new DrawBuffer[colourTextures]; for (int i = 0; i < colourTextures; i++) { Textures[i] = Texture.Create2D(Width, Height, textureColourFormat); drawBuffers[i] = (DrawBuffer)((GLuint)DrawBuffer.Colour0 + i); GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, ((TextureAttachment)((uint)TextureAttachment.Colour0 + i)).ToOpenGL(), (Textures[i] as OpenGLTexture).TextureTarget, (Textures[i] as OpenGLTexture).ID, 0); Textures[i].Unbind(); CheckStatus(); } GL.DrawBuffers(colourTextures, drawBuffers); CheckStatus(); if (textureDepthFormat.HasValue) { DepthStencilTexture = Texture.Create2D(Width, Height, textureDepthFormat.Value); GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, textureDepthFormat.Value.ToOpenGL().TextureAttachment(), (DepthStencilTexture as OpenGLTexture).TextureTarget, (DepthStencilTexture as OpenGLTexture).ID, 0); DepthStencilTexture.Unbind(); CheckStatus(); } }
public void DrawLines(int Y, int Count, int LinePtr) { uint Color; DrawBuffer B = new DrawBuffer(MaxLineLength); Color = GetColor(0x0201); while (Count > 0) { FormatLine(B, (int)LinePtr, Delta.X + Size.X, (ushort)Color); WriteBuf(0, Y, Size.X, 1, B, Delta.X); LinePtr = NextLine(LinePtr); Y++; Count--; } }
public override void Draw() { DrawBuffer B = new DrawBuffer(Size.X * Size.Y); byte C = Color; if (C == 0) { C = ErrorAttr; } for (int i = 0; i <= (Size.X / Text.Length); i++) { B.FillStr(Text, C, i * Text.Length); } WriteLine(0, 0, (int)Size.X, (int)Size.Y, B); }
public Context(IGraphicsContext context, IWindowInfo window) { CheckError(); GLExt.Setup((IGraphicsContextInternal)context); this.context = context; this.window = window; CheckError(); MakeCurrent(); CheckError(); DrawBuffer[] drawBuffers = new DrawBuffer[Device.GetInt32(GetPName.MaxDrawBuffers, 1)]; for (int index = 0; index < drawBuffers.Length; index++) drawBuffers[index] = new DrawBuffer(this, index); this.drawBuffers = new DrawBufferCollection(drawBuffers); }
public override void Draw() { DrawBuffer B = new DrawBuffer(Size.X * Size.Y); string DisplayString = string.Format(" {0,2:D2}.{1,2:D2}.{2,4:D4} ", Day, Month, Year); B.FillStr(DisplayString, (byte)GetColor(1), 0); if ((State & StateFlags.Selected) != 0) { ShowCursor(); } else { HideCursor(); } WriteLine(0, 0, (int)Size.X, (int)Size.Y, B); }
public override void Draw() { DrawBuffer B = new DrawBuffer(Size.X * Size.Y); uint Color = GetColor(6); for (int Y = 0; Y <= Size.Y - 1; Y++) { B.FillChar((char)' ', (byte)Color, (int)Size.X); for (int X = 0; X <= Size.X - 1; X++) { B.FillChar((char)(32 * Y + X), (byte)Color, 1, X); } WriteLine(0, Y, (int)Size.X, 1, B); } ShowCursor(); }
public override void Draw() { const int Width = 20; int DayOf, CurDays; string S; DrawBuffer B = new DrawBuffer(Size.X * Size.Y); uint Color, BoldColor; Color = (byte)GetColor(6); BoldColor = (byte)GetColor(7); DayOf = (int)(new DateTime((int)Year, (int)Month, 1)).DayOfWeek; Days = (byte)(DaysInMonth[(int)(Month - 1)]); if (((Year % 4) == 0) && (Month == 2)) { Days++; } S = string.Format("{0:0000}", Year); B.FillChar(' ', Color, Width); B.FillCStr(string.Format("{0,-10} {1} \x1E \x1F", MonthStr[Month - 1], S), Color, 0); WriteLine(0, 0, Width, 1, B); B.FillChar(' ', Color, Width); B.FillStr(DayString, Color, 0); WriteLine(0, 1, Width, 1, B); CurDays = 1 - DayOf; for (int i = 1; i <= 6; i++) { for (int j = 0; j <= 6; j++) { if ((CurDays < 1) || (CurDays > Days)) { B.FillStr(" ", Color, j * 3); } else if ((Year == CurYear) && (Month == CurMonth) && (CurDays == CurDay)) { B.FillStr(string.Format("{0:00}", CurDays), BoldColor, j * 3); } else { B.FillStr(string.Format("{0:00}", CurDays), Color, j * 3); } CurDays++; } WriteLine(0, i + 1, Width, 1, B); } }
public void DrawPos(long Pos) { DrawBuffer B = new DrawBuffer(Size.X * Size.Y); long S = GetSize() - 1; B.FillChar(chars[0], GetColor(2), 1, 0); if (Max == Min) { B.FillChar(chars[4], GetColor(1), (int)(S - 1), 1); } else { B.FillChar(chars[2], GetColor(1), (int)(S - 1), 1); B.FillChar(chars[3], GetColor(3), 1, (int)(Pos)); } B.FillChar(chars[1], GetColor(2), 1, (int)S); WriteBuf(0, 0, (int)Size.X, (int)Size.Y, B); }
public override void Draw() { DrawBuffer B = new DrawBuffer(Size.X * Size.Y); byte C; if (Clicked) { C = (byte)GetColor(2); } else { C = (byte)GetColor(1); } B.FillChar((char)' ', C, (int)Size.X); B.FillCStr(Text, C, 0); WriteLine(0, 0, (int)Size.X, 1, B); }
public override void Draw() { uint Color; int L, R; DrawBuffer B = new DrawBuffer(Size.X * Size.Y); if ((State & StateFlags.Focused) == 0) { Color = GetColor(1); } else { Color = GetColor(2); } B.FillChar((char)' ', Color, (int)Size.X); B.FillStr((Data + new string(' ', (int)Size.X)).Substring(FirstPos, (int)(Size.X - 2)), Color, 1); if (CanScroll(1)) { B.FillChar(ldRightScroll, GetColor(4), 1, (int)Size.X - 1); } if ((State & StateFlags.Focused) != 0) { if (CanScroll(-1)) { B.FillChar(ldLeftScroll, GetColor(4), 1); } L = SelStart - FirstPos; R = SelEnd - FirstPos; if (L < 0) { L = 0; } if (R > (Size.X - 2)) { R = (int)Size.X - 2; } if (L < R) { B.FillChar('\x00', GetColor(3), R - L, L + 1); } } WriteLine(0, 0, (int)Size.X, (int)Size.Y, B); SetCursor(CurPos - FirstPos + 1, 0); }
public int InitOpenGL() { Console.WriteLine(GL.GetString(StringName.Renderer)); Console.WriteLine(GL.GetString(StringName.Version)); basicShader = new Shader(); //if (basicShader < 0) return 4; glowShader = new Shader(File.ReadAllText("../Data/Shaders/glowFS.glsl")); //if (glowShader < 0) return 4; buffer = new DrawBuffer(2265536); groundBuffer = new DrawBuffer(512 * 512); // Other state Console.WriteLine("version:" + GL.GetString(StringName.Version)); return(0); }
private bool FormatUntil(int EndPos, DrawBuffer DrawBuf, int Width, ref int OutCnt, ref int OutPtr, ref int idxPos, ushort attr) { // FormatUntil int P; bool FormatUntil = false; P = idxPos; int Cnt = OutCnt; int Ptr = OutPtr; FillSpace(Width - OutCnt, ref Cnt, ref Ptr, attr, DrawBuf); while (EndPos > idxPos) { if (OutCnt > Width) { return(FormatUntil); } switch (buffer[P]) { case '\x0009': FillSpace(TabSize - (OutCnt % TabSize), ref OutCnt, ref OutPtr, attr, DrawBuf); break; case '\x000D': case '\x000A': FillSpace(Width - OutCnt, ref OutCnt, ref OutPtr, attr, DrawBuf); FormatUntil = true; return(FormatUntil); default: OutCnt++; DrawBuf.drawBuffer[OutPtr].AsciiChar = buffer[P]; DrawBuf.drawBuffer[OutPtr].Attribute = attr; OutPtr++; break; } P++; idxPos++; } return(FormatUntil); }
internal void DrawTitle(DrawBuffer B, ref int I, ref int S, uint CButton, bool Down) { int L, SCOff; if ((Flags & ButtonFlags.LeftJust) != 0) { L = 1; } else { L = (S - CTitleLen() - 1) / 2; if (L < 1) { L = 1; } B.FillCStr(Title, CButton, I + L); if (ShowMarkers & !Down) { if ((State & StateFlags.Selected) != 0) { SCOff = 0; } else if (AmDefault) { SCOff = 2; } else { SCOff = 4; } B.drawBuffer[0].AsciiChar = SpecialChars[SCOff]; B.drawBuffer[S].AsciiChar = SpecialChars[SCOff + 1]; } } }
public override void Draw() { uint CNormal, CSelect, CNormDisabled, CSelDisabled, Color; int Y; MenuItem P; DrawBuffer B = new DrawBuffer(Size.X * Size.Y); CNormal = GetColor(0x0301); CSelect = GetColor(0x0604); CNormDisabled = GetColor(0x0202); CSelDisabled = GetColor(0x0505); Y = 0; Color = CNormal; FrameLine(0, B, CNormal, Color); DrawLine(ref Y, B); if (Menu != null) { P = Menu.Items; while (P != null) { Color = CNormal; if (P.Name == "") { FrameLine(15, B, (byte)CNormal, (byte)Color); } else { if (P.Disabled) { if (P == Current) { Color = CSelDisabled; } else { Color = CNormDisabled; } } else if (P == Current) { Color = CSelect; } FrameLine(10, B, CNormal, Color); B.FillCStr(P.Name, Color, 3); if (P.Command == 0) { B.FillChar(ldSubMenuArrow, Color, 1, (int)Size.X - 4); } else if (P.Param != "") { B.FillStr(P.Param, Color, (int)Size.X - 3 - P.Param.Length); } } DrawLine(ref Y, B); P = P.Next; } } Color = CNormal; FrameLine(5, B, CNormal, Color); DrawLine(ref Y, B); }
internal void DrawLine(ref int Y, DrawBuffer B) { WriteBuf(0, Y, (int)Size.X, 1, B); Y++; }
internal void FrameLine(int N, DrawBuffer B, uint CNormal, uint Color) { B.FillBuf(ldMenuFrameChars.Substring(N, 2), CNormal, 2); B.FillChar((char)ldMenuFrameChars[N + 2], Color, (int)(Size.X - 4), 2); B.FillBuf(ldMenuFrameChars.Substring(N + 3, 2), CNormal, 2, (int)(Size.X - 2)); }
public RenderThread() { drawBuffer_ = DrawBuffer.getInstance(); }