icon_pool.py 653 B

1234567891011121314151617181920212223242526272829
  1. # -*- coding: utf-8 -*-
  2. import pygame
  3. from pygame.locals import *
  4. from sys import exit
  5. import os
  6. import sys
  7. ##pool only store surfaces
  8. class IconPool(object):
  9. _GameShellIconPath = "gameshell/icons/"
  10. _Icons = {}
  11. def __init__(self):
  12. self._Icons= {}
  13. def Init(self):
  14. files = os.listdir(self._GameShellIconPath)
  15. for i in files:
  16. if os.path.isfile(self._GameShellIconPath+"/"+i) and i.endswith(".png"):
  17. keyname = i.split(".")[0]
  18. self._Icons[keyname] = pygame.image.load(self._GameShellIconPath+"/"+i).convert_alpha()
  19. MyIconPool = IconPool()