예제 #1
0
 def load(self, loader):
     atlas = get_atlas()
     white = atlas.add(pyglet.image.ImageData(4, 4, 'RGBA', '\xFF'*64))
     c = white.tex_coords
     f = c[0:3]; t = c[6:9]
     white.tex_coords = ((f[0] + t[0]) / 2, (f[1] + t[1]) / 2, 0) * 4
     return white
예제 #2
0
def white(path):
    atlas = get_atlas()
    white = atlas.add(pyglet.image.ImageData(4, 4, "RGBA", "\xFF" * 64))
    c = white.tex_coords
    f = c[0:3]
    t = c[6:9]
    white.tex_coords = ((f[0] + t[0]) / 2, (f[1] + t[1]) / 2, 0) * 4
    return white
예제 #3
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()
예제 #4
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()
예제 #5
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()
예제 #6
0
# -*- coding: utf-8 -*-

# -- stdlib --
import re

# -- third party --
# -- own --
from client.ui.resloader import get_atlas, inventory

# -- code --
import gamepack.thb.ui.ui_meta  # noqa

get_atlas('portrait', (1024, 2048))

inventory.extend([(re.compile('^%s$' % pat), ldr) for pat, ldr in (
    ('thb-bgm_game',               ['bgm']),

    ('thb-modelogo-[a-z0-9_]+',    ['img']),

    ('thb-(win|lose)',             ['img']),

    ('thb-hurt',                   ['anim', [50, 50, 50, 50, 200, 30, 30, 30, 30, 2000]]),

    ('thb-card-[a-z0-9_]+',        ['img', 'card']),
    ('thb-card-small-[a-z0-9_]+',  ['img', 'card']),

    ('thb-cardnum',                ['img_grid', 2, 13, 'card']),  # FIXME: Screw this, meta should not be kept here
    ('thb-(small)?suit',           ['img_grid', 1, 4,  'card']),
    ('thb-smallnum',               ['img_grid', 2, 14, 'card']),

    ('thb-tag-sealarray',          ['anim', [83] * 36,  True]),
예제 #7
0
# -*- coding: utf-8 -*-

# -- stdlib --
import re

# -- third party --
# -- own --
from client.ui.resloader import get_atlas, inventory

# -- code --
import thb.ui.ui_meta  # noqa

get_atlas('portrait', (1024, 2048))

inventory.extend([(re.compile('^%s$' % pat), ldr) for pat, ldr in (
    ('thb-bgm_game',               ['bgm']),

    ('thb-modelogo-[a-z0-9_]+',    ['img']),

    ('thb-(win|lose)',             ['img']),

    ('thb-hurt',                   ['anim', [50, 50, 50, 50, 200, 30, 30, 30, 30, 2000]]),

    ('thb-card-[a-z0-9_]+',        ['img', 'card']),
    ('thb-card-small-[a-z0-9_]+',  ['img', 'card']),

    ('thb-cardnum',                ['img_grid', 2, 13, 'card']),  # FIXME: Screw this, meta should not be kept here
    ('thb-(small)?suit',           ['img_grid', 1, 4,  'card']),
    ('thb-smallnum',               ['img_grid', 2, 14, 'card']),

    ('thb-tag-sealarray',          ['anim', [83] * 36,  True]),
예제 #8
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()
예제 #9
0
# -*- coding: utf-8 -*-

# -- stdlib --
import re

# -- third party --
# -- own --
from client.ui.resloader import get_atlas, inventory

# -- code --
import thb.ui.ui_meta  # noqa

get_atlas("portrait", (1024, 2048))

inventory.extend(
    [
        (re.compile("^%s$" % pat), ldr)
        for pat, ldr in (
            ("thb-bgm_game", ["bgm"]),
            ("thb-modelogo-[a-z0-9_]+", ["img"]),
            ("thb-(win|lose)", ["img"]),
            ("thb-hurt", ["anim", [50, 50, 50, 50, 200, 30, 30, 30, 30, 2000]]),
            ("thb-card-[a-z0-9_]+", ["img", "card"]),
            ("thb-card-small-[a-z0-9_]+", ["img", "card"]),
            ("thb-cardnum", ["img_grid", 2, 13, "card"]),  # FIXME: Screw this, meta should not be kept here
            ("thb-(small)?suit", ["img_grid", 1, 4, "card"]),
            ("thb-smallnum", ["img_grid", 2, 14, "card"]),
            ("thb-tag-sealarray", ["anim", [83] * 36, True]),
            ("thb-tag-wine", ["anim", [150] * 3, True]),
            ("thb-tag-lunadial", ["anim", [200] * 10, True]),
            ("thb-tag-books", ["img_grid", 1, 7]),