forked from D-W-/catchDropGame
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSquareSprite.cpp
More file actions
31 lines (27 loc) · 769 Bytes
/
SquareSprite.cpp
File metadata and controls
31 lines (27 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "SquareSprite.h"
#include <stdlib.h>
USING_NS_CC;
float SquareSprite::getContentWidth()
{
static float itemWidth = 0;
if (0 == itemWidth) {
CCTexture2D * texture = CCTextureCache::sharedTextureCache()->addImage("block1.png");
Sprite *sprite = CCSprite::createWithTexture(texture);
itemWidth = sprite->getContentSize().width;
}
return itemWidth;
}
SquareSprite *SquareSprite::create(int row, int col)
{
SquareSprite *square = new SquareSprite();
square->m_row = row;
square->m_col = col;
square->m_selected = false;
square->m_prev = NULL;
//square->m_inQueue = false;
//sushi->m_imgIndex = rand() % TOTAL_SUSHI;
//square->initWithSpriteFrameName("block1.png");
square->initWithFile("block1.png");
square->autorelease();
return square;
}