Example #1
0
	def __init__(self, resolution, flags):
		GraphicEngine.__init__(self)
		pygame.init()
		pygame.font.init()
		self._screen = pygame.display.set_mode(resolution, flags)
		self._clock = pygame.time.Clock()
		self._font = pygame.font.Font(None, 40)
		# for examples TODO: find a better way
		self._img_path = '../data/pix'
Example #2
0
	def __init__(self, resolution, caption):
		GraphicEngine.__init__(self)
		# for examples TODO: find a better way
		pyglet.resource.path.append('../data/pix')
		# for games: standard path
		pyglet.resource.path.append('data/pix')
		pyglet.resource.reindex()
		self._win = pyglet.window.Window(resolution[0], resolution[1],
							caption=caption)
		self._fps_display = pyglet.clock.ClockDisplay()
Example #3
0
	def display_context(self, screen, context):
		# clipping according to screen geometry
		x, y, width, height = screen.geometry
		glViewport(x, y, width, height)
		glMatrixMode(GL_PROJECTION)
		glLoadIdentity()
		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
		glOrtho(x, x + width, y, y + height, -1, 1)
		glMatrixMode(GL_MODELVIEW)

		GraphicEngine.display_context(self, screen, context)
Example #4
0
	def display_sprite(self, screen, sprite):
		res = GraphicEngine.display_sprite(self, screen, sprite)
		self._screen.blit(*res)
Example #5
0
	def display_sprite(self, screen, sprite):
		sprite, dst_pos, src_rect = GraphicEngine.display_sprite(self,
							screen, sprite)
		dst_pos[1] = self._invert_y_axis(sprite.height, dst_pos[1])
		sprite.set_position(*dst_pos)
		sprite.draw()