
cocos2d-x
缓行者
这个作者很懒,什么都没留下…
展开
-
Android Cocos2d-x酱油笔记之cocos2d-x Cygwin编译 recipe for target `obj/**/XX.so' fail解决办法
在使用cygwin交叉编译cocos2d-x的工程文件时,明明工程没有其他错误,但有时还是会出现 recipe for target `obj/**/XX.so' fail之类的错误初入门时,遇到这些东西,常常无法适应,其实,这是由于NDK版本和cygwin版本的问题cygwin官方使用的ndk版本有时会低于现在的ndk最新版本解决这个问题,我们可以在该工程的/proj.andro原创 2013-02-23 12:31:15 · 960 阅读 · 0 评论 -
【cocos2d-x 3.5】简单Lua 热更新
local title = root:getChildByName("Text")local function onError(errorCode) if errorCode == cc.ASSETSMANAGER_NO_NEW_VERSION then title:setString("no new version") elseif errorCode =原创 2015-05-19 21:49:07 · 4752 阅读 · 1 评论 -
【cocos2d-x3.5】Lua定时器Schedule
1local scheduler = cc.Director:getInstance():getScheduler()local schedulerID = nilschedulerID = scheduler:scheduleScriptFunc(function() print("Hello")end,0,false)原创 2015-05-09 12:29:57 · 16908 阅读 · 0 评论 -
【coocs2d-x 3.5】Lua 精灵触摸
local function onTouchBegan(touch, event) local s = map[1][1]:getSprite():getContentSize() local px = map[1][1]:getSprite():getPositionX() local py = map[1][1]:getSprite():getPositionY()原创 2015-05-07 13:05:42 · 1138 阅读 · 0 评论 -
【cocos2d-x 3.5】Lua触摸事件
local listenner = cc.EventListenerTouchOneByOne:create()listenner:registerScriptHandler(function(touch, event) local location = touch:getLocation() print("onTouch") return true end, cc原创 2015-05-03 00:41:11 · 3977 阅读 · 0 评论 -
【cocos2d-x 3.5】Lua的简单面向对象
Lua的面向对象实现和元表metatable有关,下面给出2种代码1.Lua实现local Test = {}Test .__index = TestTest.A = 0function Test :create(a) local tb = {} setmetatable(tb,Test ) tb.A = a return tbendfunc原创 2015-05-07 01:26:22 · 653 阅读 · 0 评论 -
【cocos2d-x 3.5】Lua 加载cocostudio的PageView
local pageView = panel_main:getChildByName("PageView_1")local function pageViewEvent(sender, eventType) if eventType == ccui.PageViewEventType.turning then local pageView = sender原创 2015-05-14 01:49:28 · 3518 阅读 · 0 评论 -
【cocos2d-x3.5】Lua Plist与SpriteFrameCache
display.loadSpriteFrames("BlockPlist.plist", "BlockPlist.png")local sp = display.newSprite("#block/b_0.png", 100, 100)self:addChild(sp)注:1.由源代码可得display.newSprite的参数加#是由createWithSpriteFrame原创 2015-05-05 02:41:46 · 3151 阅读 · 0 评论 -
【cocos2d-x 3.5】Lua读取CSV
1.CSV数据如下ID Name Value1 Hello 4562 Li 4233 Mei 4562.编写CSLoader工具local CSVLoader = cl原创 2015-05-05 15:41:06 · 1583 阅读 · 0 评论 -
【cocos2d-x 3.5】Lua Json使用
local str = json.encode({a=50,b="ok",c={c1=8,c2="abc"},d={10,11},100})print(str)local tb = json.decode(str)print(tb["b"])print(tb["c"]["c2"])原创 2015-05-05 12:09:06 · 3056 阅读 · 0 评论 -
【cocos2d-x 3.5】 Lua Button
1.添加监听事件local function onTouch() print("Hello") end原创 2015-05-04 17:15:19 · 2980 阅读 · 1 评论 -
【cocos2d-x 3.5】Lua Action相关
1.组合动作local move = cc.MoveTo:create(0.5,cc.p(v:getPositionX(),v:getPositionY()+SPACE))local seq = cc.Sequence:create(move,cc.CallFunc:create(function(node) if node:getPositionY() > size.height原创 2015-05-03 17:30:10 · 837 阅读 · 0 评论 -
【cocos2d-x 3.5】C++物理引擎
1.创建一个物理sceneScene* HelloWorld::createScene(){ auto scene = Scene::createWithPhysics(); auto layer = HelloWorld::create(); scene->addChild(layer); return scene;}2.创建一个世界Siz原创 2015-05-02 21:01:17 · 1477 阅读 · 0 评论 -
【cocos2d-x 3.5】Lua动画API
1.加载动画local roleAction = cc.CSLoader:createTimeline("Hero.csb")2.节点连接动画(不是播放,别问我why)node:runAction(roleAction)3.播放动画1)roleAction:play(animationName, true) //动画的名字,是否循环2)roleAction:goto原创 2015-04-27 21:58:08 · 8050 阅读 · 0 评论 -
【cocos2d-x 3.5】Lua 退出游戏
cc.Director:getInstance():endToLua()原创 2015-05-09 12:31:26 · 5143 阅读 · 1 评论 -
【cocos2d-x 3.5】Lua常见UI的代码实现
1.Labellocal label = cc.Label:create()label:setString('abc Label From Lua') -- 设置 label 的文本内容。label:setSystemFontSize(24) -- 设置 label 字体大小。label:setPosition(200, 500) -- 设置 label 的位置。label:setNa原创 2015-04-27 16:49:36 · 1953 阅读 · 0 评论 -
cocos2d-x酱油笔记之获取系统时间
struct tm *tm; time_t timep; time(&timep); tm = localtime(&timep); int year = tm->tm_year + 1900; int month = tm->tm_mon + 1; int day = tm->tm_mday; int hour=tm->tm_hour; int minute=tm原创 2014-01-08 22:50:49 · 632 阅读 · 0 评论 -
【cocos2d-x 3.5】Lua与C++简单交互
(一)lua调用C1)在VS工程中编写下面两个文件2)在VS的AppDelegate.cpp中做如下修改① 引入头文件#include"LuaTools.h"② 在applicationDidFinishLaunching方法中添加代码LuaStack* stack = LuaEngine::getInstance()->getLuaStack();lua_State原创 2015-05-19 22:03:33 · 1700 阅读 · 0 评论