예제 #1
0
        public static void SetWindowIcon(WindowPtr window, Image[] images)
        {
            unsafe
            {
                if (images == null || images.Length == 0)
                {
                    glfwSetWindowIcon(window, 0, null);
                    return;
                }

                NativeImage[] nimgs = new NativeImage[images.Length];
                fixed(NativeImage *ptr = &nimgs[0])
                {
                    for (int i = 0; i < images.Length; i++)
                    {
                        fixed(byte *data = &images[i].data[0])
                        {
                            nimgs[i] = new NativeImage(images[i].width, images[i].height, data);
                        }
                    }
                    glfwSetWindowIcon(window, images.Length, ptr);
                    CheckError();
                }
            }
        }
예제 #2
0
        public static Cursor CreateCursor(Image image, int xHotspot, int yHotspot)
        {
            unsafe
            {
                fixed(byte *data = image.data)
                {
                    NativeImage  nimg   = new NativeImage(image.width, image.height, data);
                    NativeImage *ptr    = &nimg;
                    var          result = glfwCreateCursor(ptr, xHotspot, yHotspot);

                    CheckError();
                    return(result);
                }
            }
        }