Esempio n. 1
0
    def setup(self):
        self.group = pyglet.graphics.OrderedGroup(3)
        self.labels_group = pyglet.graphics.OrderedGroup(4)

        image = frame_image
        self.layout = VerticalLayout(0, 0)
        # Custom background
        self.background = None
        self.frame_rect = Rectangle(0, 0, self.controller.window.get_size()[0], image.height)
        self.frame = Rectangle(0, 0, self.controller.window.get_size()[0], image.height)

        width, height = self.controller.window.width, self.controller.window.height

        self.label = Label(G.APP_NAME, font_name='ChunkFive Roman', font_size=50, x=width/2, y=self.frame.y + self.frame.height,
            anchor_x='center', anchor_y='top', color=(255, 255, 255, 255), batch=self.batch,
            group=self.labels_group, width=width, height=height)
        self.label.height = self.label.content_height
        self.layout.add(self.label)

        button = self.Button(caption=G._("Singleplayer"),on_click=self.controller.start_singleplayer_game)
        self.layout.add(button)
        self.buttons.append(button)
        button = self.Button(caption=G._("Multiplayer"),on_click=self.controller.multiplayer)
        self.layout.add(button)
        self.buttons.append(button)
        button = self.Button(caption=G._("Options..."),on_click=self.controller.game_options)
        self.layout.add(button)
        self.buttons.append(button)
        button = self.Button(caption=G._("Exit game"),on_click=self.controller.exit_game)
        self.layout.add(button)
        self.buttons.append(button)

        # Splash text
        self.splash_text = 'Hello!'

        now = datetime.datetime.now()
        if now.month == 1 and now.day == 1:
            self.splash_text = 'Happy new year!'

        self.splash_text_label = Label(self.splash_text, font_name='Arial', font_size=30, x=self.label.x, y=self.label.y,
            anchor_x='center', anchor_y='top', color=(255, 255, 0, 255),
            group=self.labels_group)

        self.on_resize(width, height)

        # Panorama
        self.panorama = [G.texture_pack_list.selected_texture_pack.load_texture(['title', 'bg', 'panorama' + str(x) + '.png']) for x in range(6)]
        self.panorama_timer = 0

        pyglet.clock.schedule_interval(self.update_panorama_timer, .05)
        self.blur_texture = pyglet.image.Texture.create(256, 256)

        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
Esempio n. 2
0
    def makeHost(self):
        self.startB = Button(Rectangle((25, 75, 150, 50)), 'Start Game')

        def start(x):
            print self.game.serverClient.gRequest("startGame")
            print 'Start Game'

        self.startB.action = start
        self.addComponent(self.startB)

        self.gameID = TextField(Rectangle((ScreenWidth - 205, 50, 180, 75)),
                                'Game ID', self.game.serverClient.gameId)
        self.gameID.nameSize = 1.5
        self.gameID.textSize = 1.3
        self.addComponent(self.gameID)
Esempio n. 3
0
    def setup(self):
        self.group = pyglet.graphics.OrderedGroup(3)
        self.labels_group = pyglet.graphics.OrderedGroup(4)

        self.layout = Layout(0, 0)

        image = frame_image
        self.frame_rect = Rectangle(0, 0, image.width, image.height)
        self.background = G.texture_pack_list.selected_texture_pack.load_texture(['gui', 'background.png'])
        self.background = self.background.get_texture()
        self.background.height = 64
        self.background.width = 64
        self.frame = Rectangle(0, 0, image.width, image.height)

        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT)
        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT)
Esempio n. 4
0
	def showCutscene(self, window):
		self.cutscene = GUI()
		background = Rectangle(Point(0, 0), Point(self.__width, self.__height))
		background.setFill("blue")
		cutsceneText = TextArea(Point(-100, 50))
		level = standardAdventure[self.__currentLevel]
		cutsceneText.add(level['catchphrase'], "black", 12, 0, 40)
		cutsceneText.add(level['villain'], "black", 20, 0, 20)
		cutsceneText.add("Click to continue...", "black", 12, 0, self.__height - 100)
		cutsceneText.add("Level "+str(self.__currentLevel+1), "black", 12, 0, 0)
		self.cutscene.add(background)
		self.cutscene.add(cutsceneText)
		self.cutscene.draw(window)
		for i in range (100):
			cutsceneText.move(5, 0)
			sleep(1/30)
Esempio n. 5
0
    def __init__(self, game, bounds):
        Gui.__init__(self, game, bounds)
        self.game = game

        self.l = Label(Rectangle((25, 25, 100, 25)), 'Your Color:')
        self.addComponent(self.l)

        self.stone = Stone(None, 25, None)
        self.stone.getPos = lambda: self.getPos() + Vec(165, 35)

        self.applyB = Button(Rectangle((25, 75, 150, 50)), 'Apply Move')
        self.applyB.action = lambda x: game.applyMove()
        self.applyB.visible = False

        self.colorBs = []
        for color in range(1, 7):
            self.colorBs.append(Stone(color, 25, self))

        self.startB = None