Skip to content

Commit e33eb0a

Browse files
committed
moved cardboard libary into the mode
1 parent 8651c55 commit e33eb0a

17 files changed

+845
-44
lines changed

build.xml

Lines changed: 31 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,12 @@
1010
<property name="mode.dist.path" value="release/AndroidMode.zip" />
1111
<property name="tools.jar.path" value="mode/tools.jar" />
1212

13-
<target name="clean" description="Clean the build directories">
13+
<target name="clean" depends="subprojects-clean" description="Clean the build directories">
1414
<delete dir="bin" />
1515
<delete file="${mode.jar.path}" />
16-
17-
<!-- clean the core.jar project for Android -->
18-
<subant buildpath="core" target="clean"/>
1916
</target>
2017

21-
<target name="compile" description="Compile sources">
22-
<!-- build the core.jar file for Android -->
23-
<subant buildpath="core" target="build"/>
18+
<target name="compile" depends="subprojects-build" description="Compile sources">
2419

2520
<condition property="core-built">
2621
<available file="${processing.dir}/core/library/core.jar" />
@@ -42,12 +37,12 @@
4237
encoding="UTF-8"
4338
includeAntRuntime="false"
4439
classpath="${processing.dir}/core/library/core.jar;
45-
${processing.dir}/java/mode/JavaMode.jar;
46-
${processing.dir}/java/mode/antlr.jar;
47-
${processing.dir}/java/mode/org.eclipse.core.runtime.jar;
48-
${processing.dir}/app/pde.jar;
49-
${processing.dir}/app/lib/ant.jar;
50-
${processing.dir}/app/lib/ant-launcher.jar"
40+
${processing.dir}/java/mode/JavaMode.jar;
41+
${processing.dir}/java/mode/antlr.jar;
42+
${processing.dir}/java/mode/org.eclipse.core.runtime.jar;
43+
${processing.dir}/app/pde.jar;
44+
${processing.dir}/app/lib/ant.jar;
45+
${processing.dir}/app/lib/ant-launcher.jar"
5146
debug="on">
5247
<src path="src" />
5348
</javac>
@@ -88,43 +83,35 @@
8883

8984
<zip destfile="${mode.dist.path}">
9085
<zipfileset dir="." prefix="AndroidMode">
91-
<include name="android-core.zip" />
92-
<include name="mode.properties" />
93-
<include name="mode/**" />
94-
<include name="templates/**" />
95-
<include name="examples/**" />
96-
<include name="icons/**" />
97-
<include name="theme/**" />
98-
<exclude name="**/._*" />
86+
<include name="android-core.zip" />
87+
<include name="mode.properties" />
88+
<include name="mode/**" />
89+
<include name="templates/**" />
90+
<include name="examples/**" />
91+
<include name="icons/**" />
92+
<include name="theme/**" />
93+
<include name="libraries/**" />
94+
<exclude name="**/._*" />
9995
</zipfileset>
10096
</zip>
10197

10298
<copy file="mode.properties"
103-
tofile="release/AndroidMode.txt" />
99+
tofile="release/AndroidMode.txt" />
104100
</target>
105101

106-
107-
<target name="upload" depends="dist" description="Upload to processing.org">
108-
109-
<!-- Technically more cross-platform compatible, but requires
110-
extra jars in the ant libsfolder. Which is... not. -->
111-
<!--
112-
<scp todir="${user}@processing.org:/var/www/web/download/">
113-
<fileset dir="release">
114-
<include name="AndroidMode.txt" />
115-
<include name="AndroidMode.zip" />
116-
</fileset>
117-
</scp>
118-
-->
119-
120-
<exec executable="scp">
121-
<arg value="release/AndroidMode.txt" />
122-
<arg value="${user.name}@processing.org:/var/www/android/" />
123-
</exec>
124-
<exec executable="scp">
125-
<arg value="release/AndroidMode.zip" />
126-
<arg value="${user.name}@processing.org:/var/www/android/" />
127-
</exec>
102+
<!-- - - - - - - - - - - - - - - - - - -->
103+
<!-- Subprojects: Core, Libraries -->
104+
<!-- - - - - - - - - - - - - - - - - - -->
105+
106+
<target name="subprojects-clean">
107+
<subant buildpath="core" target="clean"/>
108+
<subant buildpath="libraries/cardboard" target="clean"/>
128109
</target>
110+
111+
<target name="subprojects-build">
112+
<subant buildpath="core" target="build"/>
113+
<subant buildpath="libraries/cardboard" target="build"/>
114+
</target>
115+
129116

130117
</project>

libraries/cardboard/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
bin
2+
/dist
3+
.classpath
4+
.project
5+
/library/

libraries/cardboard/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Cardboard library for Processing-Android
2+
3+
This library includes a stereo renderer to create Cardboard apps.
4+
5+
## Installation
6+
7+
It is still not available through the Contributions Manager, so you need to install it manually"
8+
9+
1. Download the [carboard.zip](https://github.com/codeanticode/processing-cardboard/releases/download/latest/cardboard.zip) file from the latest relesase.
10+
2. Unpack the zip file, and move the cardboard folder to the libraries' folder inside your sketchbook path.
11+
3. Follow [this tutorial](http://android.processing.org/tutorials/cardboard_intro/index.html) for a detailed guide on how to write cardboard apps with Processing.
12+
13+

libraries/cardboard/build.xml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?xml version="1.0"?>
2+
<project name="Processing Cardboard Library" default="build">
3+
4+
<property name="processing.dir" value="../../../processing" />
5+
<property environment="env"/>
6+
7+
<target name="clean" description="Clean the build directories">
8+
<delete dir="bin" />
9+
<delete file="library/cardboard.jar" />
10+
</target>
11+
12+
<target name="build" depends="sdk_chatter,compile" description="Build cardboard library for Processing Android" >
13+
<jar basedir="bin" destfile="library/cardboard.jar" />
14+
</target>
15+
16+
<target name="sdk_chatter" unless="env.ANDROID_SDK">
17+
<echo message="ANDROID_SDK not set, skipping build." />
18+
</target>
19+
20+
<target name="compile" description="Compile sources">
21+
<condition property="core-built">
22+
<available file="../../android-core.zip" />
23+
</condition>
24+
<fail unless="core-built" message="Please build the core library first and make sure it sits in ../../android-core.zip" />
25+
26+
<mkdir dir="bin" />
27+
<javac source="1.7"
28+
target="1.7"
29+
srcdir="src" destdir="bin"
30+
encoding="UTF-8"
31+
includeAntRuntime="false"
32+
classpath="lib/cardboard-audio-classes.jar;
33+
lib/cardboard-common-classes.jar;
34+
lib/cardboard-core-classes.jar;
35+
../../android-core.zip;
36+
${env.ANDROID_SDK}/platforms/android-23/android.jar"
37+
nowarn="true"
38+
compiler="org.eclipse.jdt.core.JDTCompilerAdapter">
39+
<compilerclasspath path="../../../processing/java/mode/org.eclipse.jdt.core.jar;
40+
../../../processing/java/mode/jdtCompilerAdapter.jar" />
41+
</javac>
42+
</target>
43+
44+
<target name="dist" depends="build" description="Creates distribution package">
45+
<mkdir dir="dist/tmp/cardboard" />
46+
47+
<!-- copy library files (jar and gstreamer natives) -->
48+
<copy todir="dist/tmp/cardboard/library">
49+
<fileset dir="library" />
50+
</copy>
51+
52+
<!-- copy examples -->
53+
<copy todir="dist/tmp/cardboard/examples">
54+
<fileset dir="examples" />
55+
</copy>
56+
57+
<!-- copy source -->
58+
<copy todir="dist/tmp/cardboard/src">
59+
<fileset dir="src" />
60+
</copy>
61+
62+
<!-- copy properties -->
63+
<copy file="library.properties" tofile="dist/tmp/cardboard/library.properties" />
64+
65+
<!-- create the java reference of the library -->
66+
<!--
67+
<mkdir dir="dist/tmp/video_android/reference" />
68+
<javadoc bottom="Processing video library by The Processing Foundation. (c) 2011-14"
69+
classpath="../processing/core/library/core.jar;bin"
70+
destdir="dist/tmp/video_android/reference"
71+
verbose="false"
72+
stylesheetfile="resources/stylesheet.css"
73+
doctitle="Javadocs: Video library for Android"
74+
public="true" version="false"
75+
windowtitle="Javadocs: Video library for Android">
76+
<link href="http://java.sun.com/javase/6/docs/api/" />
77+
<link href="http://github.com/omerjerk" />
78+
<taglet name="ExampleTaglet" path="resources/code" />
79+
<fileset dir="dist/tmp/video/src" defaultexcludes="yes">
80+
<include name="**/*"/>
81+
</fileset>
82+
</javadoc> -->
83+
84+
<!-- create zip package -->
85+
<delete file="dist/cardboard.zip"/>
86+
<zip destfile="dist/cardboard.zip"
87+
basedir="dist/tmp"
88+
excludes="**/.DS_Store"
89+
/>
90+
91+
<!-- copy properties to use by download manager -->
92+
<copy file="library.properties" tofile="dist/cardboard.txt" />
93+
94+
<delete dir="dist/tmp" />
95+
</target>
96+
</project>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="">
3+
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="23"/>
4+
<uses-permission android:name="android.permission.INTERNET"/>
5+
<uses-permission android:name="android.permission.NFC"/>
6+
<uses-permission android:name="android.permission.VIBRATE"/>
7+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
8+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
9+
<uses-feature android:name="android.hardware.sensor.accelerometer" android:required="true"/>
10+
<uses-feature android:name="android.hardware.sensor.gyroscope" android:required="true"/>
11+
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
12+
<application android:debuggable="true" android:icon="@drawable/icon" android:label="">
13+
<activity android:configChanges="orientation|keyboardHidden|screenSize" android:name=".MainActivity" android:screenOrientation="landscape">
14+
<intent-filter>
15+
<action android:name="android.intent.action.MAIN"/>
16+
<category android:name="android.intent.category.LAUNCHER"/>
17+
<category android:name="com.google.intent.category.CARDBOARD"/>
18+
</intent-filter>
19+
</activity>
20+
</application>
21+
</manifest>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import processing.cardboard.*;
2+
3+
void setup() {
4+
fullScreen(PCardboard.STEREO);
5+
}
6+
7+
void draw() {
8+
// PGraphicsCardboard pgc = (PGraphicsCardboard)g;
9+
// if (pgc.eyeType == PCardboard.LEFT) {
10+
// background(200, 50, 50);
11+
// } else if (pgc.eyeType == PCardboard.RIGHT) {
12+
// background(50, 50, 200);
13+
// } else if (pgc.eyeType == PCardboard.MONOCULAR) {
14+
// background(50, 200, 50);
15+
// }
16+
17+
background(157);
18+
lights();
19+
translate(width/2, height/2);
20+
rotateX(frameCount * 0.01f);
21+
rotateY(frameCount * 0.01f);
22+
box(500);
23+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
mode=Android
2+
component=cardboard
3+
mode.id=processing.mode.android.AndroidMode
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import processing.cardboard.*;
2+
3+
void setup() {
4+
fullScreen(PCardboard.MONO);
5+
}
6+
7+
void draw() {
8+
background(157);
9+
lights();
10+
translate(width/2, height/2);
11+
rotateX(frameCount * 0.01f);
12+
rotateY(frameCount * 0.01f);
13+
box(500);
14+
}
1.12 MB
Binary file not shown.
169 KB
Binary file not shown.

0 commit comments

Comments
 (0)