Skip to content

Commit

Permalink
Fixed: black screen rendering for MPE env in rgb_array mode (#874)
Browse files Browse the repository at this point in the history
Co-authored-by: Jet <[email protected]>
  • Loading branch information
cibeah and jjshoots authored Mar 7, 2023
1 parent d225feb commit 18ee2a7
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions pettingzoo/mpe/_mpe_utils/simple_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,15 +276,14 @@ def render(self):

self.enable_render(self.render_mode)

observation = np.array(pygame.surfarray.pixels3d(self.screen))
if self.render_mode == "human":
self.draw()
self.draw()
if self.render_mode == "rgb_array":
observation = np.array(pygame.surfarray.pixels3d(self.screen))
return np.transpose(observation, axes=(1, 0, 2))
elif self.render_mode == "human":
pygame.display.flip()
return (
np.transpose(observation, axes=(1, 0, 2))
if self.render_mode == "rgb_array"
else None
)
return


def draw(self):
# clear screen
Expand Down

0 comments on commit 18ee2a7

Please sign in to comment.