Beispiel #1
0
 def __init__(self, director, background_name=False, page_number=False):
     self.director = director
     self.is_failed = False
     self.page = False
     self.is_move = False
     if not page_number and background_name:
         self.background = resize(load_image(config.backgrounds+background_name+SMALL+PNG_EXT), (800, 600))
     else:
         directorie = config.definition_pages+page_number+PNG_EXT
         print "Directorie: "+directorie
         self.background = load_image(directorie)
     
     self.failed_rect = rect.Rect((0, 0), (0, 0))                    
     self.failed_img = load_image(config.titles+'failed'+PNG_EXT, True)
     self.failed_rect.topleft = (0, 0)
     self.failed_rect.size = self.failed_img.get_rect().size        
     
     self.common_buttoms = {
                            EXIT: Buttom(config.exit_btn_pos, config.exit_btn_size, 'exit_pressed'+PNG_EXT, 'exit_release'+PNG_EXT),
                            MAIN_MENU_SCENE: Buttom(config.main_menu_btn_pos, config.main_menu_btn_size, 'main_menu_pressed'+PNG_EXT, 'main_menu_release'+PNG_EXT)
                             }     
     
     self.pages = False
     self.go_scene = False
     self.exit = False
     self.is_complete = False
Beispiel #2
0
 def __init__(self):
     self.text_field_img = resize(load_image(config.name_items+TEXT_FIELD+PNG_EXT, True), config.name_text_field_size)
     self.text_field_rect = self.text_field_img.get_rect()
     self.text_field_rect.center = config.name_text_field_pos
     
     self.is_complete = False
     self.functions = {}
     self.elements = {}
     self.load_elements()
     self.load_functions()
     self.generate_table()
Beispiel #3
0
    def resize(self, window_size=None, full_screen=None):
        '''Resize all widgets according to new window <size>
            Also trigger the board resize
        '''
        self.window = graphics.resize(window_size, full_screen)
        self.size = self.window.get_size()

        for widget in self.widgets:
            widget.resize(self.size)

        self.widgets.clear(self.window, g.background.surface)

        self.fullboard = pygame.Rect(0, 0,
                                     self.size[0],
                                     self.size[1] - self.statusbar.height)
        self.resize_board(self.fullboard)
Beispiel #4
0
 def __init__(self):
     self.text_field_img = resize(load_image(config.name_items+TEXT_FIELD+PNG_EXT, True), config.hangman_text_field_size)
     self.text_field_rect = self.text_field_img.get_rect()
     self.text_field_rect.center = config.hangman_text_field_pos
     
     self.changed = False
     self.intents = 8
     self.paused = False
     self.is_complete = False
     self.tracks = []
     self.words = []
     self.typeds = []
     self.intent = 0
     self.lose = False
     self.word = ''
     self.track = ''
     self.exposed = ''
     
     self.load_words()            
     self.choose_word()
    def __init__(self, director, background_name):
        """
        Constructor
        """
        Scene.__init__(self, director, background_name)
        self.scene_winner = Sce_Winner(director, "winner", CRUCIGRAMA_SCENE)

        for buttom in self.common_buttoms.itervalues():
            buttom.is_visible = True

        self.buttoms = {
            VERT_1: Buttom(
                (117, 207),
                config.crux_b_size,
                "crux_" + VERT_1 + "_pressed" + PNG_EXT,
                "crux_" + VERT_1 + "_release" + PNG_EXT,
                True,
            ),
            VERT_2: Buttom(
                (194, 394),
                config.crux_b_size,
                "crux_" + VERT_2 + "_pressed" + PNG_EXT,
                "crux_" + VERT_2 + "_release" + PNG_EXT,
                True,
            ),
            VERT_3: Buttom(
                (221, 257),
                config.crux_b_size,
                "crux_" + VERT_3 + "_pressed" + PNG_EXT,
                "crux_" + VERT_3 + "_release" + PNG_EXT,
                True,
            ),
            VERT_4: Buttom(
                (381, 311),
                config.crux_b_size,
                "crux_" + VERT_4 + "_pressed" + PNG_EXT,
                "crux_" + VERT_4 + "_release" + PNG_EXT,
                True,
            ),
            HORZ_1: Buttom(
                (11, 233),
                config.crux_b_size,
                "crux_" + HORZ_1 + "_pressed" + PNG_EXT,
                "crux_" + HORZ_1 + "_release" + PNG_EXT,
                True,
            ),
            HORZ_2: Buttom(
                (91, 313),
                config.crux_b_size,
                "crux_" + HORZ_2 + "_pressed" + PNG_EXT,
                "crux_" + HORZ_2 + "_release" + PNG_EXT,
                True,
            ),
            HORZ_3: Buttom(
                (141, 365),
                config.crux_b_size,
                "crux_" + HORZ_3 + "_pressed" + PNG_EXT,
                "crux_" + HORZ_3 + "_release" + PNG_EXT,
                True,
            ),
            HORZ_4: Buttom(
                (90, 448),
                config.crux_b_size,
                "crux_" + HORZ_4 + "_pressed" + PNG_EXT,
                "crux_" + HORZ_4 + "_release" + PNG_EXT,
                True,
            ),
        }

        self.words_rect = {
            VERT_1: Rect((102, 218), (131 - 102, 382 - 218)),
            VERT_2: Rect((181, 406), (131 - 102, 516 - 406)),
            VERT_3: Rect((208, 272), (131 - 102, 517 - 272)),
            VERT_4: Rect((366, 326), (131 - 102, 516 - 326)),
            HORZ_1: Rect((22, 219), (179 - 22, 382 - 354)),
            HORZ_2: Rect((103, 300), (289 - 103, 382 - 354)),
            HORZ_3: Rect((155, 353), (395 - 155, 382 - 354)),
            HORZ_4: Rect((102, 434), (289 - 102, 382 - 354)),
        }

        self.words = {
            VERT_1: resize(load_image(config.crux_words_imgs + VERT_1 + PNG_EXT, True), self.words_rect[VERT_1].size),
            VERT_2: resize(load_image(config.crux_words_imgs + VERT_2 + PNG_EXT, True), self.words_rect[VERT_2].size),
            VERT_3: resize(load_image(config.crux_words_imgs + VERT_3 + PNG_EXT, True), self.words_rect[VERT_3].size),
            VERT_4: resize(load_image(config.crux_words_imgs + VERT_4 + PNG_EXT, True), self.words_rect[VERT_4].size),
            HORZ_1: resize(load_image(config.crux_words_imgs + HORZ_1 + PNG_EXT, True), self.words_rect[HORZ_1].size),
            HORZ_2: resize(load_image(config.crux_words_imgs + HORZ_2 + PNG_EXT, True), self.words_rect[HORZ_2].size),
            HORZ_3: resize(load_image(config.crux_words_imgs + HORZ_3 + PNG_EXT, True), self.words_rect[HORZ_3].size),
            HORZ_4: resize(load_image(config.crux_words_imgs + HORZ_4 + PNG_EXT, True), self.words_rect[HORZ_4].size),
        }

        self.is_typing = False
        self.typing_in = ""
        self.complete_word = ""
        self.complete_words = []
        self.finish_typing = False