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

Make glfw.Window.Hints.set public #42

Closed
wants to merge 2 commits into from
Closed

Conversation

terraquad
Copy link
Contributor

@terraquad terraquad commented Jun 16, 2024

I would like to use it to add Graphics API specific hints to my default hints:

const defaultHints = .{
    .visible = false,
    .resizable = false,
};
const graphicsApiHints = .{
    .opengl_profile = .opengl_core_profile,
    .context_version_major = 3,
    .context_version_minor = 3,
    .opengl_forward_compat = true,
}
defaultHints.set(); // would like to do this
graphicsApiHints.set(); // would like to do this
// Create window...

Current output:

src/App.zig:17:36: error: 'set' is not marked 'pub'
    rendering_backend.windowHints().set();
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
/home/tq/.cache/zig/p/122055be80f617e5a3b64bce8ad4dd0fcd8635ece0ae48c86f3bc9dd05e1ba6302fd/src/Window.zig:252:5: note: declared here
    fn set(hints: Hints) void {
    ^~~~~~~~~~~~~~~~~~~~~~~~~
  • By selecting this checkbox, I agree to license my contributions to this project under the license(s) described in the LICENSE file, and I have the right to do so or have received permission to do so by an employer or client I am producing work for whom has this right.

I don't see why this is private. I would like to use it to add Graphics API specific to my default hints:
```zig
const defaultHints = .{
    .visible = false,
    .resizable = false,
};
const graphicsApiHints = .{
    .opengl_profile = .opengl_core_profile,
    .context_version_major = 3,
    .context_version_minor = 3,
    .opengl_forward_compat = true,
}
defaultHints.set(); // would like to do this
graphicsApiHints.set(); // would like to do this
// Create window...
```
@slimsag
Copy link
Owner

slimsag commented Jun 16, 2024

you shouldn't be calling set() directly, the API is designed so that you pass hints to glfw.Window.create()

@terraquad
Copy link
Contributor Author

terraquad commented Jun 16, 2024

I know, but there is no way to combine structs so I want to add them separately.

In this case, I can't combine defaultHints and graphicsApiHints into one to pass it to glfw.Window.create, so I tried to call defaultHints.set and then graphicsApiHints.set.

@terraquad
Copy link
Contributor Author

I could also add a doc comment that discourages the use of Hints.set and to instead use glfw.Window.create whenever possible.

@slimsag
Copy link
Owner

slimsag commented Jul 8, 2024

sorry, but I don't understand the use case and don't currently think this is a good change.

@terraquad terraquad closed this by deleting the head repository Jul 25, 2024
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

Successfully merging this pull request may close these issues.

2 participants