首页 \ 问答 \ 新人问个问题 关于cocos2d-x的

新人问个问题 关于cocos2d-x的

cocos2d-x 做的游戏是不是也可以在WindowsPhone上运行啊?
更新时间:2023-08-13 19:08

最满意答案

还可以使用Cython来实现混编
1 下载Cython,用Python setup.py install进行安装
2 一个实例

① 创建helloworld目录创建helloworld.pyx,内容如下:cdef extern from"stdio.h":    extern int printf(const char *format, ...) def SayHello():    printf("hello,world\n")
② 编译,最方便的是利用python的Distutils了,
helloworld目录下创建Setup.py,内容如下:from distutils.core import setupfrom distutils.extension import Extensionfrom Cython.Build import cythonize setup(  name = 'helloworld',  ext_modules=cythonize([    Extension("helloworld", ["helloworld.pyx"]),    ]),) 编译:python Setup.py build安装:python Setup.py install安装后,会将在build/lib.???目录下生成的helloworld.pyd拷贝到Lib/site-packages注:  有时我们只是希望测试一下,并不希望安装,这时可以把build/lib.???目录下的helloworld.pyd拷贝到当前目录  或者在importhelloworld前执行脚本:import sys;sys.path.append(pathof helloworld.pyd) ③ 测试:>>>import helloworld >>>helloworld.SayHello() hello,world

其他回答

期待看到有用的回答!

相关问答

更多
  • 还可以使用Cython来实现混编 1 下载Cython,用Python setup.py install进行安装 2 一个实例 ① 创建helloworld目录创建helloworld.pyx,内容如下:cdef extern from"stdio.h": extern int printf(const char *format, ...) def SayHello(): printf("hello,world\n") ② 编译,最方便的是利用python的Distutils了, helloworld目录下 ...
  • 基本上我有3个文件夹: CPROJECT ,C ++库:生成一个libcproject.so共享对象 CYPROJECT ,Cython化的Python扩展:使用Cython生成cyproject.so DEPENDENCIES ,依赖关系:我复制这两个项目的外部需求 在1.我构建了C ++扩展(使用gcc -shared , -fPIC编译选项编译),这些扩展将暴露给python,并且CYPROJECT依赖于向Python公开特性。 作为后处理命令,生成的.so被复制到DEPENDENCIES/libcp ...
  • 就个人而言,我会使用classmethods。 WrapperClass.fromSpambar(spambar) 这不是puzzlin imho 。 如果你不能在C ++中重载函数,你也需要回退到这种方法。 如果您可以在初始化时接受一些重加权操作,则可以通过定义“模式”或类似方法来实现一种方法来识别构造函数的调用方式。 即args和kwargs的正则表达式。 ;) 我没有看到从Python对象获取thisptr的问题。 cdef WrapperClass wrpclsi if isinstance(in ...
  • 事实证明,即使你需要在一个地方初始化Python,Cython也必须在很多地方初始化。 你需要在OpenCog的情况下调用Cython生成的导入函数: import_opencog__atomspace(); 和 import_opencog__agent_finder(); 在每个单独的共享库中 ,它将在Cython代码中声明的函数调用为“api”。 否则,在该共享库中第一次调用该函数时会出现崩溃。 正如您在上面所看到的,SIGSEGV不会留下有用的堆栈跟踪。 它只是两个汇编指令和繁荣,寄存器相对ca ...
  • 这一行中的问题: self.c_nodegraph_dbreader = RtlNodeGraphDBReader() 如果你只是想要一个默认构造的实例,你已经有了,没有这条线。 通过添加这一行,你明确地构造了第二个这样的实例,然后将它复制到原始文件中,并且......我不确定这是如何工作的,但我猜测是自动生成的拷贝构造函数正在调用默认构造函数第三次。 The problem in this line: self.c_nodegraph_dbreader = RtlNodeGraphDBReader() ...
  • 我不承诺这是唯一的问题,但这肯定是一个问题: cameraRemovalCallback是一个cdef函数。 这意味着该函数可以从C / Cython中纯粹访问,但不能从Python访问。 这意味着PyObject_GetAttrString失败(因为cameraRemovalCallback不是Python属性)。 您应该使用def而不是cdef定义cameraRemovalCallback ,并且可以通过普通的Python机制访问它。 您还应该检查PyObject_GetAttrString的结果 - ...
  • C ++ std::list s是双向链表(即每个元素都有一个指向下一个和前一个的指针),这使得添加/插入元素变得高效,但这意味着Cython或C ++都不支持索引。 相反,你应该使用迭代器协议: # at top of file from cython.operator import dereference, preincrement # in function cdef cpplist[int].iterator it it = arr.begin() for j in range(row): ...
  • 非常感谢,swenzel! 现在,它的作品! rect.pyx # distutils: language = c++ # distutils: sources = Rectangle.cpp cdef extern from "Rectangle.h" namespace "shapes": cdef cppclass Rectangle: Rectangle(int, int, int, int) except + int x0, y0, x1, y1 ...
  • 答案是使用“公共扩展类型” (特别是“公共扩展类型”)。 一个简单的例子是: cdef extern from "cpp_file.hpp": void modifyMyClass(MyClass) cdef public class MyClass [object TheNameThisWillHaveInC, type TheNameTheTypeWillHaveInC]: cdef int a cdef int b def example(): cdef MyCla ...
  • 我找到了简单的解决方案! 例如,在C ++头文件中,您可以声明一个typedef typedef Vector; Vector3f; 在你的cython文件中,你可以声明它,现在你可以使用类中的所有函数和运算符。 cdef extern from "Vector.h" namespace "ns": cdef cppclass Vector3f: 现在,我有一个额外的问题,那就是“专门”的功能,在我的例子中是一个带有3个参数的Vector的专门化。 template

相关文章

更多

最新问答

更多
  • python的访问器方法有哪些
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。
  • 响应navi重叠h1和nav上的h1链接不起作用(Responsive navi overlaps h1 and navi links on h1 isn't working)
  • 在C中读取文件:“r”和“a +”标志的不同行为(Reading a File in C: different behavior for “r” and “a+” flags)
  • NFC提供什么样的带宽?(What Kind of Bandwidth does NFC Provide?)
  • 元素上的盒子阴影行为(box-shadow behaviour on elements)
  • Laravel检查是否存在记录(Laravel Checking If a Record Exists)
  • 设置base64图像的大小javascript - angularjs(set size of a base64 image javascript - angularjs)
  • 想学Linux 运维 深圳有哪个培训机构好一点
  • 为什么有时不需要在lambda中捕获一个常量变量?(Why is a const variable sometimes not required to be captured in a lambda?)
  • 在Framework 3.5中使用服务器标签<%=%>设置Visible属性(Set Visible property with server tag <%= %> in Framework 3.5)
  • AdoNetAppender中的log4net连接类型无效(log4net connection type invalid in AdoNetAppender)
  • 错误:发送后无法设置标题。(Error: Can't set headers after they are sent. authentication system)
  • 等待EC2实例重启(Wait for an EC2 instance to reboot)
  • 如何在红宝石中使用正则表达式?(How to do this in regex in ruby?)
  • 使用鼠标在OpenGL GLUT中绘制多边形(Draw a polygon in OpenGL GLUT with mouse)
  • 江民杀毒软件的KSysnon.sys模块是什么东西?
  • 处理器在传递到add_xpath()或add_value()时调用了什么顺序?(What order are processors called when passed into add_xpath() or add_value()?)
  • sp_updatestats是否导致SQL Server 2005中无法访问表?(Does sp_updatestats cause tables to be inaccessible in SQL Server 2005?)
  • 如何创建一个可以与持续运行的服务交互的CLI,类似于MySQL的shell?(How to create a CLI that can interact with a continuously running service, similar to MySQL's shell?)
  • AESGCM解密失败的MAC(AESGCM decryption failing with MAC)
  • SQL查询,其中字段不包含$ x(SQL Query Where Field DOES NOT Contain $x)
  • PerSession与PerCall(PerSession vs. PerCall)
  • C#:有两个构造函数的对象:如何限制哪些属性设置在一起?(C#: Object having two constructors: how to limit which properties are set together?)
  • 平衡一个精灵(Balancing a sprite)
  • n2cms Asp.net在“文件”菜单上给出错误(文件管理器)(n2cms Asp.net give error on Files menu (File Manager))
  • Zurb Foundation 4 - 嵌套网格对齐问题(Zurb Foundation 4 - Nested grid alignment issues)
  • 湖北京山哪里有修平板计算机的