Skip to content

Commit c693a92

Browse files
committed
Merge pull request #12 from spritebuilder/headless-develop
Android fixes
2 parents 6b765da + 3ada189 commit c693a92

File tree

28 files changed

+598
-102
lines changed

28 files changed

+598
-102
lines changed

.gitmodules

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
[submodule "external/Chipmunk"]
22
path = external/Chipmunk
33
url=https://github.com/slembcke/Chipmunk2D.git
4+
[submodule "external/ogg"]
5+
path = external/ogg
6+
url = [email protected]:apportable/ogg.git
7+
branch = apportable
8+
[submodule "external/tremor"]
9+
path = external/tremor
10+
url = [email protected]:apportable/tremor.git
11+
branch = apportable

Resources/Sounds/sound.ogg

5.95 KB
Binary file not shown.

cocos2d-ios.xcodeproj/project.pbxproj

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@
105105
571CD02B19649E03003D460C /* CCPlatformTextFieldIOS.m in Sources */ = {isa = PBXBuildFile; fileRef = 571CD02219649E03003D460C /* CCPlatformTextFieldIOS.m */; };
106106
57202D391970776100238D56 /* CCPlatformTextFieldAndroid.m in Sources */ = {isa = PBXBuildFile; fileRef = 571CD01D19649E03003D460C /* CCPlatformTextFieldAndroid.m */; };
107107
577D72D11970AC59005ABDC0 /* CCPlatformTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 571CD01F19649E03003D460C /* CCPlatformTextField.m */; };
108+
57BFF2B61991931300A3FE9C /* CCEditText.java in Sources */ = {isa = PBXBuildFile; fileRef = 57BFF2B51991931300A3FE9C /* CCEditText.java */; };
109+
57BFF2BA1991937C00A3FE9C /* CCEditText.m in Sources */ = {isa = PBXBuildFile; fileRef = 57BFF2B81991937C00A3FE9C /* CCEditText.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
108110
5B063DCC19637285002B1CDE /* ALWeakArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B063DCA19637285002B1CDE /* ALWeakArray.h */; };
109111
5B063DCD19637285002B1CDE /* ALWeakArray.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B063DCB19637285002B1CDE /* ALWeakArray.m */; };
110112
5B063DD019637291002B1CDE /* ALWeakDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B063DCE19637291002B1CDE /* ALWeakDictionary.h */; };
@@ -678,6 +680,7 @@
678680
E0F924711224140400EF2362 /* CCTexturePVR.h in Headers */ = {isa = PBXBuildFile; fileRef = E0F9246F1224140400EF2362 /* CCTexturePVR.h */; };
679681
E0F924721224140400EF2362 /* CCTexturePVR.m in Sources */ = {isa = PBXBuildFile; fileRef = E0F924701224140400EF2362 /* CCTexturePVR.m */; };
680682
E0F92AC41224559800EF2362 /* CCNS.h in Headers */ = {isa = PBXBuildFile; fileRef = E0F92AC31224559800EF2362 /* CCNS.h */; };
683+
FC55599E1991A26000E29CCE /* libtremor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FC55599B1991A25000E29CCE /* libtremor.a */; };
681684
/* End PBXBuildFile section */
682685

683686
/* Begin PBXContainerItemProxy section */
@@ -702,6 +705,20 @@
702705
remoteGlobalIDString = D309B21217EFE2EF00AA52C8;
703706
remoteInfo = "ObjectiveChipmunk-iPhone";
704707
};
708+
FC55599A1991A25000E29CCE /* PBXContainerItemProxy */ = {
709+
isa = PBXContainerItemProxy;
710+
containerPortal = FC5559951991A25000E29CCE /* tremor.xcodeproj */;
711+
proxyType = 2;
712+
remoteGlobalIDString = FC76226219919ECD0001BCF4;
713+
remoteInfo = tremor;
714+
};
715+
FC55599C1991A25A00E29CCE /* PBXContainerItemProxy */ = {
716+
isa = PBXContainerItemProxy;
717+
containerPortal = FC5559951991A25000E29CCE /* tremor.xcodeproj */;
718+
proxyType = 1;
719+
remoteGlobalIDString = FC76226119919ECD0001BCF4;
720+
remoteInfo = tremor;
721+
};
705722
/* End PBXContainerItemProxy section */
706723

707724
/* Begin PBXCopyFilesBuildPhase section */
@@ -822,6 +839,9 @@
822839
571CD02219649E03003D460C /* CCPlatformTextFieldIOS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCPlatformTextFieldIOS.m; sourceTree = "<group>"; };
823840
571CD02419649E03003D460C /* CCPlatformTextFieldMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCPlatformTextFieldMac.h; sourceTree = "<group>"; };
824841
571CD02519649E03003D460C /* CCPlatformTextFieldMac.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCPlatformTextFieldMac.m; sourceTree = "<group>"; };
842+
57BFF2B51991931300A3FE9C /* CCEditText.java */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.java; name = CCEditText.java; path = java/org/cocos2d/CCEditText.java; sourceTree = "<group>"; };
843+
57BFF2B71991937C00A3FE9C /* CCEditText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCEditText.h; path = java/CCEditText.h; sourceTree = "<group>"; };
844+
57BFF2B81991937C00A3FE9C /* CCEditText.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CCEditText.m; path = java/CCEditText.m; sourceTree = "<group>"; };
825845
5B063DCA19637285002B1CDE /* ALWeakArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ALWeakArray.h; sourceTree = "<group>"; };
826846
5B063DCB19637285002B1CDE /* ALWeakArray.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ALWeakArray.m; sourceTree = "<group>"; };
827847
5B063DCE19637291002B1CDE /* ALWeakDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ALWeakDictionary.h; sourceTree = "<group>"; };
@@ -1097,6 +1117,8 @@
10971117
E0F9246F1224140400EF2362 /* CCTexturePVR.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTexturePVR.h; sourceTree = "<group>"; };
10981118
E0F924701224140400EF2362 /* CCTexturePVR.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCTexturePVR.m; sourceTree = "<group>"; };
10991119
E0F92AC31224559800EF2362 /* CCNS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCNS.h; sourceTree = "<group>"; };
1120+
FC5559951991A25000E29CCE /* tremor.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = tremor.xcodeproj; path = external/tremor/android/tremor/tremor.xcodeproj; sourceTree = "<group>"; };
1121+
FC55599F1991A26300E29CCE /* libogg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libogg.a; path = "external/ogg/android/ogg/build/Debug-android/libogg.a"; sourceTree = "<group>"; };
11001122
/* End PBXFileReference section */
11011123

11021124
/* Begin PBXFrameworksBuildPhase section */
@@ -1131,6 +1153,7 @@
11311153
isa = PBXFrameworksBuildPhase;
11321154
buildActionMask = 2147483647;
11331155
files = (
1156+
FC55599E1991A26000E29CCE /* libtremor.a in Frameworks */,
11341157
D291DCC2195B2FA100278EC0 /* libObjectiveChipmunk-iPhone.a in Frameworks */,
11351158
D2FEB745194F6C9E00FC0574 /* CoreText.framework in Frameworks */,
11361159
D2FEB747194F6C9E00FC0574 /* Foundation.framework in Frameworks */,
@@ -1176,6 +1199,7 @@
11761199
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
11771200
isa = PBXGroup;
11781201
children = (
1202+
FC55599F1991A26300E29CCE /* libogg.a */,
11791203
D3903B1919952ABD003AA81A /* Metal.framework */,
11801204
D24FAEEB198014B90043E27D /* GLKit.framework */,
11811205
D289C1C1197440BC00B68E3D /* BridgeKitV3.framework */,
@@ -1197,6 +1221,7 @@
11971221
501756090F335CE900624901 /* external */ = {
11981222
isa = PBXGroup;
11991223
children = (
1224+
FC5559951991A25000E29CCE /* tremor.xcodeproj */,
12001225
B759E5281880C66900E8166C /* Chipmunk7-ios.xcodeproj */,
12011226
B7705F8A1831A07B0043CC67 /* ObjectAL */,
12021227
);
@@ -1470,6 +1495,9 @@
14701495
children = (
14711496
571CD01C19649E03003D460C /* CCPlatformTextFieldAndroid.h */,
14721497
571CD01D19649E03003D460C /* CCPlatformTextFieldAndroid.m */,
1498+
57BFF2B51991931300A3FE9C /* CCEditText.java */,
1499+
57BFF2B71991937C00A3FE9C /* CCEditText.h */,
1500+
57BFF2B81991937C00A3FE9C /* CCEditText.m */,
14731501
);
14741502
path = Android;
14751503
sourceTree = "<group>";
@@ -1891,6 +1919,14 @@
18911919
path = iOS;
18921920
sourceTree = "<group>";
18931921
};
1922+
FC5559961991A25000E29CCE /* Products */ = {
1923+
isa = PBXGroup;
1924+
children = (
1925+
FC55599B1991A25000E29CCE /* libtremor.a */,
1926+
);
1927+
name = Products;
1928+
sourceTree = "<group>";
1929+
};
18941930
/* End PBXGroup section */
18951931

18961932
/* Begin PBXHeadersBuildPhase section */
@@ -2304,12 +2340,13 @@
23042340
buildConfigurationList = D2FEB74C194F6C9E00FC0574 /* Build configuration list for PBXNativeTarget "cocos2dAndroid" */;
23052341
buildPhases = (
23062342
D2FEB610194F6C9E00FC0574 /* Headers */,
2307-
D2FEB6B8194F6C9E00FC0574 /* Sources */,
23082343
D2FEB740194F6C9E00FC0574 /* Frameworks */,
2344+
D2FEB6B8194F6C9E00FC0574 /* Sources */,
23092345
);
23102346
buildRules = (
23112347
);
23122348
dependencies = (
2349+
FC55599D1991A25A00E29CCE /* PBXTargetDependency */,
23132350
D2FEB60E194F6C9E00FC0574 /* PBXTargetDependency */,
23142351
);
23152352
name = cocos2dAndroid;
@@ -2343,6 +2380,10 @@
23432380
ProductGroup = B759E5291880C66900E8166C /* Products */;
23442381
ProjectRef = B759E5281880C66900E8166C /* Chipmunk7-ios.xcodeproj */;
23452382
},
2383+
{
2384+
ProductGroup = FC5559961991A25000E29CCE /* Products */;
2385+
ProjectRef = FC5559951991A25000E29CCE /* tremor.xcodeproj */;
2386+
},
23462387
);
23472388
projectRoot = "";
23482389
targets = (
@@ -2362,6 +2403,13 @@
23622403
remoteRef = B759E52C1880C66900E8166C /* PBXContainerItemProxy */;
23632404
sourceTree = BUILT_PRODUCTS_DIR;
23642405
};
2406+
FC55599B1991A25000E29CCE /* libtremor.a */ = {
2407+
isa = PBXReferenceProxy;
2408+
fileType = archive.ar;
2409+
path = libtremor.a;
2410+
remoteRef = FC55599A1991A25000E29CCE /* PBXContainerItemProxy */;
2411+
sourceTree = BUILT_PRODUCTS_DIR;
2412+
};
23652413
/* End PBXReferenceProxy section */
23662414

23672415
/* Begin PBXResourcesBuildPhase section */
@@ -2545,6 +2593,7 @@
25452593
isa = PBXSourcesBuildPhase;
25462594
buildActionMask = 2147483647;
25472595
files = (
2596+
57BFF2B61991931300A3FE9C /* CCEditText.java in Sources */,
25482597
5BC3CB5C1962795500C4F0D0 /* CCGestureListener.java in Sources */,
25492598
5BF3268E195F8E0300D9A51A /* CCActivity.java in Sources */,
25502599
5BF3268F195F8E0300D9A51A /* CCGLView.java in Sources */,
@@ -2582,6 +2631,7 @@
25822631
D2FEB6D0194F6C9E00FC0574 /* TGAlib.m in Sources */,
25832632
D2FEB6D1194F6C9E00FC0574 /* CCTextField.m in Sources */,
25842633
D2FEB6D2194F6C9E00FC0574 /* CCActionEase.m in Sources */,
2634+
57BFF2BA1991937C00A3FE9C /* CCEditText.m in Sources */,
25852635
D2FEB6D3194F6C9E00FC0574 /* CCPhysicsShape.m in Sources */,
25862636
577D72D11970AC59005ABDC0 /* CCPlatformTextField.m in Sources */,
25872637
D2FEB6D4194F6C9E00FC0574 /* ALContext.m in Sources */,
@@ -2714,6 +2764,11 @@
27142764
name = "ObjectiveChipmunk-iPhone";
27152765
targetProxy = D2FEB60F194F6C9E00FC0574 /* PBXContainerItemProxy */;
27162766
};
2767+
FC55599D1991A25A00E29CCE /* PBXTargetDependency */ = {
2768+
isa = PBXTargetDependency;
2769+
name = tremor;
2770+
targetProxy = FC55599C1991A25A00E29CCE /* PBXContainerItemProxy */;
2771+
};
27172772
/* End PBXTargetDependency section */
27182773

27192774
/* Begin XCBuildConfiguration section */
@@ -2994,13 +3049,16 @@
29943049
"$(SRCROOT)/external/Chipmunk/include",
29953050
"$(SRCROOT)/external/Chipmunk/objectivec/include",
29963051
"$(SRCROOT)/external/ObjectAL/**",
3052+
"$(SRCROOT)/external/tremor/include",
3053+
"$(SRCROOT)/external/ogg/include",
29973054
);
29983055
LIBRARY_SEARCH_PATHS = (
29993056
"$(inherited)",
30003057
"\\\\\\\"$(SRCROOT)/build/Debug-iphonesimulator\\\\\\\"",
30013058
"$(SDKROOT)/usr/lib/armeabi",
30023059
"$(SDKROOT)/usr/lib/armv7a",
30033060
"$(SDKROOT)/usr/lib/x86",
3061+
"$(PROJECT_DIR)/external/ogg/android/ogg/build/Debug-android",
30043062
);
30053063
ONLY_ACTIVE_ARCH = YES;
30063064
OTHER_LDFLAGS = "";
@@ -3038,13 +3096,16 @@
30383096
"$(SRCROOT)/external/Chipmunk/include",
30393097
"$(SRCROOT)/external/Chipmunk/objectivec/include",
30403098
"$(SRCROOT)/external/ObjectAL/**",
3099+
"$(SRCROOT)/external/tremor/include",
3100+
"$(SRCROOT)/external/ogg/include",
30413101
);
30423102
LIBRARY_SEARCH_PATHS = (
30433103
"$(inherited)",
30443104
"\\\\\\\"$(SRCROOT)/build/Debug-iphonesimulator\\\\\\\"",
30453105
"$(SDKROOT)/usr/lib/armeabi",
30463106
"$(SDKROOT)/usr/lib/armv7a",
30473107
"$(SDKROOT)/usr/lib/x86",
3108+
"$(PROJECT_DIR)/external/ogg/android/ogg/build/Debug-android",
30483109
);
30493110
OTHER_LDFLAGS = "";
30503111
PRODUCT_NAME = cocos2dAndroid;

cocos2d-osx.xcodeproj/project.pbxproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@
169169
D216F92D1970A35A000DEF7C /* ALWeakDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = D216F9271970A35A000DEF7C /* ALWeakDictionary.m */; };
170170
D216F92E1970A35A000DEF7C /* ALWeakElement.h in Headers */ = {isa = PBXBuildFile; fileRef = D216F9281970A35A000DEF7C /* ALWeakElement.h */; };
171171
D216F92F1970A35A000DEF7C /* ALWeakElement.m in Sources */ = {isa = PBXBuildFile; fileRef = D216F9291970A35A000DEF7C /* ALWeakElement.m */; };
172+
D2342007199AD36D00DF8FCD /* CCNoARC.m in Sources */ = {isa = PBXBuildFile; fileRef = D2342004199AD36D00DF8FCD /* CCNoARC.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
173+
D2342008199AD36D00DF8FCD /* CCRenderDispatch.h in Headers */ = {isa = PBXBuildFile; fileRef = D2342005199AD36D00DF8FCD /* CCRenderDispatch.h */; };
174+
D2342009199AD36D00DF8FCD /* CCRenderDispatch.m in Sources */ = {isa = PBXBuildFile; fileRef = D2342006199AD36D00DF8FCD /* CCRenderDispatch.m */; };
172175
D2D598641987132700BDAF25 /* CCEffect_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = D2D598421987132700BDAF25 /* CCEffect_Private.h */; };
173176
D2D598651987132700BDAF25 /* CCEffect.h in Headers */ = {isa = PBXBuildFile; fileRef = D2D598431987132700BDAF25 /* CCEffect.h */; };
174177
D2D598661987132700BDAF25 /* CCEffect.m in Sources */ = {isa = PBXBuildFile; fileRef = D2D598441987132700BDAF25 /* CCEffect.m */; };
@@ -540,6 +543,9 @@
540543
D216F9271970A35A000DEF7C /* ALWeakDictionary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ALWeakDictionary.m; sourceTree = "<group>"; };
541544
D216F9281970A35A000DEF7C /* ALWeakElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ALWeakElement.h; sourceTree = "<group>"; };
542545
D216F9291970A35A000DEF7C /* ALWeakElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ALWeakElement.m; sourceTree = "<group>"; };
546+
D2342004199AD36D00DF8FCD /* CCNoARC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCNoARC.m; sourceTree = "<group>"; };
547+
D2342005199AD36D00DF8FCD /* CCRenderDispatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCRenderDispatch.h; sourceTree = "<group>"; };
548+
D2342006199AD36D00DF8FCD /* CCRenderDispatch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCRenderDispatch.m; sourceTree = "<group>"; };
543549
D2D598421987132700BDAF25 /* CCEffect_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCEffect_Private.h; sourceTree = "<group>"; };
544550
D2D598431987132700BDAF25 /* CCEffect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCEffect.h; sourceTree = "<group>"; };
545551
D2D598441987132700BDAF25 /* CCEffect.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCEffect.m; sourceTree = "<group>"; };
@@ -1342,6 +1348,9 @@
13421348
D3AD531F18C84FC9005B6CF3 /* CCRenderer_private.h */,
13431349
D3AD532018C84FC9005B6CF3 /* CCRenderer.h */,
13441350
D3AD532118C84FC9005B6CF3 /* CCRenderer.m */,
1351+
D2342004199AD36D00DF8FCD /* CCNoARC.m */,
1352+
D2342005199AD36D00DF8FCD /* CCRenderDispatch.h */,
1353+
D2342006199AD36D00DF8FCD /* CCRenderDispatch.m */,
13451354
);
13461355
path = cocos2d;
13471356
sourceTree = "<group>";
@@ -1748,6 +1757,7 @@
17481757
B7E2603517E7C774007067F0 /* NSEvent+CC.h in Headers */,
17491758
B77060961831B0C40043CC67 /* OALAudioFile.h in Headers */,
17501759
B7E2603917E7C786007067F0 /* UITouch+CC.h in Headers */,
1760+
D2342008199AD36D00DF8FCD /* CCRenderDispatch.h in Headers */,
17511761
D2D5987E1987132700BDAF25 /* CCEffectSaturation.h in Headers */,
17521762
);
17531763
runOnlyForDeploymentPostprocessing = 0;
@@ -1870,6 +1880,7 @@
18701880
E076E6DA1225EC7400DE0DA2 /* CCActionInstant.m in Sources */,
18711881
E076E6DC1225EC7400DE0DA2 /* CCActionInterval.m in Sources */,
18721882
B77060901831B0C40043CC67 /* mach_timing.c in Sources */,
1883+
D2342009199AD36D00DF8FCD /* CCRenderDispatch.m in Sources */,
18731884
E076E6DE1225EC7400DE0DA2 /* CCActionManager.m in Sources */,
18741885
B791E851182065BD00DAE1D7 /* CCTiledMapLayer.m in Sources */,
18751886
E076E6E21225EC7400DE0DA2 /* CCActionProgressTimer.m in Sources */,
@@ -1897,6 +1908,7 @@
18971908
B770606C1831B0C40043CC67 /* OALAudioTrackNotifications.m in Sources */,
18981909
E076E7161225EC7400DE0DA2 /* CCProgressNode.m in Sources */,
18991910
D2D598851987132700BDAF25 /* CCEffectUtils.m in Sources */,
1911+
D2342007199AD36D00DF8FCD /* CCNoARC.m in Sources */,
19001912
B77060831831B0C40043CC67 /* ALSource.m in Sources */,
19011913
E076E7191225EC7400DE0DA2 /* CCRenderTexture.m in Sources */,
19021914
E076E71D1225EC7400DE0DA2 /* CCScene.m in Sources */,

cocos2d-tests-android/Headless.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1011,8 +1011,8 @@
10111011
OTHER_LDFLAGS = (
10121012
"-landroid",
10131013
"-lgles_apportable",
1014-
"-all_load",
10151014
"-ObjC",
1015+
"-all_load",
10161016
);
10171017
PRODUCT_NAME = "$(TARGET_NAME)";
10181018
WRAPPER_EXTENSION = app;

cocos2d-tests-android/Headless/tests/CCTextFieldTest.m

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
//
2+
// CCTextFieldTest.m
3+
// cocos2d-ui-tests-osx
4+
//
5+
// Created by Viktor on 10/23/13.
6+
// Copyright (c) 2013 Cocos2d. All rights reserved.
7+
//
8+
9+
#import "TestBase.h"
10+
#if !__CC_PLATFORM_ANDROID_COMPILE_ON_IOS_LAWLZ
11+
#import "CCTextField.h"
12+
#endif
13+
14+
@interface CCTextFieldTest : TestBase @end
15+
16+
@implementation CCTextFieldTest
17+
18+
- (NSArray*) testConstructors
19+
{
20+
return [NSArray arrayWithObjects:
21+
@"setupTextFieldBasicTest",
22+
nil];
23+
}
24+
25+
- (void) setupTextFieldBasicTest
26+
{
27+
#if !__CC_PLATFORM_ANDROID_COMPILE_ON_IOS_LAWLZ
28+
self.subTitle = @"Tests text fields.";
29+
30+
CCSpriteFrame* bg = [CCSpriteFrame frameWithImageNamed:@"Tests/textfield-bg.png"];
31+
CCTextField* textField = [[CCTextField alloc] initWithSpriteFrame:bg];
32+
33+
textField.preferredSizeType = CCSizeTypeMake(CCSizeUnitNormalized, CCSizeUnitPoints);
34+
textField.preferredSize = CGSizeMake(0.5, 50);
35+
textField.positionType = CCPositionTypeNormalized;
36+
textField.position = ccp(0.5f, 0.8f);
37+
textField.padding = 6;
38+
textField.anchorPoint = ccp(0.5f, 0.5f);
39+
textField.string = @"Hello!";
40+
41+
[textField setTarget:self selector:@selector(pressedEnter:)];
42+
43+
[self.contentNode addChild:textField];
44+
#endif
45+
}
46+
47+
- (void) pressedEnter:(id)sender
48+
{
49+
CCTextField* textField = sender;
50+
51+
NSLog(@"Finished editing: %@", textField.string);
52+
53+
self.subTitle = [NSString stringWithFormat:@"Editing: '%@'", textField.string];
54+
55+
}
56+
57+
@end

cocos2d-ui-tests/tests/CCTextFieldTest.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ - (void) setupTextFieldBasicTest
2828
CCTextField* textField = [[CCTextField alloc] initWithSpriteFrame:bg];
2929

3030
textField.preferredSizeType = CCSizeTypeMake(CCSizeUnitNormalized, CCSizeUnitPoints);
31-
textField.preferredSize = CGSizeMake(0.5, 36);
31+
textField.preferredSize = CGSizeMake(0.5, 50);
3232
textField.positionType = CCPositionTypeNormalized;
33-
textField.position = ccp(0.5f, 0.5f);
33+
textField.position = ccp(0.5f, 0.8f);
3434
textField.padding = 6;
3535
textField.anchorPoint = ccp(0.5f, 0.5f);
3636
textField.string = @"Hello!";
@@ -45,6 +45,8 @@ - (void) pressedEnter:(id)sender
4545
CCTextField* textField = sender;
4646

4747
NSLog(@"Finished editing: %@", textField.string);
48+
49+
self.subTitle = [NSString stringWithFormat:@"Editing: '%@'", textField.string];
4850
}
4951

5052
@end

cocos2d-ui-tests/tests/ObjectALTest.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ - (void) setupSimpleAudioTest
4949

5050
- (void) playSimpleSound:(id)sender
5151
{
52+
#if ANDROID
53+
[[OALSimpleAudio sharedInstance] playEffect:@"Sounds/sound.ogg"];
54+
#else
5255
[[OALSimpleAudio sharedInstance] playEffect:@"Sounds/sound.wav"];
56+
#endif
5357
}
5458

5559

0 commit comments

Comments
 (0)