Browse Source

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.
master
Worros 14 years ago
parent
commit
74a0c3d7da
  1. 68
      pyfpdb/HHReplayer.py

68
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()
Loading…
Cancel
Save