Skip to content

Commit cb82e54

Browse files
committed
Merge pull request #756 from jtwigg/develop
Support new compression algo for Int's.
2 parents 4b5495c + 6e67347 commit cb82e54

35 files changed

+24350
-111
lines changed

UnitTests/CCPhysicsTests.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ -(void)testKineticNodeActionsBasic1
942942
for(int i = 0; i < 100; i++)
943943
{
944944
float desired = (float)i * 0.1f * 100.0f/10.0f + (float)i * 0.1f * 200.0f/10.0f;
945-
NSLog(@"node1.position.x= %0.2f desired = %0.2f",body1.absolutePosition.x, desired);
945+
//NSLog(@"node1.position.x= %0.2f desired = %0.2f",body1.absolutePosition.x, desired);
946946
XCTAssertEqualWithAccuracy(body1.absolutePosition.x, desired , accuracy, @"Not in the write position");
947947
[scheduler update:0.10f];
948948
}

UnitTests/CCReaderTest.m

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
//
88

99
#import <XCTest/XCTest.h>
10+
#import "cocos2d.h"
11+
#import "CCBReader.h"
12+
#include <mach/mach.h>
13+
#include <mach/mach_time.h>
1014

1115
@interface CCReaderTest : XCTestCase
1216

@@ -20,6 +24,53 @@ - (void)setUp
2024
// Put setup code here; it will be run once, before the first test case.
2125
}
2226

27+
double machGetClockS()
28+
{
29+
static bool init = 0 ;
30+
static mach_timebase_info_data_t tbInfo ;
31+
static double conversionFactor ;
32+
if(!init)
33+
{
34+
init = 1 ;
35+
// get the time base
36+
mach_timebase_info( &tbInfo ) ;
37+
conversionFactor = tbInfo.numer / (1e9*tbInfo.denom) ; // ns->s
38+
}
39+
40+
return mach_absolute_time() * conversionFactor ; // seconds
41+
}
42+
43+
double machGetClockDiffS()
44+
{
45+
static double lastTime = 0;
46+
47+
double currentTime = machGetClockS() ;
48+
49+
double diff = currentTime - lastTime ;
50+
51+
lastTime = currentTime ; // update for next call
52+
53+
return diff ; // that's your answer
54+
}
55+
56+
-(void)testReaderPerformance
57+
{
58+
NSString *filePath =[[NSBundle mainBundle] pathsForResourcesOfType:@"ccbi" inDirectory:@"Resources-shared/Tests"][0];
59+
XCTAssertNotNil(filePath);
60+
61+
NSData * fileData = [[NSData alloc] initWithContentsOfFile:filePath];
62+
63+
CCBReader * ccbReader = [[CCBReader alloc] init];
64+
65+
machGetClockDiffS();
66+
for (int i = 0; i < 100; i++)
67+
{
68+
[ccbReader loadWithData:fileData owner:self];
69+
}
70+
71+
NSLog(@"TimeToRun: %0.8f", machGetClockDiffS());
72+
}
73+
2374
- (void)tearDown
2475
{
2576
// Put teardown code here; it will be run once, after the last test case.

cocos2d-tests-ios.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
758A6C80184410EE00D1A8D2 /* Particles in Resources */ = {isa = PBXBuildFile; fileRef = 758A6C7F184410EE00D1A8D2 /* Particles */; };
2828
75F76497185A831B00E2FAFE /* Sounds in Resources */ = {isa = PBXBuildFile; fileRef = 75F76496185A831B00E2FAFE /* Sounds */; };
2929
92324E2A18EB635500D78D3F /* CCReaderTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 92324E2918EB635500D78D3F /* CCReaderTest.m */; };
30+
9269312A1923D8A700CE6285 /* Resources-shared in Resources */ = {isa = PBXBuildFile; fileRef = B7C6237517EA695100928F91 /* Resources-shared */; };
3031
92FE241118F5F06F00647961 /* CCAnimationTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 92FE241018F5F06F00647961 /* CCAnimationTest.m */; };
3132
A6167B93189A7D4D0044D391 /* VertexZTest.m in Sources */ = {isa = PBXBuildFile; fileRef = A6167B92189A7D4D0044D391 /* VertexZTest.m */; };
3233
A664A4EF18A3D9B8006184B8 /* PositioningTest.m in Sources */ = {isa = PBXBuildFile; fileRef = A664A4EE18A3D9B8006184B8 /* PositioningTest.m */; };
@@ -594,6 +595,7 @@
594595
isa = PBXResourcesBuildPhase;
595596
buildActionMask = 2147483647;
596597
files = (
598+
9269312A1923D8A700CE6285 /* Resources-shared in Resources */,
597599
75556A1B1856374700ED1B0F /* InfoPlist.strings in Resources */,
598600
75556A15185636FB00ED1B0F /* powered.png in Resources */,
599601
);
Binary file not shown.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CCSetupScreenMode</key>
6+
<string>CCScreenModeFlexible</string>
7+
<key>CCSetupScreenOrientation</key>
8+
<string>CCScreenOrientationLandscape</string>
9+
<key>CCSetupTabletScale2X</key>
10+
<true/>
11+
</dict>
12+
</plist>
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)