Skip to content

Commit

Permalink
fix the rendering bug
Browse files Browse the repository at this point in the history
  • Loading branch information
xixinzhang committed Nov 8, 2023
1 parent eaf6693 commit 0fb1ce6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pettingzoo/mpe/_mpe_utils/simple_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ def step(self, action):
def enable_render(self, mode="human"):
if not self.renderOn and mode == "human":
self.screen = pygame.display.set_mode(self.screen.get_size())
self.clock = pygame.time.Clock()
self.renderOn = True

def render(self):
Expand All @@ -282,6 +283,7 @@ def render(self):
return np.transpose(observation, axes=(1, 0, 2))
elif self.render_mode == "human":
pygame.display.flip()
self.clock.tick(self.metadata["render_fps"])
return

def draw(self):
Expand Down

0 comments on commit 0fb1ce6

Please sign in to comment.