Skip to content

Commit c4fa91d

Browse files
committed
ButtonClicker sample (C++,RTMP) initial checkin
Change-Id: I9ccbfaca95215e986fd65b42488f511c5436448e
1 parent 67493fc commit c4fa91d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+14247
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
4+
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
5+
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
6+
<classpathentry kind="src" path="src"/>
7+
<classpathentry kind="src" path="gen"/>
8+
<classpathentry kind="output" path="bin/classes"/>
9+
</classpath>
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<?fileVersion 4.0.0?>
3+
4+
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
5+
<storageModule moduleId="org.eclipse.cdt.core.settings">
6+
<cconfiguration id="com.android.toolchain.gcc.403307355">
7+
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.android.toolchain.gcc.403307355" moduleId="org.eclipse.cdt.core.settings" name="Default">
8+
<externalSettings/>
9+
<extensions>
10+
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
11+
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
12+
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
13+
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
14+
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
15+
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
16+
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
17+
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
18+
</extensions>
19+
</storageModule>
20+
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
21+
<configuration artifactName="${ProjName}" buildProperties="" description="" id="com.android.toolchain.gcc.403307355" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
22+
<folderInfo id="com.android.toolchain.gcc.403307355.748575811" name="/" resourcePath="">
23+
<toolChain id="com.android.toolchain.gcc.1499090661" name="com.android.toolchain.gcc" superClass="com.android.toolchain.gcc">
24+
<targetPlatform binaryParser="org.eclipse.cdt.core.ELF" id="com.android.targetPlatform.51455682" isAbstract="false" superClass="com.android.targetPlatform"/>
25+
<builder id="com.android.builder.1575585701" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Android Builder" superClass="com.android.builder">
26+
<outputEntries>
27+
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="outputPath" name="obj"/>
28+
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="outputPath" name="libs"/>
29+
</outputEntries>
30+
</builder>
31+
<tool id="com.android.gcc.compiler.651349847" name="Android GCC Compiler" superClass="com.android.gcc.compiler">
32+
<inputType id="com.android.gcc.inputType.1379654651" superClass="com.android.gcc.inputType"/>
33+
</tool>
34+
</toolChain>
35+
</folderInfo>
36+
<sourceEntries>
37+
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="jni"/>
38+
</sourceEntries>
39+
</configuration>
40+
</storageModule>
41+
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
42+
</cconfiguration>
43+
</storageModule>
44+
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
45+
<project id="ButtonClickerNativeActivity.null.804198265" name="ButtonClickerNativeActivity"/>
46+
</storageModule>
47+
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
48+
<storageModule moduleId="scannerConfiguration">
49+
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
50+
<scannerConfigBuildInfo instanceId="com.android.toolchain.gcc.403307355;com.android.toolchain.gcc.403307355.748575811;com.android.gcc.compiler.651349847;com.android.gcc.inputType.1379654651">
51+
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.android.AndroidPerProjectProfile"/>
52+
</scannerConfigBuildInfo>
53+
</storageModule>
54+
<storageModule moduleId="refreshScope" versionNumber="2">
55+
<configuration configurationName="Default">
56+
<resource resourceType="PROJECT" workspacePath="/ButtonClickerNativeActivity"/>
57+
</configuration>
58+
</storageModule>
59+
</cproject>
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>ButtonClickerNativeActivity</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
10+
<triggers>clean,full,incremental,</triggers>
11+
<arguments>
12+
<dictionary>
13+
<key>?children?</key>
14+
<value>?name?=outputEntries\|?children?=?name?=entry\\\\\\\|\\\|?name?=entry\\\\\\\|\\\|\||</value>
15+
</dictionary>
16+
<dictionary>
17+
<key>?name?</key>
18+
<value></value>
19+
</dictionary>
20+
<dictionary>
21+
<key>org.eclipse.cdt.make.core.append_environment</key>
22+
<value>true</value>
23+
</dictionary>
24+
<dictionary>
25+
<key>org.eclipse.cdt.make.core.buildArguments</key>
26+
<value></value>
27+
</dictionary>
28+
<dictionary>
29+
<key>org.eclipse.cdt.make.core.buildCommand</key>
30+
<value>ndk-build</value>
31+
</dictionary>
32+
<dictionary>
33+
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
34+
<value>clean</value>
35+
</dictionary>
36+
<dictionary>
37+
<key>org.eclipse.cdt.make.core.contents</key>
38+
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
39+
</dictionary>
40+
<dictionary>
41+
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
42+
<value>false</value>
43+
</dictionary>
44+
<dictionary>
45+
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
46+
<value>true</value>
47+
</dictionary>
48+
<dictionary>
49+
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
50+
<value>true</value>
51+
</dictionary>
52+
<dictionary>
53+
<key>org.eclipse.cdt.make.core.stopOnError</key>
54+
<value>true</value>
55+
</dictionary>
56+
<dictionary>
57+
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
58+
<value>true</value>
59+
</dictionary>
60+
</arguments>
61+
</buildCommand>
62+
<buildCommand>
63+
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
64+
<arguments>
65+
</arguments>
66+
</buildCommand>
67+
<buildCommand>
68+
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
69+
<arguments>
70+
</arguments>
71+
</buildCommand>
72+
<buildCommand>
73+
<name>org.eclipse.jdt.core.javabuilder</name>
74+
<arguments>
75+
</arguments>
76+
</buildCommand>
77+
<buildCommand>
78+
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
79+
<arguments>
80+
</arguments>
81+
</buildCommand>
82+
<buildCommand>
83+
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
84+
<triggers>full,incremental,</triggers>
85+
<arguments>
86+
</arguments>
87+
</buildCommand>
88+
</buildSpec>
89+
<natures>
90+
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
91+
<nature>org.eclipse.jdt.core.javanature</nature>
92+
<nature>org.eclipse.cdt.core.cnature</nature>
93+
<nature>org.eclipse.cdt.core.ccnature</nature>
94+
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
95+
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
96+
</natures>
97+
</projectDescription>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.google.example.games.bc3"
3+
android:versionCode="1"
4+
android:versionName="1.0" >
5+
6+
<uses-sdk
7+
android:minSdkVersion="11"
8+
android:targetSdkVersion="19" />
9+
10+
<uses-feature android:glEsVersion="0x00020000" >
11+
</uses-feature>
12+
13+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" >
14+
</uses-permission>
15+
16+
<application
17+
android:name="com.google.example.games.bc3.ButtonClickerApplication"
18+
android:allowBackup="true"
19+
android:hasCode="true"
20+
android:icon="@drawable/ic_launcher"
21+
android:label="@string/app_name"
22+
android:theme="@style/AppTheme" >
23+
<meta-data
24+
android:name="com.google.android.gms.version"
25+
android:value="@integer/google_play_services_version" />
26+
<meta-data
27+
android:name="com.google.android.gms.games.APP_ID"
28+
android:value="@string/app_id" />
29+
30+
<!--
31+
Our activity is the built-in NativeActivity framework class.
32+
This will take care of integrating with our NDK code.
33+
-->
34+
<activity
35+
android:name="com.google.example.games.bc3.ButtonClickerNativeActivity"
36+
android:label="@string/app_name" >
37+
38+
<!-- Tell NativeActivity the name of or .so -->
39+
<meta-data
40+
android:name="android.app.lib_name"
41+
android:value="ButtonClickerNativeActivity" />
42+
43+
<intent-filter>
44+
<action android:name="android.intent.action.MAIN" />
45+
46+
<category android:name="android.intent.category.LAUNCHER" />
47+
</intent-filter>
48+
</activity>
49+
</application>
50+
</manifest>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Google Play game services - ButtonClickerNative C++ Samples
2+
===========================================
3+
Copyright (C) 2014 Google Inc.
4+
5+
<h2>Contents</h2>
6+
7+
ButtonClickerNative: The sample demonstrates how to use real time multiplayer gaming feature with C++ code with Google Play game services native SDK.
8+
9+
<h2>How to run a sample</h2>
10+
11+
Please follow steps described in [Getting Started for C++](https://developers.google.com/games/services/cpp/GettingStartedNativeClient)
12+
13+
<h2>Support</h2>
14+
15+
First of all, take a look at our [troubleshooting guide](https://developers.google.com/games/services/android/troubleshooting). Most setup issues can be solved by following this guide.
16+
17+
If your question is not answered by the troubleshooting guide, we encourage you to post your question to [stackoverflow.com](stackoverflow.com). Our team answers questions there reguarly.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
//
3+
// ShaderPlain.fsh
4+
//
5+
6+
#define USE_PHONG (1)
7+
8+
uniform lowp vec3 vMaterialAmbient;
9+
uniform mediump vec4 vMaterialSpecular;
10+
11+
varying lowp vec4 colorDiffuse;
12+
13+
#if USE_PHONG
14+
uniform highp vec3 vLight0;
15+
varying mediump vec3 position;
16+
varying mediump vec3 normal;
17+
#else
18+
varying lowp vec4 colorSpecular;
19+
#endif
20+
21+
/*
22+
Standard phong fragment shader implementation.
23+
Take object space light position and normal, derive a specular intensity.
24+
*/
25+
void main() {
26+
#if USE_PHONG
27+
mediump vec3
28+
halfVector = normalize(-vLight0 + position);
29+
mediump
30+
float NdotH = max(dot(normalize(normal), halfVector), 0.0);
31+
mediump
32+
float fPower = vMaterialSpecular.w;
33+
mediump
34+
float specular = pow(NdotH, fPower);
35+
36+
lowp vec4
37+
colorSpecular = vec4(vMaterialSpecular.xyz * specular, 1);
38+
gl_FragColor = colorDiffuse + colorSpecular;
39+
#else
40+
gl_FragColor = colorDiffuse + colorSpecular;
41+
#endif
42+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
//
2+
// ShaderPlain.vsh
3+
//
4+
5+
#define USE_PHONG (1)
6+
7+
attribute highp vec3 myVertex;
8+
attribute highp vec3 myNormal;
9+
attribute mediump vec2 myUV;
10+
attribute mediump vec4 myBone;
11+
12+
varying mediump vec2 texCoord;
13+
varying lowp vec4 colorDiffuse;
14+
15+
#if USE_PHONG
16+
varying mediump vec3 position;
17+
varying mediump vec3 normal;
18+
#else
19+
varying lowp vec4 colorSpecular;
20+
#endif
21+
22+
uniform highp mat4 uMVMatrix;
23+
uniform highp mat4 uPMatrix;
24+
25+
uniform highp vec3 vLight0;
26+
27+
uniform lowp vec4 vMaterialDiffuse;
28+
uniform lowp vec3 vMaterialAmbient;
29+
uniform lowp vec4 vMaterialSpecular;
30+
31+
/*
32+
Standard vertex shader shader implementation.
33+
Transform vertices and normal,
34+
derive diffuse value and pass object space light source
35+
position to fragment shader for phong shading.
36+
*/
37+
void main(void) {
38+
highp vec4
39+
p = vec4(myVertex, 1);
40+
gl_Position = uPMatrix * p;
41+
42+
texCoord = myUV;
43+
44+
highp vec3
45+
worldNormal = vec3(
46+
mat3(uMVMatrix[0].xyz, uMVMatrix[1].xyz, uMVMatrix[2].xyz) * myNormal);
47+
highp vec3
48+
ecPosition = p.xyz;
49+
50+
colorDiffuse = dot(worldNormal, normalize(-vLight0 + ecPosition))
51+
* vMaterialDiffuse + vec4(vMaterialAmbient, 1);
52+
53+
#if USE_PHONG
54+
normal = worldNormal;
55+
position = ecPosition;
56+
#else
57+
highp vec3 halfVector = normalize(ecPosition - vLight0);
58+
59+
highp float NdotH = max(-dot(worldNormal, halfVector), 0.0);
60+
float fPower = vMaterialSpecular.w;
61+
highp float specular = min( pow(NdotH, fPower), 1.0);
62+
colorSpecular = vec4(vMaterialSpecular.xyz * specular, 1);
63+
#endif
64+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/sh
2+
3+
#setup build mode
4+
mode=$1
5+
if [ -z $1 ] ; then
6+
echo “Default build mode: debug”
7+
mode=debug
8+
fi
9+
10+
#build library project
11+
echo “Switching to google-play-services_lib”
12+
13+
pushd ../../google-play-services_lib/
14+
android update lib-project --path .
15+
ant $mode
16+
popd
17+
18+
#Create ant
19+
echo “Updating ANT build settings”
20+
android update project --path .
21+
22+
#Execute ndk-build && ant
23+
ndk-build && ant $mode
24+

0 commit comments

Comments
 (0)