示例#1
0
CGridView* TuiManager::createGridView(float tag, Color4B color, int column, int num, int cellWidth, int cellHeight, float x, float y, float w, float h, float rotation){
	CGridView* pView = CGridView::create(Size(w, h));
	if (color.a != 0) pView->setBackgroundColor(color);
	pView->setAutoRelocate(true);
	pView->setRotation(rotation);
	pView->setPosition(x, -y);
	pView->setColumns(column);
	pView->setCountOfCell(num);
	pView->setSizeOfCell(Size(cellWidth, cellHeight));
	pView->setTag(tag);
	return pView;
}
示例#2
0
CGridView* TuiManager::createGridView(float tag, const char* img, int column, int num, int cellWidth, int cellHeight, float x, float y, float w, float h, float rotation){
	CGridView* pView = CGridView::create(Size(w, h));
	m_isUseSpriteFrame ? pView->setBackgroundSpriteFrameName(img) : pView->setBackgroundImage(img);
	pView->setAutoRelocate(true);
	pView->setRotation(rotation);
	pView->setPosition(x, -y);
	pView->setColumns(column);
	pView->setCountOfCell(num);
	pView->setSizeOfCell(Size(cellWidth, cellHeight));
	pView->setTag(tag);
	return pView;
}
示例#3
0
bool CGridViewBasicTest::init()
{
	CGridViewTestSceneBase::init();
	setTitle("CGridViewBasicTest");
	setDescription("GridView basic test (only work in vertical)");

	Sprite* pBg = Sprite::create("background.png");
	pBg->setPosition(Point(480, 320));
	m_pWindow->addChild(pBg);

	CGridView* pGridView = CGridView::create(
		Size(480, 320),
		Size(480 / 5, 320 / 4),
		96, this,
		ccw_datasource_adapter_selector(CGridViewBasicTest::gridviewDataSource));
	pGridView->setColumns(5);
	pGridView->setPosition(Point(480, 320));
	m_pWindow->addChild(pGridView);
	pGridView->setAutoRelocate(true);
	pGridView->reloadData();

	return true;
}