CCScrollLayer.h

leo leo, 2011-06-27 12:04

Download (1.1 kB)

 
1
//  CCScrollLayer.h
2
//  Museum
3
//
4
//  Created by GParvaneh on 29/12/2010.
5
//  Copyright 2010 All rights reserved.
6
//  Ported to C++ by Lior Tamam on 03/04/2011
7
#pragma once
8
#include "cocos2d.h"
9
using namespace cocos2d;
10

    
11
class CCScrollLayer : public CCLayer 
12
{
13
protected:
14
        // Holds the current height and width of the screen
15
        int scrollHeight;
16
        int scrollWidth;
17
        
18
        // Holds the height and width of the screen when the class was inited
19
        int startHeight;
20
        int startWidth;
21
        
22
        // Holds the current page being displayed
23
        int currentScreen;
24
        
25
        // A count of the total screens available
26
        int totalScreens;
27
        
28
        // The initial point the user starts their swipe
29
        int startSwipe;        
30

    
31
        void moveToPage(int page);
32
        void moveToNextPage();
33
        void moveToPreviousPage();
34
        virtual void onExit();
35
        virtual bool ccTouchBegan(CCTouch *touch, CCEvent *withEvent);
36
        virtual void ccTouchMoved(CCTouch *touch, CCEvent *withEvent);
37
        virtual void ccTouchEnded(CCTouch *touch, CCEvent *withEvent);        
38
public:
39
        static CCScrollLayer* layerWithLayers(CCMutableArray<CCLayer*> *layers,int widthOffset);
40
        bool initWithLayers(CCMutableArray<CCLayer*> *layers,int widthOffset);
41
        LAYER_NODE_FUNC(CCScrollLayer);
42
};