自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(44)
  • 收藏
  • 关注

原创 【quick】quick-cocos2d-x导入sproto并重新编译player

Windows系统下。quick-cocos2d-x-master因为一些原因要使用sproto,所以需要导入sproto并编译一个新的player。1、获取sproto。这里你可以选择在github搜索skynet项目,然后在\lualib-src下sproto文件夹即是。你也可以在github搜索sproto项目,这个是带有例子的。2、将sproto文件夹拷贝到\lib\coc

2016-02-21 16:26:38 3256 1

原创 【quick遇到的陷阱】node的onExit()和onEnter()

事情是这样的,我想让继承自node的类能在正确的时刻调用onExit()函数,那我们开始吧。创建了个空项目,然后MainScene.lua弄成下面的样子,嗯,去掉了label然后在加了几个打印函数。--MainScene.lualocal MainScene = class("MainScene", function() return display.newScene("M

2016-01-14 01:21:37 2969

原创 【quick遇到的陷阱】lua 全局

lua没有所谓私有共有(当然这个是可以实现的),但是有全局和局部,但是这两对可一点都不像。---------------------------全局帧事件我们想使用update(),很好,quick有给我们封装好了。在framework\scheduler.lua中--[[计划一个全局帧事件回调,并返回该计划的句柄。全局帧事件在任何场景中都会执行,因此可以在整个应用程序范围内实现较

2016-01-06 00:28:54 1251

原创 【quick】这篇就当作日记吧

出来实习了,找了一下手游公司。手游部呢,是纯lua开发的,好吧夸张了,服务器是skynet,客户端是quick-cocos2dx-master(2.2.6)。程序猿的生活确实,如传闻中,加班不停息。虽然公司没有要求实习生加班,不过我是外省(相对于公司而言)的,所以我不上班就是回出租屋闷着,那就来咯。lua这语言挺好玩的,自由到自己都忘了约束了,就好像读了大学,自由到堕落一样。今天跟舍友聊了

2016-01-05 23:18:29 456

原创 【cocos2dx】改安装包名、app名、图标、包名

CocosFramework-3.5 & Cocos-2.2.6 (注意不是cocos2d-x-2.2.6,也没有eclipse) 修改安装包名字项目路径\proj.android\build.xml 修改游戏名/程序名项目路径\proj.android\res\value\strings.xml程序名 修改程序图标项目路径\proj.android\r

2015-11-13 18:17:06 10213

原创 【cocos2dx】监听安卓机的返回键

在玩cocos2d-x的时候,每次真机实测,都要按home键来‘退出’游戏,因为没有监听返回键,这让我想起了某个版本的手机QQ,也是没有监听返回键来着。来简单写一下cocos2d-x监听安卓的返回键。 简单的用helloworld项目来实验首先在.h文件覆盖onKeyReleased函数。 virtual void onKeyReleased(EventKeyboard::Ke

2015-11-10 21:59:04 4020

原创 【leetcode c++】160 Intersection of Two Linked Lists

Intersection of Two Linked Lists Write a program to find the node at whichthe intersection of two singly linked lists begins.For example, the following two linkedlists:begin to intersect

2015-10-09 17:59:06 496

原创 【leetcode c++】155 Min stack

Min stackDesign a stack that supports push, pop,top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack.pop() -- Removes the element on top of thestack.

2015-10-09 17:55:04 723

原创 【leetcode c++】125 Valid Palindrome

Valid Palindrome Given a string, determine if it is apalindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a plan, a canal: Panama" isa palindrome."r

2015-10-09 17:38:52 621

原创 【leetcode c++】118 Pascal's Triangle

Pascal's Triangle Given numRows, generate the first numRowsof Pascal's triangle.For example, given numRows = 5,Return返回如图示形式的杨辉三角二维数组。数据结构肯定做过的。用二维数组保存的杨辉三角可以是像题目要求那样构造,如下11   11  

2015-10-09 17:36:50 465

原创 【cocos2dx】卡牌记忆游戏(3)——优化杂谈

这里,游戏就做好了,我们跑起来是可以玩的,不过调试的时候发现左下角有不和谐的信息。GL calls太多了。达到了38。当然这只是相对大小,38并不大,因为一些例子效果的GL calls本身就很大了。我们可以分析一下这些次数哪里来。数了一下,还真的有38次。接下来,我们来优化一下。我们可以想到的是,用texturePacker来打包碎图如果这样做的话,我们

2015-10-09 17:32:29 1190

原创 【cocos2dx】卡牌记忆游戏(2)——游戏场景

首先,我们需要触摸事件,其次,我们要给游戏计时,因为时间要刷新,我们还需要update函数。计时功能我们写了一个计时器的类,所以有个计时器成员。游戏场景里要装有若干卡片,为了能够获取他们,我们需要一个成员容器来容纳这些卡片。另外一些声明看下述不完整代码。using namespacecocos2d;class ActionScene: public Layer{public: b

2015-10-09 17:22:27 1483 1

原创 【cocos2dx】卡牌记忆游戏(1)——卡牌类

唔,做个简单的卡牌游戏吧,叫做记忆大考验。游戏模仿自【冒险岛OL】 。嗯,我也是老岛民了,不过已经肝不动了。游戏大概是这样子戏规则很简单,有若干张卡片,每次翻到两张相同的就能翻出卡牌,翻出所有卡牌则结束。那么问题来了,我们要一个卡牌(类),而且能让它翻转。我们先找找精灵的翻转效果。很幸运,cocos2dx里面有个RotateTo和RotateBy类。RotateTo

2015-10-09 17:15:33 3001

原创 【cocos2dx】成员精灵(组合)的getboundingbox问题

首先,我设定读者们都对cocos2dx的坐标系有一定的了解了。没有的话,给个官方文档的链接,讲得比较明白http://www.cocos.com/doc/article/index?type=cocos2d-x&url=/doc/cocos-docs-master/manual/framework/native/v3/coordinate-system/zh.md好了,现在都了解了

2015-09-12 17:41:44 8921 2

原创 【leetcode c++】113 Path Sum II

Path Sum IIGiven a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree and sum = 22,ReturnPa

2015-08-01 00:06:17 1271

原创 【leetcode c++】 112 Path Sum

Path Sum Given a binary tree and a sum, determine ifthe tree has a root-to-leaf path such that adding upall the values along the path equals the given sum.For example:Given the below binary tr

2015-07-31 23:27:31 594

原创 【leetcode c++】111 Minimum Depth of Binary Tree

Minimum Depth of Binary Tree Given a binary tree, find its minimumdepth.The minimum depth is the number of nodesalong the shortest path from the root node down to the nearest leaf node. 之前做了

2015-07-31 23:23:17 324

原创 【leetcode c++】107 Binary Tree Level Order Traversal II

Binary Tree Level Order Traversal II Given a binary tree, return the bottom-uplevel order traversal of its nodes' values. (ie, from left to right, level bylevel from leaf to root).For example:

2015-07-27 14:46:14 440

原创 【leetcode c++】104 Maximum Depth of Binary Tree

Maximum Depth of Binary Tree Given a binary tree, find its maximumdepth.The maximum depth is the number of nodesalong the longest path from the root node down to the farthest leaf node. 给一棵二

2015-07-27 14:43:08 414

原创 【leetcode c++】102 Binary Tree Level Order Traversal

Binary Tree Level Order TraversalGiven a binary tree, return the level ordertraversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree {3,9,20,#,#,15,

2015-07-27 14:41:16 464

原创 【leetcode c++】101 Symmetric Tree

Symmetric TreeGiven a binary tree, check whether it is amirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric:But the following is not:我相信大家都愿

2015-07-27 14:39:02 908

原创 【leetcode c++】100 Same Tree

Same Tree Given two binary trees, write a function tocheck if they are equal or not.Two binary trees are considered equal ifthey are structurally identical and the nodes have the same value. 

2015-07-27 14:34:06 559

原创 【leetcode c++】88 Merge Sorted Array

Merge Sorted ArrayGiven two sorted integer arrays nums1 andnums2, merge nums2 into nums1 as one sorted array. Note:You may assume that nums1 has enough space(size that is greater or equal to m

2015-07-27 14:27:46 1279

原创 单向链表删除节点

单向链表删除节点的一个技巧,这个是在《编程之美》上面看到的,可以用来对付一些算法题。************************************************************************有时候会遇到这种情况,单链表提供一个指针,要求要删除指针指向的节点。如下考虑到释放内存,还再需要一个指针******************

2015-07-24 13:17:37 1184

原创 【leetcode c++】82 Remove Duplicates from Sorted List II

Remove Duplicates from Sorted List IIGiven a sorted linked list, delete allnodes that have duplicate numbers, leaving only distinct numbers from theoriginal list. For example,Given1->2->3->3->

2015-07-17 23:16:11 497

原创 【leetcode c++】83 Remove Duplicates from Sorted List

Remove Duplicates from Sorted ListGiven a sorted linked list, delete allduplicates such that each element appear only once. For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return

2015-07-17 23:11:35 390

原创 【leetcode c++】80 Remove Duplicates from Sorted Array II

临近期末,转移战场,考完回家,家里怒报驾校,应接不暇。进正题Remove Duplicates from Sorted Array IIFollow up for "RemoveDuplicates":What if duplicates are allowed at mosttwice?For example,Given sorted array nums = [1,1,

2015-07-17 22:54:02 536

原创 【leetcode c++】70 Climbing Stairs

Climbing StairsYou are climbing a stair case. It takes nsteps to reach to the top.Each time you can either climb 1 or 2steps. In how many distinct ways can you climb to the top? 高考毒太深,我当作一道{普通

2015-06-30 12:31:56 445

原创 【leetcode c++】67 Add Binary

Add BinaryGiven two binary strings, return their sum(also a binary string). For example,a = "11"b = "1"Return "100".            二进制大家都知道,这题要求我们给定两个string形式的二进制数字,要我们做加法并返回一个string。有看

2015-06-30 12:09:10 653

原创 【leetcode c++】66 Plus One

Plus OneGiven a non-negative number represented asan array of digits, plus one to the number.The digits are stored such that the mostsignificant digit is at the head of the list. 一个数字按位存放在一个数组

2015-06-26 22:44:35 369

原创 【leetcode c++】58 Length of Last Word

Length of Last WordGiven a string s consists ofupper/lower-case alphabets and empty space characters ' ', return the length oflast word in the string.If the last word does not exist, return 0.

2015-06-26 22:42:25 354

原创 【leetcode c++】38 Count and Say

Count and SayThe count-and-say sequence is the sequenceof integers beginning as follows:1, 11, 21, 1211, 111221, ... 1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is r

2015-06-26 22:40:33 612

原创 【leetcode c++】28 Implement strStr()

Implement strStr().Returns the index of the first occurrenceof needle in haystack, or -1 if needle is not part of haystack. 实现子字符串查找功能。犹记得清华大学出版社的数据结构书上,那神奇的KMP算法……KMP请自行百度。这里我用了BM算法(只用到了d

2015-06-26 22:30:48 344

原创 【leetcode c++】27 Remove Element

Remove ElementGiven an array and a value, remove allinstances of that value in place and return the new length.The order of elements can be changed. Itdoesn't matter what you leave beyond the new

2015-06-22 00:48:04 813

原创 【leetcode c++】26 Remove Duplicates from Sorted Array

Given a sorted array, remove the duplicatesin place such that each element appear only once and return the new length. Do not allocate extra space for anotherarray, you must do this in place with

2015-06-20 18:46:19 426

原创 【leetcode c++】21 Merge Two Sorted Lists

Merge two sorted linked lists and return itas a new list. The new list should be made by splicing together the nodes ofthe first two lists.融合两个有序的链表,返回这个新链表。 其实呢,这也是数据结构里面的链表的题(类似多项式的加法),不过稍微比当年

2015-06-18 13:37:28 993

原创 【leetcode c++】 20 Valid Parentheses

括号匹配。这题,是大学数据结构的题目吧,栈的题目吧(还有魔王语言、迷宫等,有木有)。因为是写过的题目,所以这次直接在leetcode的网页上面写了。还好还记住了思路,一次过~~ Leetcode的Accepted Solutions Runtime Distribution(2015-06-05) 源码:bool isValid(string s){ stack myStac

2015-06-18 13:31:38 352

原创 【leetcode c++】19 removeNthFromEnd

Given a linked list, remove the nth nodefrom the end of list and return its head. For example,   Given linked list: 1->2->3->4->5, and n = 2.   After removing the second node from the end,

2015-06-16 22:02:30 597

原创 【leetcode c++】14Longest Common Prefix

题目Write a function to find the longest commonprefix string amongst an array of strings.找出一系列字符串的公有前缀。 输入是vector&strs。观察输入,这是一个vector,咋一看是个一维数组。但是,绝大多数情况下,其实里面存的是长短不一的string。因此更像是一个锯齿数组的感觉。

2015-06-14 12:19:51 553

原创 【leetcode c++】13 Roman to Integer

题目Given a roman numeral, convert it to aninteger.Input is guaranteed to be within the rangefrom 1 to 3999. 输入一个1-3999的罗马数字(字符串),转化成整型。 首先,我们要大致知道罗马数字。参考百度百科,主要本题要用的资料:基本字符I=1V=5X

2015-06-12 12:36:57 692

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除