golang-ui / nuklear

This project provides Go bindings for nuklear.h — a small ANSI C GUI library.
https://github.com/vurtun/nuklear
MIT License
1.57k stars 98 forks source link

Update nuklear to 4.01.0 and add clipboard support for GLFW_GL3. #81

Closed AllenDang closed 4 years ago

AllenDang commented 4 years ago

This PR contains following changes:

  1. Update nklear to 4.01.0.
  2. Add Clipboard interface and provide GLFW_GL3 implementation. Implement cross-platform Clipboard is very easy now.
    
    type NkGLFWClipbard struct {
    window *glfw.Window
    }

func NewGLFWClipboard(w glfw.Window) NkGLFWClipbard { return &NkGLFWClipbard{w} }

func (c *NkGLFWClipbard) SetText(content string) { c.window.SetClipboardString(content) }

func (c *NkGLFWClipbard) GetText() (string, error) { return c.window.GetClipboardString() }

func NkPlatformInit(win glfw.Window, opt PlatformInitOption) Context { .... state.ctx.SetClipboard(NewGLFWClipboard(win)) }



3. Add GetGoString to *TextEdit to ease the usage of NkEditBuffer. 
xlab commented 4 years ago

Thank you for pushing this forward 💪🏼