Home > Database > Mysql Tutorial > body text

sublime下用快捷键直接运行cocos2dx项目

WBOY
Release: 2016-06-07 15:49:46
Original
1368 people have browsed it

sublime 可以通过配置.sublime-build文件来构建编译选项或者执行外部脚本 项目是用lua开发的,所以需要经常在decode和sublime之间切换,后来想到一个办法就是通过python来启动项目,具体步骤如下: 以下为.sublime-build的代码,将其命名为带.sublime-build

sublime 可以通过配置.sublime-build文件来构建编译选项或者执行外部脚本

项目是用lua开发的,所以需要经常在decode和sublime之间切换,后来想到一个办法就是通过python来启动项目,具体步骤如下:

以下为.sublime-build的代码,将其命名为带.sublime-build后缀的名字,放在sublime user文件夹下,其中xx.py为python脚本的绝对路径

{
    "cmd": ["python", "-u", "xx.py"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.lua"
}

以下为python脚本启动项目的代码,其中xx.exe为执行文件exe相对于当前脚本目录的相对目录,同理xx/Resources也是相对目录

import ctypes

import os,sys

handler = None
operator = "open"
fpath = os.getcwd() + "xx.exe"
param = None
dirpath = os.getcwd() + "xx/Resources"
ncmd = 1
shell32 = ctypes.windll.LoadLibrary("shell32.dll")

shell32.ShellExecuteA(handler,operator,fpath,param,dirpath,ncmd)

这些工作完毕以后,就可以在sublime下打开lua文件,直接快捷键f7即可运行项目


sublime同样支持API提示和补全,具体请参看http://blog.csdn.net/wtyqm/article/details/9346863


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template