1、代码列表


2、VisibleRect类

该类是test-cpp自带工具类

3、HelloWorldScene类

同前面代码

4、DrawPrimitivesDemo类

1).h文件

#include "cocos2d.h"
#include "ui/CocosGUI.h"
#include "VisibleRect.h"
#include "renderer/CCRenderer.h"
#include "renderer/CCCustomCommand.h" USING_NS_CC;
using namespace ui; class DrawPrimitivesDemo : public Scene
{
public:
CREATE_FUNC(DrawPrimitivesDemo);
virtual bool init();
}; class BaseTest : public cocos2d::Layer
{
public:
CREATE_FUNC(BaseTest);
std::string title() const;
virtual std::string subtitle() const; void restartCallback(Ref* sender);//又一次运行当前test
void nextCallback(Ref* sender);//下一个test
void backCallback(Ref* sender);//上一个test
virtual bool init();
void menuCloseCallback(cocos2d::Ref* pSender);//关闭菜单回调函数
}; class DrawPrimitivesTest : public BaseTest
{
public:
CREATE_FUNC(DrawPrimitivesTest);
virtual bool init();
virtual std::string subtitle() const override;
virtual void draw(Renderer* renderer,const Mat4 &transform,uint32_t flags) override; protected:
void onDraw(const Mat4 &transform,uint32_t flags);
CustomCommand _customCommand;
}; class DrawNodeTest : public BaseTest
{
public:
CREATE_FUNC(DrawNodeTest);
virtual bool init();
virtual std::string subtitle() const override;
};

2).cpp文件

#include "DrawPrimitivesDemo.h"
#include "renderer/CCRenderer.h"
#include "renderer/CCCustomCommand.h"
#define CL(__className__) [](){ return __className__::create();}
static int sceneIdx = -1; typedef Layer* (*NEWDRAWPRIMITIVESFUNC)();
#define DRAWPRIMITIVES_CREATE_FUNC(className) \
static Layer* create##className() \
{ return new className(); } static std::function<Layer*()> createFunctions[] =
{
CL(DrawPrimitivesTest),
CL(DrawNodeTest),
}; #define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0])) static Layer* nextAction()
{
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER; auto layer = (createFunctions[sceneIdx])();
// layer->autorelease(); return layer;
} static Layer* backAction()
{
sceneIdx--;
int total = MAX_LAYER;
if( sceneIdx < 0 )
sceneIdx += total; auto layer = (createFunctions[sceneIdx])();
// layer->autorelease(); return layer;
} static Layer* restartAction()
{
auto layer = (createFunctions[sceneIdx])();
// layer->autorelease(); return layer;
} bool BaseTest::init()
{
bool bRet = false;
do{
CC_BREAK_IF(!Layer::init()); Size visibleSize = Director::getInstance()->getVisibleSize();
Vec2 origin = Director::getInstance()->getVisibleOrigin(); /////////////////////////////
// 2. add a menu item with "X" image, which is clicked to quit the program
// you may modify it. // add a "close" icon to exit the progress. it's an autorelease object
auto closeItem = MenuItemImage::create(
"CloseNormal.png",
"CloseSelected.png",
CC_CALLBACK_1(BaseTest::menuCloseCallback, this));
closeItem->setPosition(Vec2(origin.x + visibleSize.width - closeItem->getContentSize().width/2 ,
origin.y + visibleSize.height - closeItem->getContentSize().height/2)); // create menu, it's an autorelease object
auto menu1 = Menu::create(closeItem, NULL);
menu1->setPosition(Vec2::ZERO);
this->addChild(menu1, 1); std::string str = title();
const char * pTitle = str.c_str();
TTFConfig ttfConfig("tahoma.ttf", 35);
auto label = Label::createWithTTF(ttfConfig,pTitle);
addChild(label, 9999);
label->setPosition( Vec2(VisibleRect::center().x, VisibleRect::top().y - 30) ); std::string strSubtitle = subtitle();
if( ! strSubtitle.empty() )
{
ttfConfig.fontFilePath = "tahoma.ttf";
ttfConfig.fontSize = 30;
auto l = Label::createWithTTF(ttfConfig,strSubtitle.c_str());
addChild(l, 9999);
l->setPosition( Vec2(VisibleRect::center().x, VisibleRect::top().y - 100) );
} auto item1 = MenuItemFont::create("backCallback", CC_CALLBACK_1(BaseTest::backCallback, this) );
auto item2 = MenuItemFont::create("restartCallback", CC_CALLBACK_1(BaseTest::restartCallback, this) );
auto item3 = MenuItemFont::create("nextCallback", CC_CALLBACK_1(BaseTest::nextCallback, this) ); auto menu = Menu::create(item1, item2, item3, NULL); menu->setPosition(Vec2::ZERO);
item1->setPosition(Vec2(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
item2->setPosition(Vec2(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
item3->setPosition(Vec2(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); addChild(menu, 9999); bRet = true;
}while(0);
return bRet;
} void BaseTest::menuCloseCallback(Ref* pSender)
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
MessageBox("You pressed the close button. Windows Store Apps do not implement a close button.","Alert");
return;
#endif Director::getInstance()->end(); #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
exit(0);
#endif
} void BaseTest::restartCallback(cocos2d::Ref *sender)
{
auto s = new (std::nothrow) DrawPrimitivesDemo();
s->addChild(restartAction());
Director::getInstance()->replaceScene(s);
s->release();
} void BaseTest::nextCallback(cocos2d::Ref *sender)
{
auto s = new (std::nothrow) DrawPrimitivesDemo();
s->addChild(nextAction());
Director::getInstance()->replaceScene(s);
s->release();
} void BaseTest::backCallback(cocos2d::Ref *sender)
{
auto s = new (std::nothrow) DrawPrimitivesDemo();
s->addChild(backAction());
Director::getInstance()->replaceScene(s);
s->release();
} std::string BaseTest::title() const
{
return "DrawPrimitives Test";
} std::string BaseTest::subtitle() const
{
return "";
} bool DrawPrimitivesDemo::init()
{
bool bRet = false;
do{
CC_BREAK_IF(!Scene::init()); auto layer = nextAction();
addChild(layer);
Director::getInstance()->replaceScene(this); bRet = true;
}while(0);
return bRet;
} bool DrawPrimitivesTest::init()
{
bool bRet = false;
do{
CC_BREAK_IF(!BaseTest::init()); bRet = true;
}while(0);
return bRet;
} void DrawPrimitivesTest::draw(cocos2d::Renderer *renderer, const cocos2d::Mat4 &transform, uint32_t flags)
{
//重写draw函数,回调onDraw函数
_customCommand.init(_globalZOrder);
_customCommand.func = CC_CALLBACK_0(DrawPrimitivesTest::onDraw, this, transform,flags);
renderer->addCommand(&_customCommand);
} void DrawPrimitivesTest::onDraw(const cocos2d::Mat4 &transform, uint32_t flags)
{
//初始化
Director* director = Director::getInstance();
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform); //画线
CHECK_GL_ERROR_DEBUG();
DrawPrimitives::drawLine(VisibleRect::leftBottom(), VisibleRect::rightTop());//參数是2个Vec2对象 //画线
CHECK_GL_ERROR_DEBUG();
glLineWidth(5.0f);//设置线条宽度
DrawPrimitives::setDrawColor4B(255, 0, 0, 255);//设置颜色
DrawPrimitives::drawLine(VisibleRect::leftTop(), VisibleRect::rightBottom()); //画点
CHECK_GL_ERROR_DEBUG();
DrawPrimitives::setPointSize(64);//设置点大小
DrawPrimitives::setDrawColor4B(0, 255, 255, 255);//设置颜色
DrawPrimitives::drawPoint(VisibleRect::center());//參数Vec2对象,表示圆心的位置 //画多个点
CHECK_GL_ERROR_DEBUG();
Vec2 points[] = {Vec2(60,160),Vec2(70,170),Vec2(60,170),Vec2(70,160)};
DrawPrimitives::setPointSize(4);
DrawPrimitives::setDrawColor4B(0, 255, 255, 255);
DrawPrimitives::drawPoints(points, 4);//參数依次为圆心Vec2和点的个数 //画圆圈
CHECK_GL_ERROR_DEBUG();
glLineWidth(16);
DrawPrimitives::setDrawColor4B(0, 255, 0, 255);
DrawPrimitives::drawCircle(VisibleRect::center(), 100, 0, 10, false);//參数依次为:圆心、半径、角度、段数、是否画出一条半径
//画圆圈
CHECK_GL_ERROR_DEBUG();
glLineWidth(2);
DrawPrimitives::setDrawColor4B(0, 255, 255, 255);
DrawPrimitives::drawCircle(VisibleRect::center(), 50, CC_DEGREES_TO_RADIANS(90), 50, true); //画实心圆
CHECK_GL_ERROR_DEBUG();
glLineWidth(2);//线条宽度
DrawPrimitives::setDrawColor4B(255, 0, 255, 255);//线条颜色
//參数依次为:圆心、半径、角度、段数、X轴缩放系数、Y轴缩放系数
DrawPrimitives::drawSolidCircle(VisibleRect::center() + Vec2(140,0), 40, CC_DEGREES_TO_RADIANS(90), 50, 1.0f, 1.0f); //画多边形图形,不闭合
CHECK_GL_ERROR_DEBUG();
glLineWidth(10);
Vec2 vertices[] = {Vec2(0,0),Vec2(50,50),Vec2(100,50),Vec2(100,100),Vec2(50,100)};
DrawPrimitives::drawPoly(vertices, 5, false);//參数依次为多边形定点、定点数、是否闭合 //绘制填充多边形
CHECK_GL_ERROR_DEBUG();
glLineWidth(1);
Vec2 filledVertices[] = {Vec2(0,120),Vec2(50,120),Vec2(50,170),Vec2(25,200),Vec2(0,170)};
DrawPrimitives::drawSolidPoly(filledVertices, 5, Color4F(0.5f,0.5f,1,1));//參数依次为定点、顶点个数、填充颜色 //绘制多边形,闭合
DrawPrimitives::setDrawColor4B(255, 0, 255, 255);
glLineWidth(2);
Vec2 vertices2[] = {Vec2(90,330),Vec2(90,530),Vec2(150,500)};
DrawPrimitives::drawPoly(vertices2, 3, true); //绘制贝塞尔曲线
CHECK_GL_ERROR_DEBUG();
//參数依次为起点、控制点、终点、段数
DrawPrimitives::drawQuadBezier(VisibleRect::leftTop(), VisibleRect::center(), VisibleRect::rightTop(), 50);
//画贝塞尔曲线
CHECK_GL_ERROR_DEBUG();
//參数依次为起点、控制点1、控制点2、终点、段数
DrawPrimitives::drawCubicBezier(VisibleRect::center(), Vec2(VisibleRect::center().x + 30,VisibleRect::center().y + 50), Vec2(VisibleRect::center().x + 60,VisibleRect::center().y - 50), VisibleRect::right(), 100);
//画填充闭合曲线
CHECK_GL_ERROR_DEBUG();
Vec2 vertices3[] = {Vec2(90,160), Vec2(100,190), Vec2(150,190), Vec2(140,160)};
DrawPrimitives::drawSolidPoly(vertices3, 4, Color4F(1,1,0,1));//參数依次为顶点、顶点个数、填充颜色 glLineWidth(1);
DrawPrimitives::setDrawColor4B(255, 255, 255, 255);
DrawPrimitives::setPointSize(1); CHECK_GL_ERROR_DEBUG();
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); } std::string DrawPrimitivesTest::subtitle() const
{
return "draw primitives";
} bool DrawNodeTest::init()
{
bool bRet = false;
do{
CC_BREAK_IF(!BaseTest::init()); auto s = Director::getInstance()->getWinSize(); //add DrawNode
auto draw = DrawNode::create();
addChild(draw,10); //draw point,參数依次为位置、Size、填充颜色
draw->drawPoint(Vec2(s.width/2 - 120,s.height/2 - 120),10 , Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1));
draw->drawPoint(Vec2(s.width/2 + 120,s.height/2 + 120),10 , Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1)); //draw points,同上
Vec2 position[] = {Vec2(60,60),Vec2(70,70),Vec2(60,70),Vec2(70,60)};
draw->drawPoints(position, 4, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1)); //draw a line,參数依次为起点、终点、颜色
draw->drawLine(Vec2(0,0), Vec2(s.width,s.height), Color4F(1.0, 0.0, 0.0, 0.5)); //draw a rectangle,绘制剪裁点。參数为剪裁起点、终点、颜色
draw->drawRect(Vec2(23,123), Vec2(7,100), Color4F(1, 1, 0, 1)); //draw circle。绘制圆圈,參数依次为:圆心、半径、角度、段数、是否绘制一条半径、X轴缩放、Y轴缩放、颜色
draw->drawCircle(VisibleRect::center() + Vec2(140,0), 100, CC_DEGREES_TO_RADIANS(90), 50, true, 1.0f, 2.0f, Color4F(1.0, 0.0, 0.0, 0.5));
draw->drawCircle(VisibleRect::center() - Vec2(140,0), 50, CC_DEGREES_TO_RADIANS(90), 30, false, Color4F(CCRANDOM_0_1(),CCRANDOM_0_1(),CCRANDOM_0_1(),1)); //Draw some beziers,參数依次为:起点、控制点、终点、段数、颜色
draw->drawQuadBezier(Vec2(s.width - 150, s.height - 150), Vec2(s.width - 70, s.height - 10), Vec2(s.width - 10,s.height - 10), 10, Color4F(CCRANDOM_0_1(),CCRANDOM_0_1(),CCRANDOM_0_1(),0.5));
draw->drawQuadBezier(Vec2(0,s.height), Vec2(s.width/2,s.height/2), Vec2(s.width,s.height), 50, Color4F(CCRANDOM_0_1(),CCRANDOM_0_1(),CCRANDOM_0_1(),0.5));
//參数依次为:起点、控制点1、控制点2、终点、段数、颜色
draw->drawCubicBezier(VisibleRect::center(), Vec2(VisibleRect::center().x+30,VisibleRect::center().y+50), Vec2(VisibleRect::center().x+60,VisibleRect::center().y-50),VisibleRect::right(),100, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 0.5));
draw->drawCubicBezier(Vec2(s.width - 250,40), Vec2(s.width - 70,100), Vec2(s.width - 30,250), Vec2(s.width - 10,s.height - 50), 10, Color4F(CCRANDOM_0_1(),CCRANDOM_0_1(),CCRANDOM_0_1(),0.5)); auto array = PointArray::create(20);
array->addControlPoint(Vec2(0,0));
array->addControlPoint(Vec2(80,80));
array->addControlPoint(Vec2(s.width - 80,80));
array->addControlPoint(Vec2(s.width - 80,s.height - 80));
array->addControlPoint(Vec2(80,s.height - 80));
array->addControlPoint(Vec2(80,80));
array->addControlPoint(Vec2(s.width/2,s.height/2));
//绘制基本线条,參数依次为:点数组、张力、段数、颜色
draw->drawCardinalSpline(array, 0.5, 50, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 0.5)); auto array2 = PointArray::create(20);
array2->addControlPoint(Vec2(s.width/2,30));
array2->addControlPoint(Vec2(s.width - 80,30));
array2->addControlPoint(Vec2(s.width - 80,s.height - 80));
array2->addControlPoint(Vec2(s.width/2,s.height - 80));
array2->addControlPoint(Vec2(s.width/2,30));
draw->drawCatmullRom(array2, 50, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 0.5)); //open random color poly,绘制多边形,不封闭
Vec2 vertices[] = {Vec2(0,0),Vec2(50,50),Vec2(100,50),Vec2(100,100),Vec2(50,100)};
draw->drawPoly(vertices, 5, false, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1)); //closed random color poly。绘制多边形,封闭
Vec2 vertices2[] = {Vec2(30,130), Vec2(30,230), Vec2(50,200)};
draw->drawPoly(vertices2, 3, true, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1)); //Draw 10 Circles,绘制圆圈
for(int i = 0; i < 10; i++)
{
//參数依次为:圆心、半径、颜色
draw->drawDot(Vec2(s.width/2,s.height/2), 10*(10-i), Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1));
} //Draw polygons绘制闭合多边形,參数依次是顶点、顶点个数、填充颜色、线条宽度、线条颜色
Vec2 points[] = { Vec2(s.height/4,0), Vec2(s.width,s.height/5), Vec2(s.width/3*2,s.height) };
// draw->drawPolygon(points, sizeof(points) / sizeof(points[0]), Color4F(1,0,0,0.5), 4, Color4F(0,0,1,0.5)); //star poly (triggers buggs)绘制多边形图形
{
const float o = 80;
const float w = 20;
const float h = 50;
Vec2 star[] = {Vec2(o+w,o-h),Vec2(o+w*2,o),Vec2(o+w*2+h,o+w),Vec2(o+w*2,o+w*2)};
//參数依次为:顶点、顶点个数、填充颜色、线条宽度、线条颜色
draw->drawPolygon(star, sizeof(star) / sizeof(star[0]), Color4F(1,0,0,0.5), 1, Color4F(0,0,1,1));
}
//绘制多边形
//star poly(doesn't trigger bug...order is important un tesselation is supported.
{
const float o=180;
const float w=20;
const float h=50;
Vec2 star[] = {
Vec2(o,o), Vec2(o+w,o-h), Vec2(o+w*2, o), // lower spike
Vec2(o + w*2 + h, o+w ), Vec2(o + w*2, o+w*2), // right spike
Vec2(o +w, o+w*2+h), Vec2(o,o+w*2), // top spike
Vec2(o -h, o+w), }; // left spike draw->drawPolygon(star,sizeof(star)/sizeof(star[0]), Color4F(1,0,0,0.5), 1, Color4F(0,0,1,1));
} //draw a solid polygon。绘制填充多边形
Vec2 vertices3[] = {Vec2(60,160), Vec2(70,190), Vec2(100,190), Vec2(90,160)};
draw->drawSolidPoly(vertices3, 4, Color4F(1,1,0,1));//參数依次为:顶点、顶点个数、填充颜色 //draw a solid rectangle//绘制剪裁图形。參数依次为:起点、终点、颜色
draw->drawSolidRect(Vec2(10,10),Vec2(20,20), Color4F(1,1,0,1)); //draw a solid circle绘制圆圈,參数依次为:终点、半径、角度、段数、X轴缩放、y轴缩放、颜色
draw->drawSolidCircle(VisibleRect::center() + Vec2(140,0),40, CC_DEGREES_TO_RADIANS(90), 50, 2.0f, 2.0f, Color4F(0,1,0,1)); //draw segment绘制线段,參数依次为:起点、终点、半径、颜色
draw->drawSegment(Vec2(20,s.height), Vec2(20,s.height / 2), 10, Color4F(0,1,0,1));
draw->drawSegment(Vec2(10,s.height/2), Vec2(s.width/2,s.height/2), 40, Color4F(1,0,1,0.5)); //draw triangle绘制三角形
draw->drawTriangle(Vec2(10,10), Vec2(70,30), Vec2(100,140), Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 0.5)); bRet = true;
}while(0);
return bRet;
} std::string DrawNodeTest::subtitle() const
{
return "Draw Node test";
}

5、效果图




版权声明:本文博客原创文章。博客,未经同意,不得转载。

Cocos2d-x3.3它DrawPrimitivesTest分析的更多相关文章

  1. Rouh set 入门知识2(基础定义篇)

    接上一篇,简单说明一下知识库的关系,设K1=(U,S1)和K2=(U,S2)为知识库 1.如果IND(S1)=IND(S2),即U/IND(S1)=U/IND(S2),则知识库K1与知识库K2是等价的 ...

  2. 关闭discuzX3.2注册页面的注册邮箱验证

    论坛升级后发现注册用户在输入任何邮箱email时,一直提示email 地址无效.用firephp跟踪发现:随机生成的email的后缀是@localhost! 找到原因,修改如下: //原来代码 if( ...

  3. 【数学建模】day02-整数规划

    基本类似于中学讲的整数规划--线性规划中变量约束为整数的情形. 目前通用的解法适合整数线性规划.不管是完全整数规划(变量全部约束为整数),还是混合整数规划(变量既有整数又有实数),MATLAB都提供了 ...

  4. PID算法控制简单理解

    1 传统的位式控制算法 用户期望值Sv(设定值)经控制算法输出一个输出信号OUT,输出信号加载到执行部件上(像MOS管等)对控制对象进行控制(步进电机.加热器等),控制对象的当前值(Pv)如速度通过传 ...

  5. ML(4.3): R Random Forest

    随机森林模型是一种数据挖掘模型,常用于进行分类预测.随机森林模型包含多个树形分类器,预测结果由多个分类器投票得出. 决策树相当于一个大师,通过自己在数据集中学到的知识对于新的数据进行分类.俗话说得好, ...

  6. 《疯狂iOS讲义(下)——iPhone/iPad高级应用与手游开发(含CD光盘1张)》

    <疯狂iOS讲义(下)——iPhone/iPad高级应用与手游开发(含CD光盘1张)> 基本信息 作者: 李刚    肖文吉 出版社:电子工业出版社 ISBN:9787121224379 ...

  7. [bzoj1021][SHOI2008]Debt 循环的债务 (动态规划)

    Description Alice. Bob和Cynthia总是为他们之间混乱的债务而烦恼,终于有一天,他们决定坐下来一起解决这个问题.不过,鉴别钞票的真伪是一件很麻烦的事情,于是他 们决定要在清还债 ...

  8. 20.Ecshop 2.x/3.x SQL注入/任意代码执行漏洞

    Ecshop 2.x/3.x SQL注入/任意代码执行漏洞 影响版本: Ecshop 2.x Ecshop 3.x-3.6.0 漏洞分析: 该漏洞影响ECShop 2.x和3.x版本,是一个典型的“二 ...

  9. cocos2d游戏界面卡住声音正常播放的问题分析

    cocos2d游戏界面卡住声音正常播放的问题分析 从目前已知的情况看,出现这种情况只可能是设备的内存不够导致的. 从代码上来说内存不够时会调用AppController的“- (void)applic ...

随机推荐

  1. 445port入侵详细解释

    445port入侵具体解释   关于"445port入侵"的内容445port入侵具体解释本站搜索很多其它关于"445port入侵"的内容 445port入侵, ...

  2. FS SIP呼叫的消息线程和状态机线程

    THREAD 当收到一次呼叫的时候,FS会在TU层创建两个线程,一个线程为状态机线程,另外一个为消息线程.状态机线程通过switch_core_session_thread_launch创建,顾名思义 ...

  3. Cocos2d-x实现简单的翻牌效果

    触发器互联网影响找了很多.有自己的点重写一个复杂的sprite类来实现.简单的操作来对引擎的使用CCOrbitCamera实现,但是,也存在一些问题,后变反了. 我在用的仅仅是一个简单的翻牌效果,点击 ...

  4. appendChild的用法

    appendChild的用法 1,先把元素从原有父级上删除 2,再把元素添加到新父级上

  5. 隐藏快捷方式扩展名(.lnk)

    自从装了Windows 7操作系统以后,有一个问题一直困扰着我.当我去掉“目录选项中”的“隐藏已知文件类型的扩展名”选项的“√”之后,桌面上的快捷方式的扩展名也出来了,看上去非常不爽.记得在XP.Vi ...

  6. Memcahce(MC)系列(两)Linux下一个Memcache安装

    Linux下一个memcache安装 memcache是高性能.分布式的内存对象缓存系统,用于在动态应用中降低数据库负载.提升訪问速度.眼下用memcache解决互联网上的大用户读取是很流行的一种使用 ...

  7. sql server 数据库 只有mdf文件,如何附加

    直接附加就可以,SQL 会提示LOG文件找不到,可删除提示的错误行,只附加MDF文件,附加成功后,SQL会自动创建LOG文件.

  8. 利用__index和__newindex实现默认值表、监控表、只读表(转)

    __index和__newindex实际上相当于是在读写表的时候分别加了一道过滤的逻辑,让读写表的操作可以被监控或说回调,利用这个特性可以实现一些带有特殊功能的表. 带有默认值的表: setdefau ...

  9. 使用hadoop命令rcc生成Record 一个简单的方法来实现自己的定义writable对象

    hadoop 的bin文件夹以下一个rcc命令,网上介绍非常少.看了一下源代码.发现能够用来生成 java和c++的hadoop Record 类代码,比起自己直接实现writable 接口.简单非常 ...

  10. 【Android进阶】使用Andbase快速开发框架实现常见侧滑栏和滑动标签页组合效果

    最近闲来无事,在网上寻找源代码看,突然发现了一个国内技术牛人开发的快速开发框架Andbase,花了一天时间研究了下源码和怎么使用,现将开发常见的侧滑栏和滑动标签页组合效果的使用介绍个大家,希望可以减少 ...