瀏覽代碼

gbe.display.Display now has the ability to clear screen and set a clear color.

master
Bryan Miller 6 年之前
父節點
當前提交
ba373b2d2f
共有 1 個文件被更改,包括 14 次插入0 次删除
  1. +14
    -0
      game/gbe/display.py

+ 14
- 0
game/gbe/display.py 查看文件

@@ -28,6 +28,11 @@ class _Display:
self._resolution = (width, height)
self._display_surface = None
self._display_flags = Flag.HWSURFACE | Flag.DOUBLEBUF
self._clear_color = pygame.Color(0,0,0)

@property
def init(self):
return self._init

@property
def surface(self):
@@ -97,6 +102,9 @@ class _Display:
elif enable == False:
Events.unlisten("VIDEORESIZE", self._OnVideoResize)

def set_clear_color(self, r, g, b, a=255):
self._clear_color = pygame.Color(r, g, b, a)

def set_mode(self, resolution, flags):
if (self._init == False):
self._init = True
@@ -106,6 +114,12 @@ class _Display:
self._resolution = self._display_surface.get_size()
return self


def clear(self):
if self._display_surface is not None:
self._display_surface.fill(self._clear_color)


def flip(self):
if self._init:
pygame.display.flip()

Loading…
取消
儲存