def init(self, size, fullscreen=False): flags = OPENGL|DOUBLEBUF if fullscreen: flags |= FULLSCREEN pygame.display.set_mode(size.xy, flags) pygame.display.set_caption('Super Chainsaw Food Adventure') i = pygame.display.Info() self.size = Vector2i(i.current_w, i.current_h) glMatrixMode(GL_MODELVIEW) glEnable(GL_TEXTURE_2D) glDisable(GL_CULL_FACE) glEnable(GL_BLEND) glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA) self.stage = 1 self.projection = Matrix.perspective(75, self.size, 0.1, 100) self.ortho = Matrix.ortho(self.size) v = np.array([ 0,0,0, 0,0, 1,0,0, 1,0, 1,1,0, 1,1, 0,1,0, 0,1, ], np.float32) i = np.array([0,1,2,3], np.uint32) self.quad = VBO(GL_QUADS, v, i) # parallax self.parallax_rep = 25 v = np.array([ 0,0,0, 0,1, 1,0,0, self.parallax_rep, 1, 1,1,0, self.parallax_rep,0, 0,1,0, 0,0, ], np.float32) i = np.array([0,1,2,3], np.uint32) self.repquad = VBO(GL_QUADS, v, i) self.parallax = Image('texture/sky.png', wrap=GL_REPEAT) self.parallax2 = Image('texture/sky2.png', wrap=GL_REPEAT) self.fbo = FBO(self.size, format=GL_RGB8, depth=True) self.shader = Shader('derp') self.passthru = Shader('passtru') self.herp = Shader('herp') self.map = Map('map.json') self.player = Player(Vector2f(55,-9)) self.clock = pygame.time.Clock() self.hud = HUD(Vector2i(500,100)) self.hpmeter = HUD(Vector2i(20, 500)) self.font = self.hud.create_font(size=16) self.font2 = self.hud.create_font(size=12) self.land = pygame.mixer.Sound('data/sound/land.wav') self.ding = pygame.mixer.Sound('data/sound/ding.wav') self.eat = pygame.mixer.Sound('data/sound/eat.wav') self.wind = pygame.mixer.Sound('data/sound/wind.wav') self.wind.play(loops=-1) self.set_stage(1) self.killfade = None self.killfade2 = 1.0 # fade amount self.textbuf = [] self.texttime = -10.0 self.message('<b>Welcome adventurer!</b>\nYou can start exploring the world but beware of wandering away too far.') self.message('When outside of lights your <i>HP</i> will drain and you will get lost in the woods.') self.message('Eat food to temporary increase your <i>HP</i>.') self.message('Quest started: "Find the chainsaw".') self.message('Quest started: "Frobnicate something".') with self.hud: self.hud.clear((0,1,1,1))