(window *glfw.Window)
| 122 | } |
| 123 | |
| 124 | func 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 | |
| 149 | func updateControllers(window *glfw.Window, console *nes.Console) { |
| 150 | turbo := console.PPU.Frame%6 < 3 |