From 74a0c3d7dad62be285f193986cd841abe9dace99 Mon Sep 17 00:00:00 2001 From: Worros Date: Wed, 8 Sep 2010 15:43:20 +0800 Subject: [PATCH] HHReplayer: Add file for Hud testing Uses pygame, was playing around with the idea of using this library to create a replayer with sprite animations. --- pyfpdb/HHReplayer.py | 68 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 pyfpdb/HHReplayer.py diff --git a/pyfpdb/HHReplayer.py b/pyfpdb/HHReplayer.py new file mode 100644 index 00000000..4eba02b4 --- /dev/null +++ b/pyfpdb/HHReplayer.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python + +import os, pygame +import time +from pygame.locals import * +from pygame.compat import geterror + +main_dir = os.path.split(os.path.abspath(__file__))[0] +data_dir = os.path.join(main_dir, '.') + +def load_image(name, colorkey=None): + fullname = os.path.join(data_dir, name) + try: + image = pygame.image.load(fullname) + except pygame.error: + print ('Cannot load image:', fullname) + print "data_dir: '%s' name: '%s'" %( data_dir, name) + raise SystemExit(str(geterror())) + image = image.convert() + if colorkey is not None: + if colorkey is -1: + colorkey = image.get_at((0,0)) + image.set_colorkey(colorkey, RLEACCEL) + return image, image.get_rect() + + +def main(): + #Initialize Everything + pygame.init() + clock = pygame.time.Clock() + screen = pygame.display.set_mode((640, 480)) + table_string = "Tournament 2010090009 Table %s - Blinds $600/$1200 Anto $150" + table_no = 1 + table_title = "Nongoma V - $200/$400 USD - Limit Holdem" + pygame.display.set_caption(table_title) + pygame.mouse.set_visible(0) + + # Load background image + bgimage, rect = load_image('../gfx/Table.png') + background = pygame.Surface(screen.get_size()) + background.blit(bgimage, (0, 0)) + + #Put Text On The Background, Centered + if pygame.font: + font = pygame.font.Font(None, 24) + text = font.render("FPDB Replayer Table", 1, (10, 10, 10)) + textpos = text.get_rect(centerx=background.get_width()/2) + background.blit(text, textpos) + + #Display The Background + screen.blit(background, (0, 0)) + pygame.display.flip() + + going = True + while going: + clock.tick(6000) + # Draw + screen.blit(background, (0, 0)) + # Change table # + #table_no += 1 + #table_title = "Tournament 2010090009 Table %s - Blinds $600/$1200 Anto $150" % table_no + #pygame.display.set_caption(table_title) + time.sleep(10) + + +if __name__ == '__main__': + main() +