MCPcopy
hub / github.com/fogleman/nes / drawBuffer

Function drawBuffer

ui/gameview.go:124–147  ·  view source on GitHub ↗
(window *glfw.Window)

Source from the content-addressed store, hash-verified

122}
123
124func drawBuffer(window *glfw.Window) {
125 w, h := window.GetFramebufferSize()
126 s1 := float32(w) / 256
127 s2 := float32(h) / 240
128 f := float32(1 - padding)
129 var x, y float32
130 if s1 >= s2 {
131 x = f * s2 / s1
132 y = f
133 } else {
134 x = f
135 y = f * s1 / s2
136 }
137 gl.Begin(gl.QUADS)
138 gl.TexCoord2f(0, 1)
139 gl.Vertex2f(-x, -y)
140 gl.TexCoord2f(1, 1)
141 gl.Vertex2f(x, -y)
142 gl.TexCoord2f(1, 0)
143 gl.Vertex2f(x, y)
144 gl.TexCoord2f(0, 0)
145 gl.Vertex2f(-x, y)
146 gl.End()
147}
148
149func updateControllers(window *glfw.Window, console *nes.Console) {
150 turbo := console.PPU.Frame%6 < 3

Callers 1

UpdateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected