Enable video output

This commit is contained in:
Timur Celik 2025-12-01 11:08:51 +01:00
parent b7ef7cef01
commit 3bc64c2438
2 changed files with 38 additions and 2 deletions

5
go.mod
View File

@ -3,3 +3,8 @@ module n64tutorial
go 1.24.4 go 1.24.4
require github.com/clktmr/n64 v0.1.2 require github.com/clktmr/n64 v0.1.2
require (
github.com/embeddedgo/display v1.1.0 // indirect
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b // indirect
)

35
main.go
View File

@ -1,7 +1,38 @@
package main package main
import _ "github.com/clktmr/n64/machine" import (
"fmt"
"image"
"image/color"
"github.com/clktmr/n64/drivers/display"
"github.com/clktmr/n64/drivers/draw"
"github.com/clktmr/n64/fonts/gomono12"
_ "github.com/clktmr/n64/machine"
"github.com/clktmr/n64/rcp/video"
)
var face = gomono12.NewFace()
var background = &image.Uniform{color.RGBA{0x7f, 0x7f, 0xaf, 0x0}}
func main() { func main() {
println("N⁶⁴ - Get N or Get Out ♫") // Enable video output
video.Setup(false)
// Allocate framebuffer
display := display.NewDisplay(image.Pt(320, 240), video.BPP16)
for {
fb := display.Swap() // Blocks until next VBlank
textarea := fb.Bounds().Inset(15)
pt := textarea.Min.Add(image.Pt(0, int(face.Ascent)))
draw.Src.Draw(fb, fb.Bounds(), background, fb.Bounds().Min)
text := fmt.Appendln(nil, "N⁶⁴ - Get N or Get Out ♫")
pt = draw.DrawText(fb, textarea, face, pt, image.Black, nil, text)
draw.Flush() // Blocks until everything is drawn
}
} }