首页 技术 正文
技术 2022年11月19日
0 收藏 526 点赞 2,770 浏览 2426 个字

1.安装Kanzi。

2.使用Kanzi studio创建工程。

Kanzi创建的工程会包含以下目录结构:

Kanzi入门

其中,

Tool_project文件夹中存放的是设计师设计的工程,包含kanzi UI的工程的所有文件。

Application文件夹则为代码的工程文件夹。该文件夹下的bin文件夹存放设计师导出的kzb文件,src文件夹存放编写的代码,config里面存放对应的vs、vc、eclipse工程文件。

UI设计师和软件工程师通过bin目录下的kzb资源文件联系起来。UI设计师通过kanzi studio设计工具导出kzb资源文件到该目录,而软件工程师使用engine读取该kzb文件创建界面,监听点击事件,传递数据,实现具体功能。

【设计师设计部分】可以通过以下视频教程进行学习。

http://v.ku6.com/show/eHuNhYr8nd4S7gY7jpwahg…html?st=3_1_2

http://v.17173.com/so-index.html?key=kanzi

http://v.youku.com/v_show/id_XNjU5MTI2ODE2.html?from=y1.7-1.2

【软件工程师编程部分】

1.对于2.8.x版本:

刚创建的Kanzi工程有两个函数,其中kzApplicationConfigure为整个程序的入口,相当于main函数(kanzi把main函数封装在库中了,只提供kzApplicationConfigure出来,kzApplicationConfigure会在创建窗口之前回调)。

如下:

 /**
* A typical application configuration function.
*/
KZ_CALLBACK void kzApplicationConfigure(const struct KzaSystemProperties* systemPropert
ies, struct KzaApplicationProperties* configuration)
{
/* Memory reserved for the application. */
configuration->memoryPoolSize = * * ; //设置使用内存的大小,默认20Mb
configuration->binaryName = "binaries.cfg"; //设置读取kzb的配置文件 /* Platform specific configuration parameters. */
#if defined WIN32 || defined __linux__
configuration->windowProperties.style = KZS_WINDOW_STYLE_DEFAULT;
configuration->windowProperties.width = ;
configuration->windowProperties.height = ;
#endif /* List of available entry points implemented. Implementation is optional. */
/* Application lifetime. */
configuration->onStartup = startup;
configuration->onProjectLoaded = projectLoaded;
configuration->onShutdown = shutdown; /* Application events. */
configuration->onApplicationEvent = applicationEventHandler;
configuration->onWindowEvent = windowEventHandler; /* Input events. */
configuration->onKeyInputEvent = keyInputEventHandler;
configuration->onPointerInputEvent = pointerInputEventHandler; /* Render cycle. */
configuration->onPreRender = preRender;
configuration->onPostRender = postRender;
configuration->onUpdate = update;
}

kzApplicationConfigure函数中可做app的配置,设置内存池大小、窗口大小、窗口类型等,

另外就是在里面注册回调函数,如

configuration->onPostRender = postRender;
为注册每一帧渲染后的回调函数。

2.对于3.2版本则改成了c++的风格,如下:

 #include <kanzi/kanzi.hpp> class NApplicaiton : public ExampleApplication
{
protected:
virtual void onConfigure(ApplicationProperties& configuration) KZ_OVERRIDE; virtual void onProjectLoaded() KZ_OVERRIDE; virtual void onShutdown() KZ_OVERRIDE; virtual void onKeyInputEvent(const KzsInputEventKey* inputData) KZ_OVERRIDE; private:
NApplicaiton();
~NApplicaiton(); }; Application* createApplication()
{
return new NApplicaiton();
}

之前在2.8.x版本中的 注册回调函数的方式在3.2版本换成了 重写ExampleApplication的虚函数,其作用还是一样的。同样onProjectLoaded会在资源加载完成后背调用。


    					
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,942
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,468
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,281
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,095
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,728
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,765