加速计事件监听机制
在上一篇中介绍了cocos2d-x中的触摸事件机制,这篇来介绍下游戏中也经常用到的加速计事件,这些都是游戏中的经常要用到的。
移动设备上一个很重要的输入源是设备的方向,大多数设备都配备了加速计,用于测量设备静止或匀速运动时所受到的重力方向。
重力感应来自移动设备的加速计,通常支持X、Y和Z三个方向的加速度感应,又称为三向加速计。实际应用中,可以根据三个方向的力度大小来计算...
分类:
其他好文 时间:
2014-07-27 11:12:32
阅读次数:
164
typedef enum PointerTag{Link,Thread};
typedef struct{
char ch;
int num;
}ElemType;
typedef struct{
BiThrNode *lchild,*rchild;
PointerTag Ltag,Rtag;
ElemType d...
分类:
其他好文 时间:
2014-07-27 11:12:02
阅读次数:
208
typedef struct{
int wiget;
int lchild,rchild,parent;
int data;
}HNode,*HTree;
void select(HTree &H,int i,int &s1,int &s2){
int tmp,min1,min2=0;
...
分类:
其他好文 时间:
2014-07-27 11:11:52
阅读次数:
208
算盘的模拟
#include
using namespace std;
int main()
{
char s[20];
scanf("%s",&s);
int len=strlen(s);
for(int i=len-1;i>=0;i--)
{
if(s[i]>='5'&&s[i]<='9')
{
...
分类:
其他好文 时间:
2014-07-27 11:11:42
阅读次数:
172
#SIZE 10
//直接插入排序
void insert_sort(){
int i,j;
int array[SIZE+1];
array[]={0,12,23,11,55,2,34,18,20,48,22};
for(i=2;i
array[0]=...
分类:
其他好文 时间:
2014-07-27 11:11:32
阅读次数:
238
Northcott Game
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2688 Accepted Submission(s): 1149
Problem Description
Tom和Jerry...
分类:
其他好文 时间:
2014-07-27 11:11:22
阅读次数:
199
这个升级可以在程序启动时调用:
首先建立一个service的类:MyService extends Service,然后在menifest中声明:
这样来调用:
Intent intent = new Intent();
intent.setClass(MainActivity.this, MyService.class);
startService(intent); //...
分类:
其他好文 时间:
2014-07-27 11:11:04
阅读次数:
194
进程模型
worker进程
master进程模型核心函数ngx_master_process_cycle()中调用了创建子进程函数ngx_start_worker_processes(),该函数源码如下
static void
ngx_start_worker_processes(ngx_cycle_t *cycle, ngx_int_t n, ngx_int_t type)...
分类:
其他好文 时间:
2014-07-27 11:10:42
阅读次数:
252
Description
A number is called a Mirror number if on lateral inversion, it gives the same number i.e it looks the same in a mirror. For example 101 is a mirror number while 100 is not.
Given two ...
分类:
其他好文 时间:
2014-07-27 11:10:22
阅读次数:
204
//需要n中普通原料和g ml灰色原料
//每三种不同普通原来各x ml 可以合成 x ml 灰色原料
//问最少需要集组原料 每组各原料50 ml
# include
# include
# include
using namespace std;
int main()
{
int i,n,cot,g,a[15],g1,b[15];
while(~scanf("%d",&n),n)...
分类:
其他好文 时间:
2014-07-27 11:10:12
阅读次数:
335
hdu 2660 Accepted Necklace(01-背包变形 || DFS)...
分类:
其他好文 时间:
2014-07-27 11:10:02
阅读次数:
222
题目大意:
四个操作:
I X Y 在x位置插入y
D x 删除x位置的数
R x y 用y替换x位置上的数字
Q x y 求出[x,y]上的最大子序列的和。
思路分析:
对于动态维护序列肯定是splay了。
现在就考虑以下几个问题。
之前我们知道线段树处理连续的子序列的和是用区间合并的。那splay上怎么做。
考虑边界,如儿子为 0 或者是冗余节点怎么办?
初始化的...
分类:
其他好文 时间:
2014-07-27 11:09:32
阅读次数:
257
java实现的字符串翻转,能想到的这几种方法
如果有其他方法,欢迎交流
//字符串反转
public class ReverseString {
public String reverse1(String str){
StringBuffer sb = new StringBuffer(str);
str = sb.reverse().toString();
return str...
分类:
其他好文 时间:
2014-07-27 11:09:12
阅读次数:
211
Google Chrome(谷歌浏览器)是由Google开发的一款可让您更快速、轻松且安全地使用网络的浏览器,它的设计超级简洁,使用起来更加方便.Google Chrome的特点是简洁、快速.Google Chrome支持多标签浏览,每个标签页面都在独立的“沙箱”内运行,在提高安全性的同时,一个标签...
分类:
其他好文 时间:
2014-07-27 11:07:02
阅读次数:
181
/** * 辅助类 * 用于记载字符和位置 * */class CharPos{ char c; int pos; public CharPos(char c,int pos){ this.c=c; this.pos=pos; }}/** ...
分类:
其他好文 时间:
2014-07-27 11:06:52
阅读次数:
245
PrototypeTime Limit: 1 Second Memory Limit: 32768 KBPrototype is a 3D game which allow you to control a person named Alex with much super ability t...
分类:
其他好文 时间:
2014-07-27 11:06:42
阅读次数:
328
uva10003:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=944题意:给你一个木棍,然后让你切n刀,每次切都会有一个费用。例如,假如说一开始木棍长是1...
分类:
其他好文 时间:
2014-07-27 11:06:12
阅读次数:
219