sagarkothari
sagarkothari

Reputation: 24820

Cocos2d-x V3.0 scrollview usage

How to include and use ScrollView in Cocos2d-x project?

By simply writing

 #include "CCScrollView.h"

is not helping & generates compilation issues for both iOS & Android? (Haven't checked for other platforms)

Can someone help me how to include it?

File location is in MyProject/cocos2d/extensions/GUI/CCScrollView

Edit:
Cocos2d version : Cocos2d-x V3
Should work for : atleast iOS, Android
Current OS : mac os x

Errors I get :

Android:
enter image description here

iOS:
enter image description here

Upvotes: 1

Views: 601

Answers (1)

fossugn
fossugn

Reputation: 71

To add ScrollView to the cocos2d-x 3.x project you have to write next import in the top of your class implementation file:

#include "extensions/cocos-ext.h"
USING_NS_CC_EXT;

After that you will be able to create scroll view with following syntax:

auto scrollView = ScrollView::create();

Also, while compiling native code for Android, make sure you uncomment next two lines in Android.mk file:

LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static

and

$(call import-module,extensions)

Upvotes: 0

Related Questions