diff options
author | Coşku Baş <cosku.bas@gmail.com> | 2015-01-19 12:57:23 +0100 |
---|---|---|
committer | Dmitri Shuralyov <shurcooL@gmail.com> | 2015-02-21 18:51:44 -0800 |
commit | d28b7b56f289e1c549cbc410268d1f20401bdc3c (patch) | |
tree | 64bb4bfb6a04661328bff9c5fe1758264280cc6e | |
parent | 7ce5b43ae5ecc8823ba966faf1f23a2376beae83 (diff) | |
download | glfw-d28b7b56f289e1c549cbc410268d1f20401bdc3c.tar.gz |
Tie GLFWimage to imgage.NRGBA
-rw-r--r-- | input.go | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -14,6 +14,7 @@ package glfw3 import "C" import ( + "image" "unsafe" ) @@ -245,9 +246,7 @@ type Cursor struct { data *C.GLFWcursor } -type Image struct { - data *C.GLFWimage -} +type Image *image.NRGBA //export goMouseButtonCB func goMouseButtonCB(window unsafe.Pointer, button, action, mods C.int) { @@ -372,8 +371,12 @@ func (w *Window) SetCursorPos(xpos, ypos float64) error { // // The cursor hotspot is specified in pixels, relative to the upper-left corner of the cursor image. // Like all other coordinate systems in GLFW, the X-axis points to the right and the Y-axis points down. -func CreateCursor(image *Image, xhot, yhot int) (*Cursor, error) { - c := C.glfwCreateCursor(image.data, C.int(xhot), C.int(yhot)) +func CreateCursor(image Image, xhot, yhot int) (*Cursor, error) { + var img C.GLFWimage + img.width = C.int(image.Rect.Max.X) + img.height = C.int(image.Rect.Max.Y) + img.pixels = (*C.uchar)(&image.Pix[0]) + c := C.glfwCreateCursor(&img, C.int(xhot), C.int(yhot)) return &Cursor{c}, fetchError() } |