Skip to content

Commit

Permalink
Correct docs for api/screen.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Baekalfen committed Dec 9, 2023
1 parent 66a9c8d commit 6cf1734
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions pyboy/api/screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ def __init__(self, mb):
self.raw_buffer = self.mb.lcd.renderer._screenbuffer
"""
Provides a raw, unfiltered `bytes` object with the data from the screen. Check
`Screen.raw_buffer_format` to see which dataformat is used. The returned type and dataformat are
subject to change.
`Screen.raw_buffer_format` to see which dataformat is used. **The returned type and dataformat are
subject to change.** The screen buffer is row-major.
Use this, only if you need to bypass the overhead of `Screen.image` or `Screen.ndarray`.
Expand All @@ -47,16 +47,16 @@ def __init__(self, mb):
"""
self.raw_buffer_dims = self.mb.lcd.renderer.buffer_dims
"""
Returns the dimensions of the raw screen buffer.
Returns the dimensions of the raw screen buffer. The screen buffer is row-major.
Returns
-------
tuple:
A two-tuple of the buffer dimensions. E.g. (160, 144).
A two-tuple of the buffer dimensions. E.g. (144, 160).
"""
self.raw_buffer_format = self.mb.lcd.renderer.color_format
"""
Returns the color format of the raw screen buffer.
Returns the color format of the raw screen buffer. **This format is subject to change.**
Returns
-------
Expand All @@ -65,7 +65,7 @@ def __init__(self, mb):
"""
self.image = None
"""
Generates a PIL Image from the screen buffer.
Generates a PIL Image from the screen buffer. The screen buffer is internally row-major, but PIL hides this.
Convenient for screen captures, but might be a bottleneck, if you use it to train a neural network. In which
case, read up on the `pyboy.api` features, [Pan Docs](https://gbdev.io/pandocs/) on tiles/sprites,
Expand All @@ -91,11 +91,12 @@ def __init__(self, mb):
).reshape(ROWS, COLS, 4)
"""
Provides the screen data in NumPy format. The format is given by `pyboy.api.screen.Screen.raw_buffer_format`.
The screen buffer is row-major.
Returns
-------
numpy.ndarray:
Screendata in `ndarray` of bytes with shape (160, 144, 3)
Screendata in `ndarray` of bytes with shape (144, 160, 3)
"""

@property
Expand Down

0 comments on commit 6cf1734

Please sign in to comment.