-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathRScrollViewItem.cpp
53 lines (43 loc) · 981 Bytes
/
RScrollViewItem.cpp
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
// RScrollViewItem.cpp
// Nock
//
// Created by Claude Chey on 2014. 10. 23..
//
//
#include "RScrollViewItem.h"
using namespace cocos2d;
bool RScrollViewItem::init()
{
if(!Layer::init()) return false;
return true;
}
Rect RScrollViewItem::getContentRect()
{
m_contentRect.origin = getPosition();
m_contentRect.size = getContentSize();
return m_contentRect;
}
const Vec2 RScrollViewItem::getCenter()
{
Size size = getContentSize();
return Vec2(size.width/2, size.height/2);
}
void RScrollViewItem::setOutOfRangeOnDisplay(bool val)
{
setVisible(!val);
}
void RScrollViewItem::testTouchAreaDraw()
{
Rect r = getContentRect();
Vec2 vertices[] =
{
Vec2(0,r.size.height),
Vec2(r.size.width,r.size.height),
Vec2(r.size.width,0),
Vec2(0,0)
};
DrawNode* drawNode = DrawNode::create();
drawNode->drawPolygon(vertices, 4, Color4F(1,1,1,0.5), 0, Color4F::BLACK);
addChild(drawNode);
}