parasyte / parasyte/pixels

Access `Window` from `Pixels`?

Open
#421 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted question rfc
Dominant language
Rust
Stars
2.1k
Forks
147
Avg merge
12m
Merged PRs (30d)
1

Description

With the new 0.30 winit ApplicationHandler API using a Pixels<'a> for any lifetime other than 'static just got significantly harder, because all app state must now exist within one struct, which must exist before opening the window. The current workaround is to store an Arc<Window> and create the Pixels<'static> from it; but it would be far easier if the Pixels could own the window and simply have an accessor through which application code can use its own Window. Otherwise a self-referencing struct would be required with the Pixels referencing the Window stored alongside it in the same struct.

Anyways I'm proposing Pixels::window(&self) + Pixels::window_mut(&mut self) that return a reference to the winit::window::Window the Pixels was created with

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named in the issue. Start by locating the Pixels type and its window ownership and lifetime implementation; determine whether window() and window_mut() can expose the created winit Window without requiring a self-referential structure, then verify the API with the project's existing tests or examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
desktop, game-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.