mirror of
https://github.com/bloeys/nterm.git
synced 2025-12-29 06:28:20 +00:00
Basic drawing of cmd buffer through glyph grid
This commit is contained in:
11
main.go
11
main.go
@ -337,10 +337,9 @@ func (nt *nterm) MainUpdate() {
|
||||
|
||||
nt.DrawTextAnsiCodesOnGlyphGrid(v1)
|
||||
nt.DrawTextAnsiCodesOnGlyphGrid(v2)
|
||||
nt.glyphGrid.ClearRow(nt.glyphGrid.SizeY - 1)
|
||||
nt.glyphGrid.ClearRow(nt.glyphGrid.SizeY - 2)
|
||||
nt.glyphGrid.ClearRow(nt.glyphGrid.SizeY - 3)
|
||||
nt.glyphGrid.Write(nt.cmdBuf[:nt.cmdBufLen], &nt.Settings.DefaultFgColor, &nt.Settings.DefaultBgColor)
|
||||
|
||||
// @TODO: This should probably be its own function to blit the glyph grid
|
||||
for y := 0; y < len(nt.glyphGrid.Tiles); y++ {
|
||||
|
||||
row := nt.glyphGrid.Tiles[y]
|
||||
@ -356,11 +355,6 @@ func (nt *nterm) MainUpdate() {
|
||||
}
|
||||
nt.GlyphRend.OptValues.BgColor.Data = nt.Settings.DefaultBgColor.Data
|
||||
|
||||
// Draw cmd buf
|
||||
nt.lastCmdCharPos.SetX(0)
|
||||
nt.lastCmdCharPos.SetY(nt.SepLinePos.Y() - nt.GlyphRend.Atlas.LineHeight)
|
||||
nt.lastCmdCharPos.Data = nt.SyntaxHighlightAndDraw(nt.cmdBuf[:nt.cmdBufLen], *nt.lastCmdCharPos).Data
|
||||
|
||||
if input.KeyClicked(sdl.K_F4) {
|
||||
nt.glyphGrid.Print()
|
||||
println(nt.glyphGrid.SizeX, nt.glyphGrid.SizeY)
|
||||
@ -473,6 +467,7 @@ func (nt *nterm) DrawTextAnsiCodesOnGlyphGrid(bs []byte) {
|
||||
}
|
||||
}
|
||||
|
||||
// @TODO: Rewrite to draw on glyph grid
|
||||
func (nt *nterm) SyntaxHighlightAndDraw(text []rune, pos gglm.Vec3) gglm.Vec3 {
|
||||
|
||||
startIndex := 0
|
||||
|
||||
Reference in New Issue
Block a user