Beispiel #1
0
    def __init__(self, g, *a, **k):
        Panel.__init__(self, width=550, height=340, zindex=15, *a, **k)
        parent = self.parent
        self.x = (parent.width - 550) // 2
        self.y = (parent.height - 340) // 2
        self.textarea = ta = TextArea(
            parent=self, x=30, y=30, width=550-30, height=340-60,
            font_size=12,
        )
        ta.text = u''
        winners = g.winners
        for p in g.players:
            s = u'|G%s|r(|R%s|r, |c0000ffff%s|r, %s)\n' % (
                p.ui_meta.name, p.account.username.replace('|', '||'),
                g.ui_meta.identity_table[p.identity.type],
                u'|R胜利|r' if p in winners else u'失败'
            )
            ta.append(s)

        if g.me in winners:
            self.pic = L('thb-win')
        else:
            self.pic = L('thb-lose')

        close = Button(
            u'关闭', parent=self, x=440, y=25, width=90, height=40, zindex=10,
        )

        @close.event
        def on_click():
            self.delete()
Beispiel #2
0
    def batch_draw_status(gcps):
        glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT)
        vertices = []
        for port in gcps:
            char = port.character
            if not char: continue

            hp, hp_bg = L('thb-hp'), L('thb-hp_bg')
            if char.dead:
                hp = hp.grayed
                hp_bg = hp_bg.grayed

            # hp bar
            w = hp.width
            x, y = port.x, port.y
            for i in xrange(char.maxlife):
                vertices.extend(
                    hp_bg.get_t4f_v4f_vertices(5+x+i*w, 56+y)
                )

            for i in xrange(max(char.life, 0)):
                vertices.extend(
                    hp.get_t4f_v4f_vertices(5+x+i*w, 56+y)
                )

        nums = L('thb-num')
        for port in gcps:
            x, y, w = port.x, port.y, port.width
            char = port.character
            if not char: continue

            n = len(char.cards) + len(char.showncards)
            seq = str(n)
            ox = (32 - len(seq)*14)//2
            for i, ch in enumerate(seq):
                n = ord(ch) - ord('0')
                # x, y = w - 34 + ox + i*14, 68
                vertices.extend(nums[n].get_t4f_v4f_vertices(
                    x + w - 34 + ox + i*14,
                    y + 68
                ))

        if vertices:
            with nums[0].owner:
                n = len(vertices)
                buf = (GLfloat*n)()
                buf[:] = vertices
                glInterleavedArrays(GL_T4F_V4F, 0, buf)
                glDrawArrays(GL_QUADS, 0, n/8)

        glPopClientAttrib()
Beispiel #3
0
    def update(self):
        p = self.player
        if not p: return

        nick = u"<%s>" % p.account.username
        if self.dropped:
            if self.fleed:
                prefix = u'(逃跑)'
            else:
                prefix = u'(掉线)'

            nick = prefix + nick

        self.caption = nick
        char = self.character

        if char:
            meta = char.ui_meta
            self.bg = L(meta.port_image)
            self.update_bg()
            self.set_charname(meta.name)
            desc = char_desc(char)
            if self._last_balloon != desc:
                self.balloon.set_balloon(desc, (2, 74, 145, 96))
                self._last_balloon = desc

        self.bot_reserve = 74
        self.gray_tex = None
        Frame.update(self)
        self.update_position()
        self.update_color()
        self.tagarrange()
Beispiel #4
0
    def draw(self):
        w, h = self.width, self.height
        g = Game.getgame()
        try:
            n = len(g.deck.cards)
        except AttributeError:
            return

        glColor3f(*[i / 255.0 for i in Colors.blue.light])
        glRectf(0, 0, w, h)
        glColor3f(*[i / 255.0 for i in Colors.blue.heavy])
        glRectf(0, h, w, 0)

        glColor3f(1, 1, 1)
        try:
            nums = L('thb-num')
            seq = str(n)
            ox = (w - len(seq) * 14) // 2
            oy = (h - nums[0].height) // 2
            with nums[0].owner:
                for i, ch in enumerate(seq):
                    n = ord(ch) - ord('0')
                    # x, y = w - 34 + ox + i*14, 68
                    nums[n].blit_nobind(ox + i * 14, oy)

        except AttributeError:
            pass
Beispiel #5
0
    def process_user_input(self, ilet):
        meta = ilet.character.ui_meta
        self.texture = L(meta.port_image)

        Label(
            text=meta.name, x=2, y=80, font_size=12,
            anchor_x='left', anchor_y='bottom',
            color=(255, 255, 160, 255), shadow=(2, 0, 0, 0, 230),
            batch=self.lbls,
        )

        ta = TextArea(
            parent=self,
            font_size=9,
            x=0, y=0, width=self.width, height=80 - 2,
        )

        ta.append(ilet.dialog)

        def on_mouse_press(*a, **k):
            ilet.set_result(0)
            ilet.done()
            end_transaction(self.trans)

        self.event(on_mouse_press)
        ta.event(on_mouse_press)

        self.should_draw = True

        if ilet.voice:
            self.player = SoundManager.play(ilet.voice)

        b = SmallProgressBar(parent=self, x=self.width - 140, y=0, width=140)
        b.value = LinearInterp(1.0, 0.0, ilet.timeout)
Beispiel #6
0
class UIBanGirl(UIBaseChooseGirl):
    hover_pic = L('c-imagesel_ban')

    def process_user_input_start(self, ilet):
        self.label.color = (255, 255, 160, 255)
        self.label.text = u'等待%s选择不能出场的角色' % (ilet.actor.account.username)
        self.parent.prompt(u'|R%s|r正在BAN……' % ilet.actor.account.username)

    def process_user_input(self, ilet):
        assert ilet.actor is Game.getgame().me
        self.inputlet = ilet
        self.label.text = u'请你选择不能出场的角色'
        self.label.color = (160, 251, 255, 255)
        self.begin_selection()

    def process_user_input_finish(self, ilet, rst):
        self.label.text = u'等待其他玩家操作'
        self.label.color = (255, 255, 160, 255)
        self.inputlet = None

    def on_girl_chosen(self, arg):
        UIBaseChooseGirl.on_girl_chosen(self, arg)
        actor, choice = arg
        choice and choice.char_cls and self.parent.prompt(
            u'|R%s|rBAN掉了|G【%s】|r' % (
                actor.account.username,
                choice.char_cls.ui_meta.char_name,
            ))
Beispiel #7
0
    def batch_draw(csl):
        glPushMatrix()
        glLoadIdentity()
        vertices = []
        for cs in csl:
            ax, ay = cs.abs_coords()
            vertices += cs.img.get_t4f_v4f_vertices(ax, ay)

            s = cs.card.suit
            n = cs.card.number

            ssuit = L('thb-smallsuit')
            snum = L('thb-smallnum')

            if n == 10:  # special case
                # g[0].blit(1+g[0].vertices[0], 33+g[0].vertices[1])
                # g[1].blit(5+g[1].vertices[0], 33+g[1].vertices[1])
                vertices += snum[s % 2 * 14 + 10].get_t4f_v4f_vertices(
                    ax - 1, ay + 31)
                vertices += snum[s % 2 * 14 + 0].get_t4f_v4f_vertices(
                    ax + 3, ay + 31)
            else:
                vertices += snum[s % 2 * 14 + n].get_t4f_v4f_vertices(
                    ax + 1, ay + 31)

            vertices += ssuit[s - 1].get_t4f_v4f_vertices(ax + 1, ay + 22)

            if cs.selected:
                vertices += L('thb-card-small-selected').get_t4f_v4f_vertices(
                    ax, ay)
            else:
                vertices += L('thb-card-small-frame').get_t4f_v4f_vertices(
                    ax, ay)

        n = len(vertices)
        buf = (GLfloat * n)()
        buf[:] = vertices
        glColor3f(1., 1., 1.)
        glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT)
        glInterleavedArrays(GL_T4F_V4F, 0, buf)
        with get_atlas('card').texture:
            glDrawArrays(GL_QUADS, 0, n / 8)

        glPopClientAttrib()
        glPopMatrix()
Beispiel #8
0
 def draw(self):
     ray = L('c-ray')
     glPushMatrix()
     glRotatef(self.angle, 0., 0., 1.)
     glScalef(self.scale, 1., 1.)
     glTranslatef(0., -ray.height/2, 0.)
     glColor4f(1., 1., 1., self.alpha)
     ray.blit(0, 0)
     glPopMatrix()
Beispiel #9
0
    def update(self):
        card = self.card
        meta = card.ui_meta

        self.img = L(meta.image)

        self.number, self.suit = card.number, card.suit

        t = getattr(meta, 'description', None)
        t and self.balloon.set_balloon(t)
Beispiel #10
0
 def _bgm_fade_out_done(self, _=None):
     pyglet.clock.unschedule(self._set_vol)
     self.bgm_player.next()
     self.bgm_player.queue(L(self.bgm_next))
     self.volume_factor = 1.0
     self._set_vol()
     self.bgm_player.play()
     self.bgm_switching = False
     self.cur_bgm = self.bgm_next
     self.bgm_next = None
Beispiel #11
0
    def balloon_show(self):
        try:
            meta = self.character.ui_meta
            figure_image = L(meta.figure_image)
        except:
            return self.balloon.balloon_show()

        try:
            figure_image_alter = L(meta.figure_image_alter)
            if figure_image_alter.decrypted:
                figure_image = figure_image_alter.reference

        except:
            pass

        return _CharacterFigure(
            figure_image,
            meta.description,
            parent=self.parent,
        )
Beispiel #12
0
    def __init__(self, card, x=0.0, y=0.0, *args, **kwargs):
        Control.__init__(self, *args, **kwargs)
        self._w, self._h = 33, 46
        self.x, self.y = x, y
        self.selected = False
        self.hover = False
        self.card = card

        self.img = L(card.ui_meta.image_small)
        self.balloon = balloon = BalloonPrompt(self)
        balloon.set_balloon(card.ui_meta.description)
Beispiel #13
0
 def __init__(self, x0, y0, x1, y1, *args, **kwargs):
     Control.__init__(self, *args, **kwargs)
     from math import sqrt, atan2, pi
     self.x, self.y = x0, y0
     dx, dy = x1 - x0, y1 - y0
     scale = sqrt(dx * dx + dy * dy) / L('c-ray').width
     self.angle = atan2(dy, dx) / pi * 180
     self.scale = SineInterp(0.0, scale, 0.4)
     self.alpha = ChainInterp(FixedInterp(1.0, 1),
                              CosineInterp(1.0, 0.0, 0.5),
                              on_done=lambda self, desc: self.delete())
Beispiel #14
0
    def __init__(self, choice, group, x=0, y=0, *a, **k):

        self.choice = choice
        cc = choice.char_cls
        meta = cc.ui_meta
        pimg = L(meta.port_image)

        self.x = x
        self.y = y
        ImageSelector.__init__(self, pimg, group, *a, **k)

        self.balloon.set_balloon(char_desc(cc))
Beispiel #15
0
    def play(self, snd, queue=None):
        if self._se_suppress: return
        if self.muted: return

        if queue is None:
            player = ManagedSoundPlayer(self.player_group)
        else:
            player = self.se_players[queue]

        player.volume = self.se_volume
        player.queue(L(snd))
        player.play()

        return player
Beispiel #16
0
    def __init__(self, choice, group, x=0, y=0, *a, **k):

        self.choice = choice
        cc = choice.char_cls
        meta = cc.ui_meta
        pimg = L(meta.port_image)
        self.char_name = meta.char_name
        self.char_maxlife = cc.maxlife

        self.x = x
        self.y = y
        ImageSelector.__init__(self, pimg, group, *a, **k)

        self.balloon.set_balloon(meta.description)
Beispiel #17
0
    def on_text(self, text):
        # The easter egg
        ks = self.keystrokes
        ks = (ks + text)[:40]
        self.keystrokes = ks

        from gamepack.thb.characters.baseclasses import Character

        for c in Character.character_classes.itervalues():
            try:
                alter = c.ui_meta.figure_image_alter
            except:
                continue

            for i in xrange(len(ks)):
                if L(alter).decrypt(ks[-i:]):
                    SoundManager.play('c-sound-input')
Beispiel #18
0
    def process_user_input(self, ilet):
        cards = ilet.cards

        cw = min(6, len(cards)) * 93
        h = 30 + 145 + 10
        w = 30 + cw + 30

        ca = DropCardArea(
            parent=self,
            x=30,
            y=30,
            fold_size=6,
            width=cw,
            height=125,
        )

        for c in cards:
            cs = CardSprite(c, parent=ca)
            cs.associated_card = c

            @cs.event
            def on_mouse_dblclick(x, y, btn, mod, cs=cs):
                ilet.set_card(cs.associated_card)
                ilet.done()
                end_transaction(self.trans)

        ca.update()

        p = self.parent
        self.x, self.y = (p.width - w) // 2, (p.height - h) // 2
        self.width, self.height = w, h
        self.update()

        btn = ImageButton(
            L('c-buttons-close_blue'),
            parent=self,
            x=w - 20,
            y=h - 20,
        )

        @btn.event
        def on_click():
            ilet.done()
            end_transaction(self.trans)
Beispiel #19
0
    def __init__(self, x=0.0, y=0.0, color=Colors.blue, tag_placement='me', *args, **kwargs):
        self.bg = None
        self.character = None
        self._color = color
        self._disabled = False
        self._last_balloon = None
        self.player = None
        self._selected = False
        self.taganims = []
        self.tag_placement = tag_placement

        Frame.__init__(
            self, width=149, height=195,
            bot_reserve=20, color=color,
            thin_shadow=True,
            **kwargs
        )
        self.balloon = BalloonPrompt(self, self.balloon_show)

        self.view = view = self.parent
        self.x, self.y = x, y

        self.charname_lbl = self.add_label(
            u'', 7, self.height-30,
            width=16, multiline=True,
            font_size=9,
            anchor_x='left', anchor_y='top',
            color=(255, 255, 255, 255),
            shadow=(1, 0, 0, 0, 179),
        )

        self.portcard_area = PortraitCardArea(
            parent=view,
            x=self.x, y=self.y,
            width=self.width, height=self.height,
            zindex=100,
        )
        self.equipcard_area = EquipCardArea(
            view=view, parent=self, x=3, y=6,
        )

        w, h = self.width, self.height

        tbl = view.game.ui_meta.identity_table
        colortbl = view.game.ui_meta.identity_color
        conf = [(tbl[k], getattr(Colors, colortbl[k]), k) for k in tbl]

        self.identity_btn = b = OptionButton(
            conf=conf, default=0, parent=self,
            x=w-42-4, y=h-24-10-18,
            width=42, height=18,
        )

        @b.event
        def on_value_changed(v):
            self.set_color(b.color)

        def tagarrange_bottom():
            x, y = self.x, self.y
            w = self.width
            x += w + 1
            y -= 27
            for a in self.taganims:  # they are pyglet.sprite.Sprite instances
                x -= 27
                a.set_position(x, y)

        def tagarrange_me():
            x, y = self.x, self.y
            w = self.width
            x += w + 6
            y += 142
            for a in self.taganims:  # they are pyglet.sprite.Sprite instances
                a.set_position(x, y)
                x += 27

        def tagarrange_right():
            x, y = self.x, self.y
            w = self.width
            x += w + 3
            y += 1
            for a in self.taganims:  # they are pyglet.sprite.Sprite instances
                a.set_position(x, y)
                y += 27

        def tagarrange_left():
            x, y = self.x, self.y
            x -= 28
            y += 1
            for a in self.taganims:  # they are pyglet.sprite.Sprite instances
                a.set_position(x, y)
                y += 27

        self._tagarrange_funcs = {
            'bottom': tagarrange_bottom,
            'me': tagarrange_me,
            'left': tagarrange_left,
            'right': tagarrange_right,
        }

        showncard_btn = ImageButton(
            L('c-buttons-port_showncard'),
            parent=self,
            x=self.width - 22, y=90,
        )

        @showncard_btn.event  # noqa
        def on_click():
            p = self.character
            if not p: return
            if not p.showncardlists: return  # before the 'real' game_start
            last = ShownCardPanel.current
            if last:
                last.delete()
                if last.character is p:
                    return

            ShownCardPanel(p, parent=self.view)
Beispiel #20
0
    def batch_draw(csl):
        glPushMatrix()
        glLoadIdentity()

        vertices = []
        for cs in csl:
            ax, ay = cs.abs_coords()
            if cs.ft_anim:
                qs = cs.question_scale
                bs = cs.back_scale
                aa = cs.ftanim_alpha
                ca = cs.ftanim_cardalpha
                if cs.gray:
                    c = (.66, .66, .66, ca)
                else:
                    c = (1., 1., 1., ca)
                vertices += cs.img.get_t2c4n3v3_vertices(c, ax, ay)

                n, s = cs.number, cs.suit
                if n: vertices += L('thb-cardnum')[s % 2 * 13 + n - 1].get_t2c4n3v3_vertices(c, ax + 5, ay + 105)
                if s: vertices += L('thb-suit')[s - 1].get_t2c4n3v3_vertices(c, ax + 6, ay + 94)

                c = (1, 1, 1, aa)

                if qs:
                    vertices += L('thb-card-question').get_t2c4n3v3_vertices(c, ax+(1-qs)*45, ay, 0, qs*91)

                if bs:
                    vertices += L('thb-card-hidden').get_t2c4n3v3_vertices(c, ax+(1-bs)*45, ay, 0, bs*91)
            else:
                a = cs.alpha
                if cs.gray:
                    c = (.66, .66, .66, a)
                else:
                    c = (1., 1., 1., a)
                vertices += cs.img.get_t2c4n3v3_vertices(c, ax, ay)
                resides_in = cs.card.resides_in
                if resides_in and resides_in.type == 'showncards':
                    vertices += L('thb-card-showncardtag').get_t2c4n3v3_vertices(c, ax, ay)

                n, s = cs.number, cs.suit
                if n: vertices += L('thb-cardnum')[s % 2 * 13 + n - 1].get_t2c4n3v3_vertices(c, ax + 5, ay + 105)
                if s: vertices += L('thb-suit')[s-1].get_t2c4n3v3_vertices(c, ax+6, ay+94)

                if cs.selected:
                    c = (0., 0., 2., 1.0)
                else:
                    c = (1., 1., 1., cs.shine_alpha)

                vertices += L('thb-card-shinesoft').get_t2c4n3v3_vertices(c, ax-6, ay-6)

        if vertices:
            n = len(vertices)
            buf = (GLfloat*n)()
            buf[:] = vertices
            glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT)
            glInterleavedArrays(GL_T2F_C4F_N3F_V3F, 0, buf)
            with get_atlas('card').texture:
                glDrawArrays(GL_QUADS, 0, n/12)
            glPopClientAttrib()

        glPopMatrix()
Beispiel #21
0
    def init(self, card_lists, compat=True, multiline=False):
        for c in self.control_list[:]:
            c.delete()

        self.lbls = pyglet.graphics.Batch()

        name_width = 100 if any(cl[0] for cl in card_lists) else 0
        y = 40
        h = y + 10
        w = name_width + 6*93.0+30
        i = 0
        for name, cl in reversed(card_lists):
            if not cl:
                if compat: continue
                if multiline:
                    i += 1
                    h += 125

            for sindex in reversed(xrange(0, len(cl), 6)):
                if multiline:
                    cat = cl[sindex:sindex+6]
                else:
                    cat = cl

                ca = DropCardArea(
                    parent=self,
                    x=name_width, y=y+145*i,
                    fold_size=6,
                    width=6*93, height=145,
                )

                def register_events(cs):
                    @cs.event
                    def on_mouse_click(*v, **k):
                        self.toggle_selection(cs)

                    @cs.event
                    def on_mouse_dblclick(*v, **k):
                        self.dispatch_event('on_confirm', cs)

                for c in cat:
                    cs = CardSprite(c, parent=ca)
                    cs.associated_card = c
                    register_events(cs)

                ca.update()
                i += 1
                h += 145

                if not multiline: break

            name and Label(
                text=name, x=30, y=y+62+145*(i-1), font_size=12,
                color=(255, 255, 160, 255), shadow=(2, 0, 0, 0, 130),
                anchor_x='left', anchor_y='center', batch=self.lbls,
            )

        p = self.parent
        self.x, self.y = (p.width - w)//2, (p.height - h)//2
        self.width, self.height = w, h
        self.update()

        btn = ImageButton(
            L('c-buttons-close_blue'),
            parent=self,
            anchor_x='right', anchor_y='top',
            x=w-20, y=h-20,
        )

        @btn.event
        def on_click():
            self.delete()
Beispiel #22
0
 def draw(self):
     glColor3f(1, 1, 1)
     L('thb-tag-gameintro').blit(0, 0)
Beispiel #23
0
    def render_char(self, text, type):
        char = u'⑨' if self.font.password else text[0]
        asc = ord(char)
        font = self.font
        suffix = ('BLOAT', 'SHADOWTHIN', 'SHADOWTHICK')[type]

        if font.size == 9:
            suffix = '12' + suffix
        else:
            suffix = '16' + suffix

        if char in u'♠♥♣♦':
            # special case for suits
            i = u'♠♥♣♦'.index(char)
            if font.size == 9:
                h = 12
                grid = L('c-suit12')
            else:
                h = 16
                grid = L('c-suit16')

            glyph = font.create_glyph(grid[i])
            glyph.set_bearings(1, -2, h + 1)
            return glyph

        elif char == u'\u200b':
            glyph = font.create_glyph(
                pyglet.image.ImageData(1, 1, 'RGBA', '\xFF' * 4))
            glyph.set_bearings(0, 0, 0)
            glyph.vertices = (0, 0, 0, 0)
            return glyph

        elif asc < 128:  # ASCII
            h = int(font.size * 4 / 3)
            w = h // 2
            w += 4
            h += 4
            datasz = int(ceil(w / 8.)) * h

            fontdata = L('c-font')['ASC%s' % suffix]
            loc = asc * datasz
            data = fontdata[loc:loc + datasz]
            i = Image.fromstring('1', (w, h), data).convert('L')
            bbox = i.getbbox()
            if bbox:
                adj = 2 - type  # normal = 0, thinshadow = 1, thickshadow = 2
                bbox = (bbox[0] - adj, 0, bbox[2] + adj, h)
                i = i.crop(bbox)
                w = bbox[2] - bbox[0]
            # else: space/return/etc..

        else:  # GBK
            w = h = int(font.size * 4 / 3) + 4
            datasz = int(ceil(w / 8.)) * h
            try:
                gbk = char.encode('gbk')
            except UnicodeEncodeError:
                gbk = u'⑨'.encode('gbk')
            rol = (256 + ord(gbk[0]) - 0x81) & 0xff
            col = (256 + ord(gbk[1]) - 0x40) & 0xff
            loc = rol * self.gbk_cols + col
            loc *= datasz
            fontdata = L('c-font')['GBK%s' % suffix]
            data = fontdata[loc:loc + datasz]
            i = Image.fromstring('1', (w, h), data).convert('L')

        ii = i
        if self.font.bold:
            ii = Image.new('L', (w, h))
            ii.paste(i, (1, 0))
            ii.paste(i, (0, 0), i)

        white = Image.new('L', ii.size, 255)
        final = Image.merge('RGBA', (white, white, white, ii))

        img = pyglet.image.ImageData(w, h, 'RGBA', final.tostring())
        glyph = self.font.create_glyph(img)
        glyph.set_bearings(2, -2, w - 4 + 1)
        t = list(glyph.tex_coords)
        glyph.tex_coords = t[9:12] + t[6:9] + t[3:6] + t[:3]
        glyph.character = char
        return glyph
Beispiel #24
0
def start_ui():
    # ATI workarounds
    import pyglet
    from pyglet import gl

    @hook(gl)
    def glDrawArrays(ori, *a, **k):
        from pyglet.gl import glBegin, glEnd, GL_QUADS
        glBegin(GL_QUADS)
        glEnd()
        return ori(*a, **k)

    # ---------------

    from client.ui.base import init_gui, ui_message

    init_gui()

    # This forces all game resources to initialize,
    # else they will be imported firstly by GameManager,
    # then resources will be loaded at a different thread,
    # resulting white planes.
    # UPDATE: no more threading now, but retain notice above.
    import client.ui.resource  # noqa
    import gamepack
    gamepack.init_ui_resources()
    '''
    from client.ui.resloader import Resource
    Resource.load_resources()
    '''
    from client.ui.resloader import L

    from client.ui.base.baseclasses import main_window
    main_window.set_icon(L('c-icon'))
    main_window.set_visible(True)

    # custom errcheck
    import pyglet.gl.lib as gllib

    import ctypes

    def my_errcheck(result, func, arguments):
        from pyglet import gl
        error = gl.glGetError()
        if error and error != 1286:
            # HACK: The 1286(INVALID_FRAMEBUFFER_OPERATION) error again!
            # This time I DIDN'T EVEN USE FBO! ATI!!
            msg = ctypes.cast(gl.gluErrorString(error), ctypes.c_char_p).value
            raise gl.GLException((error, msg))
        return result

    gllib.errcheck = my_errcheck
    # ------------------------------------

    from screens import UpdateScreen, ServerSelectScreen
    from client.core import Executive
    from options import options

    if options.fastjoin:
        sss = ServerSelectScreen()

        @gevent.spawn
        def func():
            from client.ui.soundmgr import SoundManager
            SoundManager.mute()
            gevent.sleep(0.3)
            sss.switch()
            gevent.sleep(0.3)
            Executive.connect_server(('127.0.0.1', 9999), ui_message)
            gevent.sleep(0.3)
            Executive.auth('Proton1', 'abcde')
            gevent.sleep(0.3)
            Executive.quick_start_game()
            gevent.sleep(0.3)
            Executive.get_ready()

    else:
        us = UpdateScreen()
        us.switch()

    # os.execv(sys.executable, [sys.executable] + sys.argv)

    # workaround for pyglet's bug
    if sys.platform == 'win32':
        import pyglet.app.win32
        pyglet.app.win32.Win32EventLoop._next_idle_time = None

    pyglet.app.run()