def draw(self, screen, aa=False, color=None, image=None): if image is not None and color is not None: planet_texture = GUI.Background( 'physics_weed.png', [round(self.pos_x), round(self.pos_y)]) planet_texture.image = GUI.colorize(planet_texture.image, color) screen.blit(planet_texture.image, planet_texture.rect) elif image is not None: planet_texture = GUI.Background( 'physics_weed.png', [round(self.pos_x), round(self.pos_y)]) screen.blit(planet_texture.image, planet_texture.rect) elif not aa: if color is None: pg.draw.circle(screen, (self.R, self.G, self.B), (round(self.pos_x), round(self.pos_y)), self.radius) else: pg.draw.circle(screen, color, (round(self.pos_x), round(self.pos_y)), self.radius) else: if color is None: gfx.aacircle(screen, round(self.pos_x), round(self.pos_y), self.radius, (self.R, self.G, self.B)) gfx.filled_circle(screen, round(self.pos_x), round(self.pos_y), self.radius, (self.R, self.G, self.B)) else: gfx.aacircle(screen, round(self.pos_x), round(self.pos_y), self.radius, color) gfx.filled_circle(screen, round(self.pos_x), round(self.pos_y), self.radius, color)
def end(self): taskMgr.remove('characterDirectionTask') for child in render.getChildren(): child.removeNode() self.camhandler.destroy() self.coords.destroy() self.sky.remove() self.background = GUI.Background(self.send.GET_PARTIES)
def setup_pygame(): global myfont, screen, BackGround, clock, clear, WIDTH, HEIGHT # set up pygame pg.init() # initializes screen full screen pg.mouse.set_cursor(*pg.cursors.diamond) ctypes.windll.user32.SetProcessDPIAware() true_res = (ctypes.windll.user32.GetSystemMetrics(0), ctypes.windll.user32.GetSystemMetrics(1)) screen = pg.display.set_mode(true_res, pg.FULLSCREEN) pg.display.set_caption("Physics Simulator") clock = pg.time.Clock() # used to manage how fast the screen updates myfont = pg.font.Font(None, 36) # sets the font for text in pygame rect_x = 50 rect_y = 50 WIDTH, HEIGHT = pg.display.get_surface().get_size() # gets the size of the screen for planet placement # image source : BackGround = GUI.Background('background_.jpg', [WIDTH / 2, HEIGHT / 2]) print(WIDTH, HEIGHT) s_x = 27 # size of clearing box in x s_y = 27 # size of clearing box in y clear = pg.Surface((s_x, s_y)) # small clearing box for smaller screen updates clear.fill(BLACK) # sets clearing box to black
def __init__(self): self.music = base.loader.loadSfx(GAME + '/music/24.ogg') self.music.setLoop(True) self.music.play() self.background = GUI.Background(self.loginScreen)