gopxl / pixel

A hand-crafted 2D game library in Go.
MIT License
225 stars 9 forks source link

Is there a way to force the window to use Wayland instead of X11? #88

Closed MasterixCZ closed 1 month ago

MasterixCZ commented 1 month ago

The title says it all. I can't find a way to force the use of Wayland instead of X11. I'm currently experimenting with my own app and I was wondering if it's even possible. And if so, could you please provide me with instructions on how? My source code is basically same as in this chapter

Thank you

bhperry commented 1 month ago

Good question. I don't think there's outright support for wayland built into pixel, but glfw has at least partial support for it and pixel is built around that.

MasterixCZ commented 1 month ago

Nice, I finally managed to get it working!

If anyone has the same problem: I previously installed the old Pixel library from the original repo and that was using older version of go-glfw that had broken support for Wayland, so check if you are using Pixelv2. If you don't, upgrade your Pixel library. If you're already using Pixelv2, update go.mod dependencies through "go get -u all" and "go mod tidy" commands. After that, compile your app with "-tags wayland" parameter. You will probably get a warning that says _"warning: "_GNUSOURCE" redefined", that's because Pixelv2 is not using newer version of glfw where this issue has already been fixed

dusk125 commented 1 month ago

@MasterixCZ if you want to be amazing you could add your suggestion to the wiki!!

MasterixCZ commented 1 month ago

That would be great! But you have to give me permission to do that, right? Or is it done through a merge request?

dusk125 commented 1 month ago

@MasterixCZ I think you can just edit the wiki and it'll create a PR, ping me if it doesn't work and I can add it

MasterixCZ commented 1 month ago

@dusk125 I don't see any button like "Edit" or "New page", so you will have to add it

MasterixCZ commented 1 month ago

Sorry, I forgot to ping you in the previous message :sweat_smile: @dusk125