- 博客(73)
- 收藏
- 关注
转载 next =getchar()将输入的字符打印
next = getchar(); 在控制面板输入字符串后 可以通过递归的方法输出 方法有点像取下标**但是** 用取下标的方式是不可行的 编译就会报错
2018-05-28 01:29:49 699
转载 webstorm 2017 激活破解
2017-06-15更新 之前都是使用2017.2.27的方法,版本是2017.1.1,还没提示过期,但是根据评论说这个链接已经失效了,评论也给出了个新地址:http://idea.iteblog.com/key.php 感谢 @qq_35381272 友情提供 2017.2.27更新 选择“license server” 输入:http://idea.imsxm.com/ 2...
2018-04-13 00:42:05 253
原创 cocos creat弹力球 button节点 尾部删除的效果
addChild的作用 password:function(event,num) { if(num === '<--') { cc.log(this.num); if(this.num === 0) { return; ...
2018-03-01 11:53:07 820
原创 最近用到过的函数
注意: 循环判断内部如果不初始化的话容易到导致判断失效 封装函数的时候生成和功能最好分开写,除非需求必要 COCOS //通过层级管理器找到main脚本,在找到bombList预制件 var bomPrefab = cc.find(‘Canvas’).getComponent(‘Main’).bombList[0];数字游戏//Node是组件实例 //小写node是对象
2018-02-04 20:23:00 340
原创 cocos2d-js类和精灵触摸事件
类:精灵类的调用传参都是cotr构造函数接收的,层级的颜色在 this._super()中添加 生命周期函数开始也需要this._super() 层级类: cc.Layer.extend({ })cc.LayerColor.extend({ ctor:function() { this._super(cc.color(255,255,255,255))
2018-02-04 19:31:19 1342
转载 moveTo与moveBy的区别
MoveTo和MoveBy可以使精灵移动,区别在于MoveTo是移动到给定的坐标点;而MoveBy是从当前坐标点移动给定的坐标点这么多的距离。举个例子,假定精灵当前的坐标点是(x, y),分别给MoveTo和MoveBy指定一个坐标点(x1, y1),那么MoveTo和MoveBy最终的效果分别如下:MoveTo:(x, y) → (x1, y1)MoveBy:(x, y) → (x +
2018-01-27 17:47:57 3750
转载 bind
bind() 方法 :bind方法本身和 apply 、call很类似, 也同样是改变this指向的方法, 但是bind使用的地方与apply 和 call 有些不同.注意 :bind方法会创建一个新函数, 称作绑定函数, 当调用bind函数时, 为以第一个参数为this(通常传入的也是this), 传入bind的第二个以及以后的参数加上绑定函数运行时本身的参数, 按照顺序作为原函
2018-01-19 13:58:39 455
原创 节点转换
getLocation 获取当前触点位置。 getLocationX 获取当前触点 X 轴位置。 getLocationY 获取当前触点 Y 轴位置。 getPreviousLocation 获取触点在上一次事件时的位置对象,对象包含 x 和 y 属性。 getStartLocation 获获取触点落下时的位置对象,对象包含 x 和 y 属性。 getDelta 获取触点距离上一次事件移
2018-01-19 11:36:20 4034
转载 Cocos Creator生命周期函数
bind 英文意思是 捆绑 on在节点上注册指定类型的回调函数,也可以设置 target(目标) 用于绑定响应函数的 this 对象。 同时您可以将事件派发到父节点或者通过调用 stopPropagation 拦截它。 推荐使用这种方式来监听节点上的触摸或鼠标事件,请不要在节点上直接使用 cc.eventManager。cocos Creator是基于js的脚本化,组件化开发。
2018-01-18 22:39:32 8262
转载 cocos creator四种事件
1、cocos creator接受的系统事件有四种 鼠标、触摸、键盘、重力传感四种。 其中鼠标事件和触摸事件,这些时间是被直接触发在相关节点上的,所以统称为节点系统时间。 与之对应的键盘和重力事件被称为全局系统事件。鼠标事件类型 cc.Node.EventType.MOUSE_DOWN:当鼠标在目标节点区域按下时触发一次
2018-01-18 22:33:41 5952
原创 js监听
this.touchListener = cc.EventListener.create({ 3 event: cc.EventListener.TOUCH_ONE_BY_ONE, 4 /* 5 可选event类型列表: 6 7 cc.EventListener.TOUCH_ONE_BY_ONE (单点触摸) 8 cc.EventListener.TOUCH_AL
2018-01-15 20:49:07 228
原创 小球弹跳
//启动帧计时器 this.scheduleUpdate(); //重置 reset:function() { if(this._direction === 0) { this._direction = 1; this.speed = 28; } },update:
2018-01-13 21:30:22 524
原创 数组内部运算
将一个数组中的元素按逆序重新存放。例如原来的顺序为:8,6,5,4,1, 要求改为:1,4,5,6,8。 #define N 7 void main() { int a[N] = { 12,9,16,5,7,2,1 }, k, s; printf("\n初始数组:\n"); for (k = 0; k < N; k++) {
2018-01-07 02:23:51 397
原创 数组 指针
int a; int b[10] ; 变量a称为标量,因为它是个单一的值,这个变量的类型是一个整数。 数组名b的值是一个指针常量,也就是数组第一个元素的地址 数组具有确定数量的元素,而指针只是一个标量值sizeof求数组长度时: int a[5] 求得数组长度5*4 int为4个字节 一级指针指向一级指针的话int b = 6; int *p, *a=&
2018-01-07 00:43:27 143
转载 学生题
有5个学生,每个学生的数据包括学号、姓名、三门课成绩,从键盘输入5个学生的数据,要求计算并输出。 1) 每个学生三门课的总成绩 2) 三门课每门课程的平均成绩#pragma once#include "student.h"#include <map>class Student{public: int id_; double chinese_; dou
2018-01-03 18:33:41 474
原创 BOX类
#pragma once#include <iostream>#include <string>class BOX{public: BOX(double width, double length, double height); void show(); //打印 double Super(); //表面积 double Bulk(); //体积
2018-01-03 18:18:29 4084
原创 cc
统一资源定位符(URL) 外部导入的东西(图片,音频等) 索引 属性(properties) url: AudioClip cc库中音频资源类(一般有多个音效) 类型(type) 内部的东西 type: cc.ProgressBar 进度条组件 type: cc.ParticleSystem 粒子效果 接口(interface) 类(class) any
2017-12-27 11:26:24 463
原创 &引用值
传引用参数void asd(int& i) {i = 4;return;}void main(){int i=10;asd(i);cout << i;}传指针参数void asd(int* i) { *i = 5; return;}void main(){ int i=10; asd(&i); cout << i; 在用C的时候
2017-12-24 18:12:00 203
转载 橡皮怪Dici,over,welcome,player
Dicicc.Class({ extends: cc.Component, properties: { //主角遇刺音效 dieAudio: { default:null, url:cc.AudioClip }, }, onLoad: function (
2017-12-22 20:03:53 376
原创 橡皮怪main.js
cc.Class({ extends: cc.Component, //继承属性类 properties: { _LEFT: -1, _RIGHT: 1, score:0, playTime:60, //游戏时间,倒计时 playTime:90, diciCoun
2017-12-22 19:52:26 443
转载 vector的应用
2.定义vector,放入数字1-52,分别代表各花色的扑克牌.从小到大为黑红梅方,1-K. 随机给四个玩家发3张牌,并打印牌面#include <iostream>#include <string>#include <vector>#include <sstream>#include <ctime>void show(std::vector<int> A){ std::str
2017-12-18 20:08:12 347
原创 解析字符串substr
#include <iostream>#include <string>int main(){ /*Myvector<double> vec; vec.push(1.1f); system("pause"); return 0;*/ std::string user(" uid:600001, name:张三, score: 125, state:未准备
2017-12-18 15:38:03 175
原创 !非
void main(){ int a = 0; int b = 0; for (; b<10;b++) { a==0 ? std::cout << "wo" : std::cout << "ta"; !a ? std::cout << " wo" : std::cout << " ta"; std::cout <<
2017-12-17 21:30:53 629
转载 类构造,析构,赋值,拷贝
类的普通构造函数: 函数名与类名一样的函数; 拷贝构造函数:函数名与类名一样 参数也是类的类型; 析构函数:~String(void) delete 删除构造函数; 赋值构造函数:重载运算符= 关键字(operator) #pragma once#include <iostream>class String{public: String(const char *s
2017-12-17 20:58:26 207
原创 模板
C++ 模板(template) typename用于模板与class差不多1.实现模板函数 n2string 2.实现模板类 myvector的push,pop,empty,size#pragma once#include <iostream>#include <string>#include <vector>#include <sstream>template <typename T>
2017-12-15 18:27:25 133
原创 重载运算
加号重载class Clock{private: int Time; int Minute; int Seecond;public: Clock(); Clock(int time, int minute, int seecond); Clock operator++(int); //ostream流 operator重载运算符关键字
2017-12-15 11:23:57 224
转载 容器
#include <iostream>#include <string>#include <vector>#include <list>#include <map>#include <set>#include <deque>#include <queue>#include <stack>#include <bitset>#include <forward_list>
2017-12-09 13:27:02 138
转载 类
访问私有成员#include <iostream>using namespace std;class Box{ public: double length; void setWidth( double wid ); double getWidth( void ); private: double width;};// 成员函数定义dou
2017-12-06 20:27:04 156
原创 c++学习
#include <iostream>#include <cmath>void evaluation(){ int i=0, j, sum=0, max=0, min=0; std::cout << "请输入20个数"; std::cin >> i; max = i; min = i; sum += i; for (j=0;j<2
2017-12-06 20:14:17 140
原创 c++
#include <iostream>#include <cmath>void max (){ int a,b,c; std::cout << "输入三个数:" << std::endl; std::cin >> a >> b >> c; if (a>b&&a>c) { std::cout << a << std::endl; }
2017-12-05 20:46:58 133
原创 bmp文件
F12 CTRK d 搜索#include <Windows.h>#include <stdio.h>#include <stdlib.h>#include <string.h>void _fread(const char* DestFile){ FILE* fpRead = fopen(DestFile,"rb"); BITMAPFILEHEADER bf;
2017-12-05 09:26:18 188
原创 数组,杨辉,矩阵翻转
void main(){ int i = 1; char arr[21] = {}; char* p = NULL; p = arr; for (int i = 0; i < 20; i++)//空出一块空间给\0 { arr[i] = i + 1; printf("%d \n", arr[i]); }
2017-12-02 18:28:04 269
转载 杨辉三角
//杨辉三角void main(){ int a[10][10] = { 0 },i,j; for (i = 0; i < 10; i++) { for (j = 0; j < 10; j++) { if (j == 0) { a[i][j] = 1;
2017-11-30 20:21:07 128
转载 文件读取(读取图片)
bool hexFile(const char* DestFile, const char* SrcFile){ FILE* fpRead = fopen(SrcFile, "r+b");//定义句柄 FILE* fpWrite = fopen(DestFile, "w+b"); if (NULL == fpRead || NULL == fpWrite)//判断指向我
2017-11-29 19:21:01 1242
原创 文件读取
定义句柄打开文件FILE fopen fopen()函数打开由fname(文件名)指定的文件, 并返回一个关联该文件的流.如果发生错误, fopen()返回NULL. mode(方式)是用于决定文件的用途(例如 用于输入,输出,等等) Mode(方式) 意义 “r” 打开一个用于读取的文本文件 “w” 创建一个用于写入的文本文件 “a” 附加到一个文本文件 “rb” 打
2017-11-28 18:28:30 236
原创 堆栈(逆波兰)
#define _CRT_SECURE_NO_WARNINGS#pragma once#include <cstdlib>#include <cstring>#include <cstdio>typedef struct _ELEMENT{ int index; char name[8]; _ELEMENT* next;}ELEMENT;typedef str
2017-11-23 19:35:32 245
转载 语句
程序语句的三种结构 顺序 选择 循环表达式语句: 算术表达式:a+b;a*b;a++; 关系表达式:a>b;a==b; 逻辑表达式:!0; !真;C语言控制语句①条件语句:if—else语句 ②开关语句:switch语句 ⑧当循环语句:while语句 ④直到循环语句:do—while语句 ⑤计数循环语句:for·语句 ⑥中止本次循环语句:con
2017-11-22 23:14:26 175
原创 运算符和输出函数
一.逻辑运算符; 1代表’真’ 0代表’假’ && 与 两个条件都需要满足 1&&1 1; 1 && 0 0; &(地址符) 读 and || 或 满足其中一个条件 1 || 0 1; 0 || 0 0; or ! 非 与条件相反 如:1
2017-11-22 23:09:37 217
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人