Permalink
Browse files

first commit

  • Loading branch information...
flyingoctopus committed Oct 11, 2012
0 parents commit fd5a209e7a8cb99103f229d0579a08decfcb4d00
Showing 493 changed files with 296,455 additions and 0 deletions.
Binary file not shown.
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="">
+ <uses-sdk android:minSdkVersion="7"/>
+ <application android:debuggable="true" android:icon="@drawable/icon" android:label="">
+ <activity android:name="">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+ </activity>
+ </application>
+
+
+<uses-permission android:name="android.permission.INTERNET"/>
+ <uses-permission android:name="android.permission.VIBRATE"/>
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+</manifest>
@@ -0,0 +1,22 @@
+
+//----------------------------------------------------------------
+
+void onClickWidget(APWidget widget){
+
+ if(widget == Apply){
+ gNotificationManager.notify(1, gNotification);
+ oscReInit();
+ }
+ else if(widget == Clear){
+ gNotificationManager.notify(1, gNotification);
+ osc.send("/clearMSG", new Object[] {new Integer(1)}, computer);
+ }
+ else if(widget == Save){
+ gNotificationManager.notify(1, gNotification);
+ osc.send("/saveMSG", new Object[] {new Integer(1)}, computer);
+ }
+
+}
+
+//----------------------------------------------------------------
+
@@ -0,0 +1,96 @@
+//----------------------------------------------------------------
+
+void mousePressed() {
+ // Switch State
+ if(mouseX < 50 && mouseY > height-50) {
+ gNotificationManager.notify(1, gNotification);
+ switchState();
+ }
+
+ if(state == 0) {
+ state = 1;
+ }
+ if(state == 1) {
+
+ }
+ else if(state == 2) {
+ touched = true;
+ osc.send("/stroke", new Object[] {new Integer(1)}, computer);
+ }
+}
+
+//----------------------------------------------------------------
+
+void mouseDragged() {
+ if(state == 1) {
+
+ // Width
+ if(mouseY > (height-sw1) -sw2 && mouseY < height) {
+ boxX = constrain(mouseX, sw1 + sw2, width - sw2);
+ float boxN = boxX / (sw*0.95);
+ osc.send("/Width", new Object[] {new Float(boxN)}, computer);
+ }
+
+ // Red
+ else if(mouseY > (height-(sw1*4)) -sw3 && mouseY < (height-(sw1*4)) +sw3) {
+ boxR = constrain(mouseX, sw1 + sw2, width - sw2);
+ float boxR_ = boxR / (sw*0.95);
+ r = boxR_ * 255;
+ osc.send("/Red", new Object[] {new Float(boxR_)}, computer);
+ }
+
+ // Green
+ else if(mouseY > (height-(sw1*3)) -sw3 && mouseY < (height-(sw1*3)) +sw3) {
+ boxG = constrain(mouseX, sw1 + sw2, width - sw2);
+ float boxG_ = boxG / (sw*0.95);
+ g = boxG_ * 255;
+ osc.send("/Green", new Object[] {new Float(boxG_)}, computer);
+ }
+
+ // Blue
+ else if(mouseY > (height-(sw1*2)) -sw3 && mouseY < (height-(sw1*2)) +sw3) {
+ boxB = constrain(mouseX, sw1 + sw2, width - sw2);
+ float boxB_ = boxB / (sw*0.95);
+ b = boxB_ * 255;
+ osc.send("/Blue", new Object[] {new Float(boxB_)}, computer);
+ }
+
+ }
+
+ if(state == 2) {
+ touched = true;
+
+ // Drawing
+ fill(r, g, b);
+ stroke(r, g, b);
+ strokeWeight(30-constrain(dist(pmouseX, pmouseY, mouseX, mouseY), 0, 20));
+ line(mouseX-1, mouseY-1, mouseX, mouseY);
+
+ // Coordinates
+ if(touched == true) {
+ sendX = mouseX / sw;
+ sendY = mouseY / sh;
+ }
+
+ // Send OSC
+ osc.send("/xy", new Object[] {new Float(sendX), new Float(sendY)}, computer);
+ osc.send("/stroke", new Object[] {new Integer(2)}, computer);
+
+ }
+}
+
+//----------------------------------------------------------------
+
+void mouseReleased() {
+ if(state == 2) {
+ touched = false;
+ sendX = -1;
+ sendY = -1;
+ osc.send("/stroke", new Object[] {new Integer(0)}, computer);
+ osc.send("/xy", new Object[] {new Float(sendX), new Float(sendY)}, computer);
+ }
+}
+
+//----------------------------------------------------------------
+
+
@@ -0,0 +1,17 @@
+
+//----------------------------------------------------------------
+
+void oscInit() {
+ //println();
+ //println("Initializing OSC");
+ osc = new OscP5(this,port);
+ computer = new NetAddress(ip, port);
+}
+
+void oscReInit() {
+ ip = tF_IP.getText();
+ //println("IP is " + ip);
+ computer = new NetAddress(ip, port);
+}
+
+//----------------------------------------------------------------
@@ -0,0 +1,16 @@
+
+//----------------------------------------------------------------
+
+void onAccelerometerEvent(float x, float y, float z) {
+ accelerometer.x = x;
+ accelerometer.y = y;
+ accelerometer.z = z;
+}
+
+void shake() {
+ // Reset Screen To Black
+ background(0);
+}
+
+
+//----------------------------------------------------------------
@@ -0,0 +1,20 @@
+
+//----------------------------------------------------------------
+
+void stateInit() {
+ state = 0;
+}
+
+void switchState() {
+ background(0);
+
+ if(state == 1) {
+ state = 2;
+ }
+
+ else if(state == 2) {
+ state = 1;
+ }
+}
+
+//----------------------------------------------------------------
@@ -0,0 +1,23 @@
+
+//----------------------------------------------------------------
+
+void onResume() {
+ super.onResume();
+ gNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+ gNotification = new Notification();
+ gNotification.vibrate = gVibrate;
+ //println("RESUMED! (Sketch Entered...)");
+}
+
+public boolean surfaceTouchEvent(MotionEvent event) {
+ //gNotificationManager.notify(1, gNotification);
+ return super.surfaceTouchEvent(event);
+}
+
+void onPause() {
+ //println("PAUSED! (Sketch Exited...)");
+ super.onPause();
+}
+
+//----------------------------------------------------------------
+
Oops, something went wrong.

0 comments on commit fd5a209

Please sign in to comment.