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

Update docs #44

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions wde.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,17 @@ recommended that your main function look like the the code below.

wde.Run() will return when wde.Stop() is called.

For this to work, you must import one of the go.wde backends. For
instance,
For this to work, you must import one of the go.wde backends. To
automatically import the correct backend, add this to your imports:

import _ "github.com/skelterjohn/go.wde/init"

This will register a backend with go.wde, allowing you to call
wde.Run(), wde.Stop() and wde.NewWindow() without referring to the
backend explicitly.

If you would like to disable a backend, you must import all
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this part at all. You should only ever import one backend. It so happens that the init package uses build rules to import one based on the platform.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming your trouble is with the line: "If you would like to disable a backend, you must import all...".

When I said "import all", I meant create files with the appropriate names so that the build rules will import the correct one. It could maybe be changed to "create import files for all".

The idea was if you did not want your project to support say...OSX for some reason, you could manually import the other 2 backends by creating files with the appropriate filters rather than importing init. This would effectively "disable" being able to build for OSX. Perhaps this is not worth including, but I thought you did a good job explaining how to manually import so I didn't want to delete it.

All I really want with this PR is to update the documentation to say you can do:

import _ "github.com/skelterjohn/go.wde/init"

and it will register the right backend for you. I won't be offended if you reject this PR and add it to the documentation in a better way. sigh Writing is hard :( Sorry for the confusion.

of the go.wde backends except the disabled ones. For instance,

import _ "github.com/skelterjohn/go.wde/xgb"

Expand All @@ -69,13 +78,9 @@ or
import _ "github.com/skelterjohn/go.wde/cocoa"


will register a backend with go.wde, allowing you to call
wde.Run(), wde.Stop() and wde.NewWindow() without referring to the
backend explicitly.

If you pupt the registration import in a separate file filtered for
the correct platform, your project will work on all three major
platforms without configuration.
If you put the registration import in a separate file filtered for
the correct platform, your project will only work on the imported
platforms.

That is, if you import go.wde/xgb in a file named "wde_linux.go",
go.wde/win in a file named "wde_windows.go" and go.wde/cocoa in a
Expand Down