(t, dt float64)
| 124 | } |
| 125 | |
| 126 | func (view *MenuView) Update(t, dt float64) { |
| 127 | view.checkButtons() |
| 128 | view.texture.Purge() |
| 129 | window := view.director.window |
| 130 | w, h := window.GetFramebufferSize() |
| 131 | sx := 256 + margin*2 |
| 132 | sy := 240 + margin*2 |
| 133 | nx := (w - border*2) / sx |
| 134 | ny := (h - border*2) / sy |
| 135 | ox := (w-nx*sx)/2 + margin |
| 136 | oy := (h-ny*sy)/2 + margin |
| 137 | if nx < 1 { |
| 138 | nx = 1 |
| 139 | } |
| 140 | if ny < 1 { |
| 141 | ny = 1 |
| 142 | } |
| 143 | view.nx = nx |
| 144 | view.ny = ny |
| 145 | view.clampSelection() |
| 146 | gl.PushMatrix() |
| 147 | gl.Ortho(0, float64(w), float64(h), 0, -1, 1) |
| 148 | view.texture.Bind() |
| 149 | for j := 0; j < ny; j++ { |
| 150 | for i := 0; i < nx; i++ { |
| 151 | x := float32(ox + i*sx) |
| 152 | y := float32(oy + j*sy) |
| 153 | index := nx*(j+view.scroll) + i |
| 154 | if index >= len(view.paths) || index < 0 { |
| 155 | continue |
| 156 | } |
| 157 | path := view.paths[index] |
| 158 | tx, ty, tw, th := view.texture.Lookup(path) |
| 159 | drawThumbnail(x, y, tx, ty, tw, th) |
| 160 | } |
| 161 | } |
| 162 | view.texture.Unbind() |
| 163 | if int((t-view.t)*4)%2 == 0 { |
| 164 | x := float32(ox + view.i*sx) |
| 165 | y := float32(oy + view.j*sy) |
| 166 | drawSelection(x, y, 8, 4) |
| 167 | } |
| 168 | gl.PopMatrix() |
| 169 | } |
| 170 | |
| 171 | func (view *MenuView) clampSelection() { |
| 172 | if view.i < 0 { |
nothing calls this directly
no test coverage detected