Пример #1
0
def run(target, *args, **options):
    global _terminating
    _terminating = False
    project = app.getProject()
    assert project.isLoaded()

    os.chdir(project.getBasePath())
    bin = project.getBinaryPath(app.getPlatformName() + '/moai')

    script = 'game/%s.lua' % target

    arglist = [bin, script]
    arglist += args
    returncode = 0
    try:
        pipeline = sarge.run(arglist, async=True)
        while True:
            time.sleep(0.05)
            command = pipeline.commands[0]
            returncode = command.poll()
            if returncode != None:
                break
            if _terminating:
                command.kill()
                returncode = -1
                break
        # pipeline.close()
        # returncode = command.poll()
    except Exception, e:
        logging.error('cannot start host: %s ' % e)
        return 1
Пример #2
0
def convertToPVR(src, dst=None, **option):
    if app.getPlatformName() == 'osx':
        arglist = [app.getPath('support/osx/pvrtc/texturetool')]

        arglist += [
            '-e',
            'PVRTC',
            '-f',
            'PVR',
            '--channel-weighting-linear',
        ]

        bbp = option.get('bbp', 4)
        if bbp == 4:
            arglist += ['--bits-per-pixel-4']
        else:
            arglist += ['--bits-per-pixel-2']

        if not dst:
            dst = src
        arglist += [
            '-o',
            dst,
            src,
        ]
        print('convert to pvr %s -> %s' % (src, dst))
        return subprocess.call(arglist)
    else:
        logging.error('not supported!')
Пример #3
0
def run( target, *args, **options ):
	global _terminating
	_terminating = False
	project = app.getProject()
	assert project.isLoaded()

	os.chdir( project.getBasePath() )
	bin = project.getBinaryPath( app.getPlatformName() + '/moai' )

	script = 'game/%s.lua' % target
	
	arglist = [
		bin,
		script
	]
	arglist += args
	returncode = 0
	try:
		pipeline = sarge.run( arglist, async = True )
		while True:
			time.sleep( 0.05 )
			command = pipeline.commands[0]
			returncode = command.poll()
			if returncode != None:
				break
			if _terminating:
				command.kill()
				returncode = -1
				break
		# pipeline.close()
		# returncode = command.poll()
	except Exception, e:
		logging.error( 'cannot start host: %s ' % e)
		return 1
Пример #4
0
def _getLuajitBinPath():
    platformName = app.getPlatformName()
    if platformName == 'osx':
        return app.getNativeSupportPath('luajit/luajit')
    elif platformName == 'windows':
        return app.getNativeSupportPath('luajit/luajit.exe')
    else:
        return 'luajit'
Пример #5
0
def convertToWebP(src, dst=None, **option):
    if app.getPlatformName() == 'osx':
        cwebp = app.getNativeSupportPath('webp/cwebp')
    elif app.getPlatformName() == 'windows':
        cwebp = app.getNativeSupportPath('webp/cwebp.exe')

    arglist = [
        cwebp, '-quiet'
        # '-hint', 'photo'
    ]
    quality = option.get('quality', 100)
    if quality == 'lossless':
        arglist += ['-lossless']
    else:
        arglist += ['-q', str(quality)]
    if not dst:
        dst = src
    arglist += [src, '-o', dst]

    # print 'convert to webp %s -> %s' % ( src, dst )
    # if src == dst: return #SKIP
    return subprocess.call(arglist)