Window resizing

This commit is contained in:
Sasha Koshka 2022-11-02 18:51:33 -04:00
parent fa72865465
commit e12fb3d7db
2 changed files with 14 additions and 7 deletions

View File

@ -114,13 +114,13 @@ func (backend *Backend) Resized () (resized bool) {
}
func (backend *Backend) draw () {
didDrawing := false
// didDrawing := false
if backend.boundsDirty {
backend.window.Clear (
backend.config.Color(stone.ColorApplication))
backend.boundsDirty = false
didDrawing = true
// didDrawing = true
} else {
// TODO: clear out dirty cells before drawing them (we don't
// want to clear them out if we have already just cleared
@ -138,19 +138,26 @@ func (backend *Backend) draw () {
if clean { continue }
// draw cell
cell := backend.application.Cell(x, y)
content := cell.Rune()
if content < 32 { continue }
didDrawing = true // TODO: set didDrawing up there ^
// didDrawing = true // TODO: set didDrawing up there ^
backend.application.MarkClean(x, y)
}
}
if didDrawing {
backend.window.SwapBuffers()
}
backend.window.SwapBuffers()
}
func (backend *Backend) processEvents () {
newBounds := backend.window.Bounds().Max
backend.boundsDirty = backend.previousBounds != newBounds
backend.previousBounds = newBounds
if backend.boundsDirty {
// TODO: set size of buffer
}
}
func (backend *Backend) calculateWindowSize () (bounds pixel.Rect) {

View File

@ -34,7 +34,7 @@ func (cell Cell) Style (style Style) {
return
}
func (cell Cell) Rune (content rune) {
func (cell Cell) Rune () (content rune) {
content = cell.content
return
}