5月 2015

Cocos2d-x 3.6中的registerScriptKeypadHandler在Android真机上无法响应back键的问题

Cocos2d-x 3.6中使用Lua脚本作为主要开发语言,基于新的mvc框架,根据查到的响应安卓真机设备的返回按键back的方法,registerScriptKeypadHandler为Node下的注册按键事件侦听方法,新的框架中对此还进行了一次封装,在LayerEx.lua中的onKeypad实现,完成后的按键侦听代码如下:

function MyView:onKeypad(event)  
    if event == "backClicked" then
        -- back clicked!
    end
end
-- ...
function MyView:onCreate()
    display.newLayer()
        :onTouch(handler(self, self.onTouch))
        :onKeypad(handler(self, self.onKeypad))
        :addTo(self)
end

在Windows模拟器上测试时可以看到键盘上的任意键按下时都会触发这个回调函数,但是参数均为nil,读了一下源码发现在CCLuaEngine.cpp中的回调原生代码实现如下:
Continue reading…

OpenWRT软件包Makefile的recursive dependency问题

试验MT7620A路由器OpenWRT系统软件开发时遇到了如下的问题:

[admin@localhost OpenWrt-SDK-ramips-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2]$ make
Collecting package info: done
tmp/.config-package.in:7:error: recursive dependency detected!
tmp/.config-package.in:7: symbol PACKAGE_helloworld depends on PACKAGE_libpthread
Config-build.in:1745: symbol PACKAGE_libpthread is selected by PACKAGE_helloworld
#
# configuration written to .config
#
make[1] world
make[2] package/compile
make[3] -C package/helloworld compile
make[2] package/index

看意思是引用的libpthread导致了递归依赖问题,检查hellowolrd中的Makefile,Depends属性是这样设置的:
Continue reading…