forked from Losiowaty/ImagePicker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathImagePicker.h
64 lines (44 loc) · 1.33 KB
/
ImagePicker.h
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef __ImagePicker__ImagePicker__
#define __ImagePicker__ImagePicker__
#include "cocos2d.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
#include "ObjCCalls.h"
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#include "platform/android/jni/GalleryJNI.h"
#include "platform/android/jni/JniHelper.h"
#endif
using namespace cocos2d;
class ImagePickerDelegate {
public:
virtual void didFinishPickingWithResult(bool result) = 0;
};
class ImagePicker : public CCNode {
public:
static bool pickImage(CCNode *target, CCPoint position, ImagePickerDelegate *delegate);
static CCSprite* getLastSprite();
static void dismissed();
static void setReady();
private:
CCNode *_target;
CCPoint _position;
CCSprite *last;
static ImagePicker *sharedPicker;
ImagePickerDelegate *_delegate;
bool ready;
static bool working;
ImagePicker() {};
void start();
void finished();
};
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#ifdef __cplusplus
extern "C" {
#endif
void Java_org_cocos2dx_lib_Cocos2dxActivity_informNative(JNIEnv *env, jobject thiz);
void Java_org_cocos2dx_lib_Cocos2dxActivity_informNativeCancel(JNIEnv *env, jobject thiz);
#ifdef __cplusplus
}
#endif
#endif /* if CC_PLATFORM_ANDROID) */
#endif /* defined(__ImagePicker__ImagePicker__) */