Exemplo n.º 1
0
        filename['r'] = 'axio(%g,%g,%g)'%scale

if maptype is None:
    print 'ERROR: -x or -r required'
    print __doc__%sys.argv[0]
    sys.exit()

filename = '%(x)s-%(e)s-%(r)s'%filename

w = pyglet.window.Window(width=1, height=1, visible=False, alpha_size=8)

mw, mh = size
if maptype == 'recthex':
    m = gen_recthex_map([[{}]*mh]*mw, ch)
elif maptype == 'hex':
    m = gen_hex_map([[{}]*mh]*mw, ch)
else:
    m = gen_rect_map([[{}]*mh]*mw, cw, ch)
pxw = m.pxw
pxh = m.pxh
w.set_size(width=pxw, height=pxh)
w.set_visible()
r = pyglet.ext.scene2d.FlatView(0, 0, pxw, pxh, layers=[m])

class SaveHandler:
    def on_text(self, text):
        if text != 's': return pyglet.window.event.EVENT_UNHANDLED
        image = pyglet.image.BufferImage().get_raw_image()
        fn = filename + '.png'
        n = 1
        while os.path.exists(fn):
Exemplo n.º 2
0
        filename['r'] = 'axio(%g,%g,%g)' % scale

if maptype is None:
    print('ERROR: -x or -r required')
    print(__doc__ % sys.argv[0])
    sys.exit()

filename = '%(x)s-%(e)s-%(r)s' % filename

w = pyglet.window.Window(width=1, height=1, visible=False, alpha_size=8)

mw, mh = size
if maptype == 'recthex':
    m = gen_recthex_map([[dict()] * mh] * mw, ch)
elif maptype == 'hex':
    m = gen_hex_map([[dict()] * mh] * mw, ch)
else:
    m = gen_rect_map([[dict()] * mh] * mw, cw, ch)
pxw = m.pxw
pxh = m.pxh
w.set_size(width=pxw, height=pxh)
w.set_visible()
r = pyglet.ext.scene2d.FlatView(0, 0, pxw, pxh, layers=[m])


class SaveHandler:
    def on_text(self, text):
        if text != 's':
            return pyglet.window.event.EVENT_UNHANDLED
        image = pyglet.image.BufferImage().get_raw_image()
        fn = filename + '.png'
Exemplo n.º 3
0
        filename['r'] = 'axio(%g,%g,%g)' % scale

if maptype is None:
    print('ERROR: -x or -r required')
    print(__doc__ % sys.argv[0])
    sys.exit()

filename = '%(x)s-%(e)s-%(r)s' % filename

w = pyglet.window.Window(width=1, height=1, visible=False, alpha_size=8)

mw, mh = size
if maptype == 'recthex':
    m = gen_recthex_map([[dict()] * mh] * mw, ch)
elif maptype == 'hex':
    m = gen_hex_map([[dict()] * mh] * mw, ch)
else:
    m = gen_rect_map([[dict()] * mh] * mw, cw, ch)
pxw = m.pxw
pxh = m.pxh
w.set_size(width=pxw, height=pxh)
w.set_visible()
r = pyglet.ext.scene2d.FlatView(0, 0, pxw, pxh, layers=[m])


class SaveHandler:

    def on_text(self, text):
        if text != 's':
            return pyglet.window.event.EVENT_UNHANDLED
        image = pyglet.image.BufferImage().get_raw_image()