Mercurial > hg > Database > Alice
changeset 93:6601f8854126 working
can KeyInputCodeSegment
author | sugi |
---|---|
date | Tue, 05 Jun 2012 16:33:28 +0900 |
parents | 8e3c1217aad4 |
children | 38f4021353c5 |
files | image/fish.jpg src/alice/test/topology/movement/CheckFishLocation.java src/alice/test/topology/movement/CheckMyName.java src/alice/test/topology/movement/KeyInput.java src/alice/test/topology/movement/KeyInputCodeSegment.java src/alice/test/topology/movement/MakeFrame.java src/alice/test/topology/movement/MakeObject.java src/alice/test/topology/movement/SendLocation.java |
diffstat | 8 files changed, 31 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/src/alice/test/topology/movement/CheckFishLocation.java Tue Jun 05 14:31:04 2012 +0900 +++ b/src/alice/test/topology/movement/CheckFishLocation.java Tue Jun 05 16:33:28 2012 +0900 @@ -34,8 +34,9 @@ float x = (float)this.nowX.asInteger()/1000; System.out.println(this.nowX.key+" :" + x); if (startX <= x && x < endX){ - obj.setLocation(x - 2*(num-1), 0.1f*num); - ods.update("parent", this.nowX.key, this.nowX.asInteger()+1); + obj.setLocation(x - 2*(num-1), 0); + if(this.nowX.key!="fish3X") + ods.update("parent", this.nowX.key, this.nowX.asInteger()+1); } CheckFishLocation cs = new CheckFishLocation(this.obj,this.nowX.key);
--- a/src/alice/test/topology/movement/CheckMyName.java Tue Jun 05 14:31:04 2012 +0900 +++ b/src/alice/test/topology/movement/CheckMyName.java Tue Jun 05 16:33:28 2012 +0900 @@ -23,7 +23,9 @@ if (type.equals("cli")){ System.out.println("cli"+cliNum); + MakeFrame frame = new MakeFrame(); + MakeObject obj = new MakeObject(frame); frame.register(obj); CheckFishLocation cs = new CheckFishLocation(obj,"fish1X"); @@ -37,12 +39,17 @@ cs2.nowX.setKey("parent","fish2X"); MakeObject obj3 = new MakeObject(frame); - frame.registerKObj(obj3); - + frame.register(obj3); + CheckFishLocation cs3 = new CheckFishLocation(obj3,"fish3X"); + cs3.host.setKey("local","host"); + cs3.nowX.setKey("parent","fish3X"); + + }else if(type.equals("node")){ System.out.println("node0"); ods.update("local", "fish1X", -1000); ods.update("local", "fish2X", -1000); + ods.update("local", "fish3X", 0); } }
--- a/src/alice/test/topology/movement/KeyInput.java Tue Jun 05 14:31:04 2012 +0900 +++ b/src/alice/test/topology/movement/KeyInput.java Tue Jun 05 16:33:28 2012 +0900 @@ -20,8 +20,7 @@ transformGroup= new TransformGroup(); transformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); vector = new Vector3f(0.0f,0.0f,0.0f); - - + } @Override public void keyPressed(KeyEvent event) {
--- a/src/alice/test/topology/movement/KeyInputCodeSegment.java Tue Jun 05 14:31:04 2012 +0900 +++ b/src/alice/test/topology/movement/KeyInputCodeSegment.java Tue Jun 05 16:33:28 2012 +0900 @@ -10,14 +10,15 @@ public void keyPressed(KeyEvent event) { // TODO Auto-generated method stub KeyCode = event.getKeyCode(); + System.out.println("getKey" +KeyCode); switch(KeyCode) { case 37: - cs = new SendLocation(-1); + cs = new SendLocation(-100); cs.nowX.setKey("parent", "fish3X"); break; case 39: - cs = new SendLocation(1); + cs = new SendLocation(100); cs.nowX.setKey("parent", "fish3X"); break; }
--- a/src/alice/test/topology/movement/MakeFrame.java Tue Jun 05 14:31:04 2012 +0900 +++ b/src/alice/test/topology/movement/MakeFrame.java Tue Jun 05 16:33:28 2012 +0900 @@ -22,6 +22,7 @@ private Canvas3D canvas; private SimpleUniverse universe; private KeyInput key; + private KeyInputCodeSegment KIC; public MakeFrame(){ JFrame frame = new JFrame(); @@ -39,10 +40,12 @@ universe = new SimpleUniverse(canvas); universe.addBranchGraph(createLight()); - + /* key = new KeyInput(); canvas.addKeyListener(key); - + */ + KIC = new KeyInputCodeSegment(); + canvas.addKeyListener(KIC); frame.setVisible(true); ViewingPlatform camera = universe.getViewingPlatform(); @@ -78,8 +81,8 @@ return this.key; } - public SimpleUniverse getUniverse(){ - return this.universe; + public KeyInputCodeSegment getKeySegment(){ + return this.KIC; } }
--- a/src/alice/test/topology/movement/MakeObject.java Tue Jun 05 14:31:04 2012 +0900 +++ b/src/alice/test/topology/movement/MakeObject.java Tue Jun 05 16:33:28 2012 +0900 @@ -19,14 +19,16 @@ public class MakeObject { public Vector3f vector; - private Transform3D transform; - private TransformGroup transform_group; - private Canvas3D canvas; - private KeyInput key; + Transform3D transform; + TransformGroup transform_group; + Canvas3D canvas; + KeyInput key; + KeyInputCodeSegment KIC; public MakeObject(MakeFrame MF){ this.canvas = MF.getCanvas(); this.key = MF.getKey(); + this.KIC = MF.getKeySegment(); }
--- a/src/alice/test/topology/movement/SendLocation.java Tue Jun 05 14:31:04 2012 +0900 +++ b/src/alice/test/topology/movement/SendLocation.java Tue Jun 05 16:33:28 2012 +0900 @@ -16,7 +16,8 @@ @Override public void run() { - ods.update("parent", "fishX3", this.nowX.asInteger()+num); + System.out.println("update"); + ods.update("parent", "fish3X", this.nowX.asInteger()+num); }