示例#1
0
void CDShowNewsImage::scrollViewTouchUpWithoutMoved(CAScrollView* view, const CCPoint& point)
{
    if (m_isShow)
    {
        m_isShow=false;
        //开始执行动画
        CAViewAnimation::beginAnimations("", NULL);
        //动画时长
        CAViewAnimation::setAnimationDuration(0.2f);
        
        p_bg->setFrameOrigin(CADipPoint(0,winSize.height));
        
        //执行动画
        CAViewAnimation::commitAnimations();
    }
    else
    {
        m_isShow=true;
        //开始执行动画
        CAViewAnimation::beginAnimations("", NULL);
        //动画时长
        CAViewAnimation::setAnimationDuration(0.2f);
        
        p_bg->setFrameOrigin(CADipPoint(0,winSize.height/3*2));
        
        //执行动画
        CAViewAnimation::commitAnimations();
    }
}
示例#2
0
void FifthViewController::viewDidLoad()
{
	size = this->getView()->getBounds().size;
	this->getView()->setColor(CAColor_gray);
	gestureView = CAImageView::createWithImage(CAImage::create("bg.jpg"));
	gestureView->setCenterOrigin(CADipPoint(size.width*0.5,size.height*0.5));
	viewOriginalSize = gestureView->getFrame().size;
	this->getView()->addSubview(gestureView);
}
示例#3
0
void HttpRequestTest::requestHttpInfo(CAControl* btn, CCPoint point)
{
	loading = CAView::createWithColor(ccc4(255, 255, 255, 0));
	loading->setTag(200);
	loading->setFrame(this->getView()->getBounds());
	this->getView()->addSubview(loading);

	loadImage = CAImageView::createWithImage(CAImage::create("loading.png"));
	loadImage->setCenterOrigin(CADipPoint(size.width*0.5, size.height*0.5));
	loadImage->setScale(0.5);
	loading->addSubview(loadImage);
	CAScheduler::schedule(schedule_selector(HttpRequestTest::loadingAnim), this, 0.01, false);

	CALabel* msg = CALabel::createWithCenter(CADipRect(size.width*0.5, size.height*0.5, loadImage->getFrame().size.width*0.9, 50));
	msg->setText("Loading");
	msg->setColor(CAColor_blueStyle);
	msg->setFontSize(_px(22));
	msg->setTextAlignment(CATextAlignmentCenter);
	msg->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
	loading->addSubview(msg);

	string url = "";
	if (inputWebsite->getText().find("http://")==string::npos)
	{
		url = "http://" + inputWebsite->getText();
	}
	else
	{
		url = inputWebsite->getText();
	}
	CCHttpRequest* request = new CCHttpRequest();
	request->setTag("Getpage");
	request->setRequestType(CCHttpRequest::kHttpGet);
	request->setUrl(url.c_str());
	request->setResponseCallback(this,httpresponse_selector(HttpRequestTest::requestResult));
	CCHttpClient* httpClient = CCHttpClient::getInstance();
	httpClient->setTimeoutForConnect(30);
	httpClient->send(request); 
	request->release();
}
示例#4
0
CADipRect::CADipRect(float x, float y, float width, float height)
:m_bCenter(false)
{
    origin = CADipPoint(x, y);
    size = CADipSize(width, height);
}
示例#5
0
CADipPoint CADipPoint::operator-(const CADipPoint& right) const
{
    return CADipPoint(this->x - right.x, this->y - right.y);
}
示例#6
0
CADipPoint CADipPoint::operator+(const CADipPoint& right) const
{
    return CADipPoint(this->x + right.x, this->y + right.y);
}
示例#7
0
CADipPoint CADipPoint::operator/(float a) const
{
    return CADipPoint(this->x / a, this->y / a);
}
示例#8
0
CADipPoint CADipPoint::operator*(float a) const
{
    return CADipPoint(this->x * a, this->y * a);
}