make render a method of milkdropwindow
This commit is contained in:
parent
4a9d73ef04
commit
622e85a4f6
10
main.go
10
main.go
|
@ -62,7 +62,7 @@ func (m *milkDropWindow) loadPreset(preset string) {
|
|||
C.projectm_load_preset_file(m.handle, cPreset, false)
|
||||
}
|
||||
|
||||
func render(window *sdl.Window, handle C.projectm_handle) (bool, error) {
|
||||
func (m *milkDropWindow) render() (bool, error) {
|
||||
var audioData [bufSize]int16
|
||||
|
||||
err := binary.Read(os.Stdin, binary.LittleEndian, &audioData)
|
||||
|
@ -72,10 +72,10 @@ func render(window *sdl.Window, handle C.projectm_handle) (bool, error) {
|
|||
return true, err
|
||||
}
|
||||
|
||||
C.projectm_pcm_add_int16(handle, (*C.int16_t)(&audioData[0]), C.uint(bufSize), C.PROJECTM_STEREO)
|
||||
C.projectm_pcm_add_int16(m.handle, (*C.int16_t)(&audioData[0]), C.uint(bufSize), C.PROJECTM_STEREO)
|
||||
|
||||
C.projectm_opengl_render_frame(handle)
|
||||
window.GLSwap()
|
||||
C.projectm_opengl_render_frame(m.handle)
|
||||
m.window.GLSwap()
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ func main() {
|
|||
break
|
||||
}
|
||||
|
||||
running, err = render(m.window, m.handle)
|
||||
running, err = m.render()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue