Commits

Devin Jeanpierre  committed 8362cdf Draft

Made surface a public attribute <_<

  • Participants
  • Parent commits 33fe940

Comments (0)

Files changed (1)

File pygame_display.py

 
         """
 
-        old = self._surface
-        self._surface = surface
+        old = self.surface
+        self.surface = surface
         if size is None:
             size = surface.get_size()
         
             elif evt.type == pygame.MOUSEMOTION:
                 keys.extend(self._handle_mousemotion(evt))
             elif evt.type == pygame.VIDEORESIZE:
-                self.change_surface(self._surface, evt.size)
+                self.change_surface(self.surface, evt.size)
                 keys.append('window resize')
         
         return keys, raws
 
     def draw_screen(self, (cols, rows), r ):
         """Paint to the target surface with rendered canvas."""
-        # TODO: r.cursor
         assert self._started
         
         assert r.rows() == rows, "canvas size and passed size don't match"
             text_rect.center = dirty_rect.center
             
             # it's rendering time
-            self._surface.fill(bg, dirty_rect)
-            self._surface.blit(text, text_rect)
+            self.surface.fill(bg, dirty_rect)
+            self.surface.blit(text, text_rect)
             if (x, y) == cursor:
-                pygame.draw.rect(self._surface, fg, dirty_rect, 1)
+                pygame.draw.rect(self.surface, fg, dirty_rect, 1)
         
         return dirty_rects
     
         """
         # XXX: is it appropriate to do work here, I wonder?
         # May also be desirable to have a _complete_refresh attribute
-        ##self._surface.fill(self.BG_DEFAULT)
+        ##self.surface.fill(self.BG_DEFAULT)
         self._grid_dirty.update(self._grid)
 
 def compute_resolution(resolution, font_size, resolution_in_pixels=False,
 class PartialScreen(BaseSurfaceScreen):
     def __init__(self, surface, font, bold_font, font_size=None):
         super(PartialScreen, self).__init__(font, bold_font, font_size)
-        self._surface = surface
+        self.surface = surface
         self._init_chargrid(surface.get_size())
 
 class Screen(BaseSurfaceScreen):
         pygame.display.init()
         screen = pygame.display.set_mode(resolution, pygame.RESIZABLE)
         pygame.display.set_caption(self._window_title)
-        self._surface = screen
+        self.surface = screen
         self._init_chargrid(screen.get_size())
         super(Screen, self).start()