Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL2 build failure #84

Closed
kondratev opened this issue Mar 21, 2020 · 3 comments
Closed

SDL2 build failure #84

kondratev opened this issue Mar 21, 2020 · 3 comments

Comments

@kondratev
Copy link
Contributor

Environment:
$ env | grep GO111MODULE

GO111MODULE=on

$ go version

go version go1.13.6 linux/amd64

$ git log --pretty=oneline | head -n1

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

$ git branch

* master

Build:
$ cd cmd/nk-example-sdl2/
$ go build -tags sdl2 main.go

go: finding github.com/xlab/closer latest
go: finding github.com/go-gl/gl latest
go: finding github.com/golang-ui/nuklear latest
# command-line-arguments
./main.go:57:48: undefined: MustAsset
./main.go:111:37: undefined: flag
./main.go:114:37: undefined: flag
./main.go:131:19: cannot use nk.NkColorPicker(ctx, state.bgColor, nk.ColorFormatRGBA) (type nk.Colorf) as type nk.Color in assignment
./main.go:131:48: cannot use state.bgColor (type nk.Color) as type nk.Colorf in argument to nk.NkColorPicker
@kondratev
Copy link
Contributor Author

kondratev commented Mar 21, 2020

this fix a sdl build

diff --git a/cmd/nk-example-sdl2/main.go b/cmd/nk-example-sdl2/main.go
index 4c0243b..011e675 100644
--- a/cmd/nk-example-sdl2/main.go
+++ b/cmd/nk-example-sdl2/main.go
@@ -128,7 +128,9 @@ func gfxMain(win *sdl.Window, ctx *nk.Context, state *State) {
                        size := nk.NkVec2(nk.NkWidgetWidth(ctx), 400)
                        if nk.NkComboBeginColor(ctx, state.bgColor, size) > 0 {
                                nk.NkLayoutRowDynamic(ctx, 120, 1)
-                               state.bgColor = nk.NkColorPicker(ctx, state.bgColor, nk.ColorFormatRGBA)
+                               cf := nk.NkColorCf(state.bgColor)
+                               cf = nk.NkColorPicker(ctx, cf, nk.ColorFormatRGBA)
+                               state.bgColor = nk.NkRgbCf(cf)
                                nk.NkLayoutRowDynamic(ctx, 25, 1)
                                r, g, b, a := state.bgColor.RGBAi()
                                r = nk.NkPropertyi(ctx, "#R:", 0, r, 255, 1, 1)

@swathinsankaran
Copy link

swathinsankaran commented Mar 22, 2020

Hi,

I am getting the same error. Is there any workaround for this?

Error:
./main.go:112:37: undefined: flag
./main.go:115:37: undefined: flag

Regards,
Swathin

@xlab
Copy link
Member

xlab commented Mar 22, 2020

@kondratev @swathins079 you should not build main.go only, the package has other files as well, including util.go

Build the binary:

go build -tags sdl2 github.com/golang-ui/nuklear/cmd/nk-example-sdl2

or install:

go install -tags sdl2 github.com/golang-ui/nuklear/cmd/nk-example-sdl2

@xlab xlab closed this as completed Mar 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants