Example #1
0
    def __init__(self, init_active = True, init_visible = False, init_pos = (0,0), init_size = (400,300)):
        self.active = init_active        #is window currently updating?
        self.visible = init_visible    #is window rendering/displaying?
        self.version = '0.1'
        
        self.rect = pygame.Rect(init_pos,init_size) # define window render size
        self.window_width = int(WINDOW_WIDTH * 0.5) #
        self.dirty = False
    
        self.colorObj = myColors.colorHelper()
        self.messageQueue = ["myDebug v0.1:"] #initialize a message queue for active display

        self.viewLines = 10 # number of messages to display in the debug window
        self.viewRange = (0,self.viewLines)    # keep track of which messages we are displaying.

        # set some default appearance values
        self.font_dir = "./fonts/"
        self.font_file = "coders_crux.ttf"
        self.font_path = str(self.font_dir + self.font_file)
        self.font_size = 32 
        self.bgColor = self.colorObj.DEBUG_BG_COLOR
        self.fontColor = self.colorObj.DEBUG_FONT_COLOR
        self.maxMessageLimit = 10000 # for debug purposes, don't accept messages
        
        pygame.font.init()
        self.fontObj = pygame.font.Font(self.font_path, self.font_size)
        self.lineheight = self.fontObj.get_height()
Example #2
0
 def __init__(self, init_pos=(0, 0), init_speed=[0, 0], init_id=0):
     self.id = init_id
     self.rect = pygame.Rect(init_pos,(10,10))
     self.target = self.rect
     self.bounding = pygame.Rect((0,0),(WINDOW_WIDTH, WINDOW_HEIGHT)) ## by default the bounding rect is as big as the window
     self.speed = init_speed
     self.img_path = "./" 
     # Obj color settings
     self.colorObj = myColors.colorHelper()
     self.transColor = self.colorObj.getColor("TRANSPARENT") #set transparent color to global default
     # Obj Error queue and reporting
     self.errorQueue=[]
     self.errorQueue.append("Initialized object Id:" + str(self.id))
     self.broken = False # If the object does something silly, like throw an exception, set the broken flag!
     self.brokenmessage = "Working!" # store error responses when broken
     self.imageloaded = False # no image is loaded into an object by default
     self.movespeed = 1 # default movespeed is one for all objects (rounded up from zero)
     self.selected = False # display selection cursor around it
Example #3
0
    def __init__(self, fname_list = [("./", 0)]):
        self.BGlist = []
        self.img = pygame.Surface((WINDOW_WIDTH, WINDOW_HEIGHT))
        self.img.convert_alpha()
        self.rect = pygame.Rect((0,0),(WINDOW_WIDTH, WINDOW_HEIGHT))
        
        self.colorObj = myColors.colorHelper()
        self.transColor = self.colorObj.getColor("TRANSPARENT")        
        self.img.fill(self.colorObj.BGCOLOR) # fill with background color 
        self.img.set_colorkey(self.transColor)
        
        self.dirty = False
        #set transparent color to global default
        self.transColor = self.colorObj.getColor("TRANSPARENT") 

        for f in fname_list:
            if f[0] != "./":
                self.load(f[0], f[1])
Example #4
0
    def __init__(self, init_text = "OK", init_pos = (0,0), init_size = (100,50), init_id = 0):
        self.id = init_id
        self.text = init_text
        self.rect = pygame.Rect(init_pos, init_size)
        self.dirty = False
        self.state = "UP"
        
        self.img = pygame.Surface((self.rect.w, self.rect.h))
        self.img.convert_alpha()
        
        self.label = pygame.Surface((self.rect.w, self.rect.h))
        self.label.convert_alpha()
        
        self.colorObj = myColors.colorHelper()
        self.transColor = self.colorObj.getColor("TRANSPARENT")
        
        self.img.set_colorkey(self.transColor)
        self.label.set_colorkey(self.transColor)
        
        self.buttonType = "CLICK"
        self.visible = True

        self.errorQueue=[]
        self.errorQueue.append("Initialized button ID#:" + str(self.id) + " @" + str(self.rect))
        self.isError = True # set this if the error queue contains messages. This should pass init msgs
       
        # set some default appearance values
        self.font_dir = "./fonts/"
        self.font_file = "DIEHLD__.ttf"
        self.font_path = str(self.font_dir + self.font_file)
        self.font_size = 18 
        self.borderWidth = 4
        
        self.bgColor = self.colorObj.BUTTON_BG_COLOR
        self.fontColor = self.colorObj.BUTTON_FONT_COLOR
        self.borderColor = self.colorObj.BUTTON_BORDER_COLOR
        self.clickColor = self.colorObj.BUTTON_CLICK_COLOR
        self.shadowColor = self.colorObj.BUTTON_SHADOW_COLOR
        
        # create font object from font file
        self.fontObj = pygame.font.Font(self.font_path, self.font_size)
        self.lineheight = self.fontObj.get_height()
        self.render()
Example #5
0
    def __init__(self, init_pos = (0, 0), init_speed = [0, 0], init_id = 0, init_path = "./"):
        self.id = init_id
        
        self.rect = pygame.Rect(init_pos, (10,10))
        self.target = self.rect
        
        self.img = pygame.Surface((10,10))
        self.bg = pygame.Surface(self.img.get_size())             
        
        # convert both to alpha
        self.img.convert_alpha()
        self.bg.convert_alpha()    
            
        # by default the bounding rect is as big as the window
        self.bounding = SCREEN_RECT
        self.speed = init_speed
        self.img_path = "./" 
        self.cursor = None
        
        # Obj color settings
        self.colorObj = myColors.colorHelper()
        
        # Set transparent color to global default
        self.transColor = self.colorObj.getColor("TRANSPARENT") 
        
        # Obj Error queue and reporting
        self.errorQueue=[]
        self.errorQueue.append("Initialized object Id:" + str(self.id) + " @" + str(self.rect))
        self.isError = True # set this if the error queue contains messages. This should pass init msgs

        self.broken = False # If the object does something silly or bad, set the broken flag!
        
        self.imageloaded = False # no image is loaded into an object by default
        self.movespeed = 1 # default movespeed is one for all objects (rounded up from zero)
        self.selected = False # display selection cursor around object
        
        if init_path != "./":
            self.load_img(init_path)
Example #6
0
soundObj.load("./sfx/cat_purr_long.wav", "PURR")

cat_types = ['./img/cat_01.png',
             './img/cat_02.png',
             './img/cat_03.png']
                        
#Setup debug console object 
debug_console = cMyDebug()  #creates a new instance of the class and
                #assigns this object to the local variable x.
tempMsg = "OddDebug Console "+ debug_console.getVersion() +" Active!"
debug_console.addMessage([tempMsg])
del tempMsg

# sets up a mouse manager object
mouseMgr = cMyMouse() 
colorObj = myColors.colorHelper()

## Feminist Trail
## Version 0.1
## Author: Justin Smith
## Email: [email protected]

## Game metadata class + object
game = gameData()

#Setup Game Clock
FPS = 30 # frames per second setting
fpsClock = pygame.time.Clock()

## Setup Display surface, background, and convert to alpha
screen = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT),0,32)