Skip to content

Commit cd0c1ee

Browse files
committed
put back android-specific API (wallpaper, wear, etc)
1 parent 77ca922 commit cd0c1ee

File tree

2 files changed

+178
-124
lines changed

2 files changed

+178
-124
lines changed

core/src/processing/core/PApplet.java

Lines changed: 173 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,10 +1248,6 @@ public void setup() {
12481248
}
12491249

12501250

1251-
public void calculate() {
1252-
}
1253-
1254-
12551251
public void draw() {
12561252
// if no draw method, then shut things down
12571253
//System.out.println("no draw method, goodbye");
@@ -2436,121 +2432,6 @@ public void touchCancelled(TouchEvent event) {
24362432

24372433
//////////////////////////////////////////////////////////////
24382434

2439-
// Wallpaper and wear API
2440-
2441-
2442-
public boolean wallpaperPreview() {
2443-
return surface.getEngine().isPreview();
2444-
}
2445-
2446-
2447-
public float wallpaperOffset() {
2448-
return surface.getEngine().getXOffset();
2449-
}
2450-
2451-
2452-
public int wallpaperHomeCount() {
2453-
float step = surface.getEngine().getXOffsetStep();
2454-
if (0 < step) {
2455-
return (int)(1 + 1 / step);
2456-
} else {
2457-
return 1;
2458-
}
2459-
}
2460-
2461-
2462-
public boolean wearAmbient() {
2463-
return surface.getEngine().isInAmbientMode();
2464-
}
2465-
2466-
2467-
public boolean wearInteractive() {
2468-
return !surface.getEngine().isInAmbientMode();
2469-
}
2470-
2471-
2472-
public boolean wearRound() {
2473-
return surface.getEngine().isRound();
2474-
}
2475-
2476-
2477-
public boolean wearSquare() {
2478-
return !surface.getEngine().isRound();
2479-
}
2480-
2481-
2482-
public Rect wearInsets() {
2483-
return surface.getEngine().getInsets();
2484-
}
2485-
2486-
2487-
public boolean wearLowBit() {
2488-
return surface.getEngine().useLowBitAmbient();
2489-
}
2490-
2491-
2492-
public boolean wearBurnIn() {
2493-
return surface.getEngine().requireBurnInProtection();
2494-
}
2495-
2496-
2497-
//////////////////////////////////////////////////////////////
2498-
2499-
// Ray casting API
2500-
2501-
2502-
public PVector[] getRayFromScreen(float screenX, float screenY, PVector[] ray) {
2503-
return g.getRayFromScreen(screenX, screenY, ray);
2504-
}
2505-
2506-
2507-
public void getRayFromScreen(float screenX, float screenY, PVector origin, PVector direction) {
2508-
g.getRayFromScreen(screenX, screenY, origin, direction);
2509-
}
2510-
2511-
2512-
public boolean intersectsSphere(float r, float screenX, float screenY) {
2513-
return g.intersectsSphere(r, screenX, screenY);
2514-
}
2515-
2516-
2517-
public boolean intersectsSphere(float r, PVector origin, PVector direction) {
2518-
return g.intersectsSphere(r, origin, direction);
2519-
}
2520-
2521-
2522-
public boolean intersectsBox(float w, float screenX, float screenY) {
2523-
return g.intersectsBox(w, screenX, screenY);
2524-
}
2525-
2526-
2527-
public boolean intersectsBox(float w, float h, float d, float screenX, float screenY) {
2528-
return g.intersectsBox(w, h, d, screenX, screenY);
2529-
}
2530-
2531-
2532-
public boolean intersectsBox(float size, PVector origin, PVector direction) {
2533-
return g.intersectsBox(size, origin, direction);
2534-
}
2535-
2536-
2537-
public boolean intersectsBox(float w, float h, float d, PVector origin, PVector direction) {
2538-
return g.intersectsBox(w, h, d, origin, direction);
2539-
}
2540-
2541-
2542-
public PVector intersectsPlane(float screenX, float screenY) {
2543-
return g.intersectsPlane(screenX, screenY);
2544-
}
2545-
2546-
2547-
public PVector intersectsPlane(PVector origin, PVector direction) {
2548-
return g.intersectsPlane(origin, direction);
2549-
}
2550-
2551-
2552-
//////////////////////////////////////////////////////////////
2553-
25542435

25552436
// KeyEvent[] keyEventQueue = new KeyEvent[10];
25562437
// int keyEventCount;
@@ -4057,9 +3938,11 @@ public void noiseSeed(long seed) {
40573938
}
40583939

40593940

3941+
40603942
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40613943

40623944

3945+
40633946
public PImage loadImage(String filename) { //, Object params) {
40643947
// return loadImage(filename, null);
40653948
InputStream stream = createInput(filename);
@@ -8105,6 +7988,177 @@ public void updatePixels(int x1, int y1, int x2, int y2) {
81057988
}
81067989

81077990

7991+
//////////////////////////////////////////////////////////////
7992+
7993+
// ANDROID-SPECIFIC API
7994+
7995+
7996+
// Wallpaper and wear API
7997+
7998+
7999+
public boolean wallpaperPreview() {
8000+
return surface.getEngine().isPreview();
8001+
}
8002+
8003+
8004+
public float wallpaperOffset() {
8005+
return surface.getEngine().getXOffset();
8006+
}
8007+
8008+
8009+
public int wallpaperHomeCount() {
8010+
float step = surface.getEngine().getXOffsetStep();
8011+
if (0 < step) {
8012+
return (int)(1 + 1 / step);
8013+
} else {
8014+
return 1;
8015+
}
8016+
}
8017+
8018+
8019+
public boolean wearAmbient() {
8020+
return surface.getEngine().isInAmbientMode();
8021+
}
8022+
8023+
8024+
public boolean wearInteractive() {
8025+
return !surface.getEngine().isInAmbientMode();
8026+
}
8027+
8028+
8029+
public boolean wearRound() {
8030+
return surface.getEngine().isRound();
8031+
}
8032+
8033+
8034+
public boolean wearSquare() {
8035+
return !surface.getEngine().isRound();
8036+
}
8037+
8038+
8039+
public Rect wearInsets() {
8040+
return surface.getEngine().getInsets();
8041+
}
8042+
8043+
8044+
public boolean wearLowBit() {
8045+
return surface.getEngine().useLowBitAmbient();
8046+
}
8047+
8048+
8049+
public boolean wearBurnIn() {
8050+
return surface.getEngine().requireBurnInProtection();
8051+
}
8052+
8053+
8054+
// Ray casting API
8055+
8056+
8057+
public PVector[] getRayFromScreen(float screenX, float screenY, PVector[] ray) {
8058+
return g.getRayFromScreen(screenX, screenY, ray);
8059+
}
8060+
8061+
8062+
public void getRayFromScreen(float screenX, float screenY, PVector origin, PVector direction) {
8063+
g.getRayFromScreen(screenX, screenY, origin, direction);
8064+
}
8065+
8066+
8067+
public boolean intersectsSphere(float r, float screenX, float screenY) {
8068+
return g.intersectsSphere(r, screenX, screenY);
8069+
}
8070+
8071+
8072+
public boolean intersectsSphere(float r, PVector origin, PVector direction) {
8073+
return g.intersectsSphere(r, origin, direction);
8074+
}
8075+
8076+
8077+
public boolean intersectsBox(float w, float screenX, float screenY) {
8078+
return g.intersectsBox(w, screenX, screenY);
8079+
}
8080+
8081+
8082+
public boolean intersectsBox(float w, float h, float d, float screenX, float screenY) {
8083+
return g.intersectsBox(w, h, d, screenX, screenY);
8084+
}
8085+
8086+
8087+
public boolean intersectsBox(float size, PVector origin, PVector direction) {
8088+
return g.intersectsBox(size, origin, direction);
8089+
}
8090+
8091+
8092+
public boolean intersectsBox(float w, float h, float d, PVector origin, PVector direction) {
8093+
return g.intersectsBox(w, h, d, origin, direction);
8094+
}
8095+
8096+
8097+
public PVector intersectsPlane(float screenX, float screenY) {
8098+
return g.intersectsPlane(screenX, screenY);
8099+
}
8100+
8101+
8102+
public PVector intersectsPlane(PVector origin, PVector direction) {
8103+
return g.intersectsPlane(origin, direction);
8104+
}
8105+
8106+
8107+
public void eye() {
8108+
g.eye();
8109+
}
8110+
8111+
8112+
public void calculate() {
8113+
}
8114+
8115+
8116+
/**
8117+
* Sets the coordinate system in 3D centered at (width/2, height/2)
8118+
* and with the Y axis pointing up.
8119+
*/
8120+
8121+
public void cameraUp() {
8122+
g.cameraUp();
8123+
}
8124+
8125+
8126+
/**
8127+
* Returns a copy of the current object matrix.
8128+
* Pass in null to create a new matrix.
8129+
*/
8130+
public PMatrix3D getObjectMatrix() {
8131+
return g.getObjectMatrix();
8132+
}
8133+
8134+
8135+
/**
8136+
* Copy the current object matrix into the specified target.
8137+
* Pass in null to create a new matrix.
8138+
*/
8139+
public PMatrix3D getObjectMatrix(PMatrix3D target) {
8140+
return g.getObjectMatrix(target);
8141+
}
8142+
8143+
8144+
/**
8145+
* Returns a copy of the current eye matrix.
8146+
* Pass in null to create a new matrix.
8147+
*/
8148+
public PMatrix3D getEyeMatrix() {
8149+
return g.getEyeMatrix();
8150+
}
8151+
8152+
8153+
/**
8154+
* Copy the current eye matrix into the specified target.
8155+
* Pass in null to create a new matrix.
8156+
*/
8157+
public PMatrix3D getEyeMatrix(PMatrix3D target) {
8158+
return g.getEyeMatrix(target);
8159+
}
8160+
8161+
81088162
//////////////////////////////////////////////////////////////
81098163

81108164
// EVERYTHING BELOW THIS LINE IS AUTOMATICALLY GENERATED. DO NOT TOUCH!

core/src/processing/core/PGraphics.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4445,7 +4445,7 @@ public PVector[] getRayFromScreen(float screenX, float screenY, PVector[] ray) {
44454445
}
44464446

44474447

4448-
public void getRayFromScreen(float screenX, float screenY, PVector eye, PVector dir) {
4448+
public void getRayFromScreen(float screenX, float screenY, PVector origin, PVector direction) {
44494449
showMissingWarning("getRayFromScreen");
44504450
}
44514451

@@ -4456,7 +4456,7 @@ public boolean intersectsSphere(float r, float screenX, float screenY) {
44564456
}
44574457

44584458

4459-
public boolean intersectsSphere(float r, PVector eye, PVector dir) {
4459+
public boolean intersectsSphere(float r, PVector origin, PVector direction) {
44604460
showMissingWarning("intersectsSphere");
44614461
return false;
44624462
}
@@ -4474,13 +4474,13 @@ public boolean intersectsBox(float w, float h, float d, float screenX, float scr
44744474
}
44754475

44764476

4477-
public boolean intersectsBox(float size, PVector eye, PVector dir) {
4477+
public boolean intersectsBox(float size, PVector origin, PVector direction) {
44784478
showMissingWarning("intersectsBox");
44794479
return false;
44804480
}
44814481

44824482

4483-
public boolean intersectsBox(float w, float h, float d, PVector eye, PVector dir) {
4483+
public boolean intersectsBox(float w, float h, float d, PVector origin, PVector direction) {
44844484
showMissingWarning("intersectsBox");
44854485
return false;
44864486
}
@@ -4492,7 +4492,7 @@ public PVector intersectsPlane(float screenX, float screenY) {
44924492
}
44934493

44944494

4495-
public PVector intersectsPlane(PVector eye, PVector dir) {
4495+
public PVector intersectsPlane(PVector origin, PVector direction) {
44964496
showMissingWarning("intersectsPlane");
44974497
return null;
44984498
}

0 commit comments

Comments
 (0)