fix display rotation of grid background
This commit is contained in:
parent
ea5de06abc
commit
51196d47e1
|
@ -3,6 +3,7 @@ from pygame import Rect
|
|||
from pygame.locals import *
|
||||
|
||||
from lib.pgfw.pgfw.GameChild import GameChild
|
||||
from lib.pgfw.pgfw.Vector import Vector
|
||||
from electric_sieve.land.Mask import Mask
|
||||
from electric_sieve.land.Plate import Plate
|
||||
|
||||
|
@ -11,11 +12,13 @@ class Land(GameChild, Rect):
|
|||
def __init__(self, parent):
|
||||
GameChild.__init__(self, parent)
|
||||
self.load_configuration()
|
||||
if not self.get_game().rotated:
|
||||
self.intermediate = pygame.Surface(self.get_display_surface().get_size())
|
||||
else:
|
||||
self.intermediate = pygame.Surface((self.get_display_surface().get_height(), self.get_display_surface().get_width()))
|
||||
self.intermediate.set_colorkey((0, 0, 0))
|
||||
self.mask = Mask(self)
|
||||
self.plate = Plate(self)
|
||||
self.display_surface = self.get_display_surface()
|
||||
self.intermediate = pygame.Surface(self.display_surface.get_size())
|
||||
self.intermediate.set_colorkey((0, 0, 0))
|
||||
self.init_rect()
|
||||
self.reset()
|
||||
|
||||
|
@ -28,7 +31,7 @@ class Land(GameChild, Rect):
|
|||
Rect.__init__(self, (0, self.get_initial_top()), self.mask.get_size())
|
||||
|
||||
def get_initial_top(self):
|
||||
return self.display_surface.get_height() - self.h
|
||||
return self.intermediate.get_height() - self.h
|
||||
|
||||
def reset(self):
|
||||
self.top = self.get_initial_top()
|
||||
|
@ -40,4 +43,4 @@ class Land(GameChild, Rect):
|
|||
self.plate.update()
|
||||
self.intermediate.blit(self.plate, self)
|
||||
self.intermediate.blit(self.mask, self, None, BLEND_RGB_MIN)
|
||||
self.get_display_surface().blit(self.intermediate, (0, 0))
|
||||
self.get_display_surface().blit(self.get_game().orient(self.intermediate), (0, 0))
|
||||
|
|
|
@ -10,7 +10,6 @@ class Mask(GameChild, Surface):
|
|||
|
||||
def __init__(self, parent):
|
||||
GameChild.__init__(self, parent)
|
||||
self.display_surface = self.get_display_surface()
|
||||
self.load_configuration()
|
||||
self.init_surface()
|
||||
self.set_background()
|
||||
|
@ -25,7 +24,7 @@ class Mask(GameChild, Surface):
|
|||
self.velocity_ratio = config["velocity-ratio"]
|
||||
|
||||
def init_surface(self):
|
||||
Surface.__init__(self, (self.get_display_surface().get_width(), self.height))
|
||||
Surface.__init__(self, (self.parent.intermediate.get_width(), self.height))
|
||||
|
||||
def set_background(self):
|
||||
background = Surface(self.get_size())
|
||||
|
|
|
@ -16,7 +16,7 @@ class Plate(GameChild, Surface):
|
|||
self.speed = config["fade-speed"]
|
||||
|
||||
def init_surface(self):
|
||||
Surface.__init__(self, (self.get_display_surface().get_width(), self.height))
|
||||
Surface.__init__(self, (self.parent.intermediate.get_width(), self.height))
|
||||
|
||||
def set_background(self):
|
||||
width, height = self.get_size()
|
||||
|
|
Loading…
Reference in New Issue