var f3js = require("f3js")
, x = 15
, y = 15
, width = 225
, height = 115
, dw = 7
, dh = 2 ;
var p = f3js.createPath();
p.moveTo(x, y);
p.dovetailTo(x + width, y, dw, dh);
p.dovetailTo(x + width, y + height, dw, dh);
p.dovetailTo(x, y + height, dw, dh);
p.dovetailTo(x, y, dw, dh);
p.close();
p.fill = false;
var ps = p.extrude(45);
ps[0].x = x + width + 50;
ps[0].y = y + dh;
ps[0].rotation = 90;
ps[1].x = x + width + 160;
ps[1].y = y + height + 10;
ps[1].rotation = 90;
ps[2].x = x + width + 105;
ps[2].y = y + dh;
ps[2].rotation = 90;
ps[3].x = x + width + 160;
ps[3].y = y + dh;
ps[3].rotation = 90;
ps[4].x = 0;
ps[4].y = height + 5;
for (var i = 0; i < ps.length; i ++) {
f3js.add(ps[i]);
}
var GroveSensor = require("jsupm_grove");
//レーザーカッターの調子が悪く彫る動作ができなかったので
//ボタンの機能名を彫るのはなしにした
//音量
var volume = new GroveSensor.GroveRotary(0);
f3js.add(volume, { x: x + 38, y: y + 35 });
f3js.drawRectangle(x + 18, y + 30, 4, 10);
//f3js.drawText("VOLUME", x + 15, y + 53);
//モニタ操作ボタン
var enter = new GroveSensor.GroveButton(0);
f3js.add(enter, { x: x + 82, y: y + 25 });
f3js.drawRectangle(x + 63, y + 20, 4, 10);
//f3js.drawText("ENTER", x + 83, y + 43);
var exit = new GroveSensor.GroveButton(0);
f3js.add(exit, { x: x + 82, y: y + 55 });
f3js.drawRectangle(x + 63, y + 50, 4, 10);
//f3js.drawText("EXIT", x + 84, y + 88);
var up = new GroveSensor.GroveButton(0);
f3js.add(up, { x: x + 196, y: y + 25 });
f3js.drawRectangle(x + 211, y + 20, 4, 10);
//f3js.drawText("UP", x + 214, y + 43);
var down = new GroveSensor.GroveButton(0);
f3js.add(down, { x: x + 196, y: y + 55 });
f3js.drawRectangle(x + 211, y + 50, 4, 10);
//f3js.drawText("DOWN", x + 208, y + 88);
//音形変化エンコーダ
var rotaryEncoder = require("jsupm_rotaryencoder");
var attack = new rotaryEncoder.RotaryEncoder(2, 3);
f3js.add(attack, { x: x + 88, y: y + 90});
//f3js.drawRectangle(x + 215, y + 105, 10, 4);
//f3js.drawText("ATTACK", x + 66, y + 135);
var decay = new rotaryEncoder.RotaryEncoder(2, 3);
f3js.add(decay, { x: x + 123, y: y + 90});
//f3js.drawRectangle(x + 175, y + 105, 10, 4);
//f3js.drawText("DECAY", x + 113, y + 135);
var sustain = new rotaryEncoder.RotaryEncoder(2, 3);
f3js.add(sustain, { x: x + 158, y: y + 90});
//f3js.drawRectangle(x + 135, y + 105, 10, 4);
//f3js.drawText("SUSTAIN", x + 151, y + 135);
var release = new rotaryEncoder.RotaryEncoder(2, 3);
f3js.add(release, { x: x + 193, y: y + 90});
//f3js.drawRectangle(x + 95, y + 105, 10, 4);
//f3js.drawText("RELEASE", x + 198, y + 135);
//ピッチベンダ(ジョイスティック)
var joystick = require("jsupm_joystick12");
var pitchbender = new joystick.Joystick12(0, 1);
f3js.add(pitchbender, { x: x + 38, y: y + 85 });
f3js.drawRectangle(x + 8, y + 80, 4, 10);
//f3js.drawText("PITCH", x + 26, y + 128);
//LCDモニタ
var LCD = require("jsupm_i2clcd");
var lcd = new LCD.Jhd1313m1(6,0x3E,0x62);
f3js.add(lcd, { x: x + 141, y: y + 45 });
//f3js.drawRectangle(x + 100, y + 55, 4, 10);
//USB等差し込み口
f3js.drawRectangle(
x + width + 160 - 11 - 4
, y + 10
, 12
, height - dh * 2 - 10);
//底面四隅穴
f3js.drawCircle(x + 10, y + height + 5 + 10, 1.5);
f3js.drawCircle(x + 10, y + height*2 + 5 - 10, 1.5);
f3js.drawCircle(x + width - 10, y + height + 5 + 10, 1.5);
f3js.drawCircle(x + width - 10, y + height*2 + 5 - 10, 1.5);
//マイコン取り付け穴 マイコンも便宜上モジュールとして一覧に入れておいた方が
//いいのでは?
//f3js.drawCircle(x + 5, y + height + 5 + 20, 1);マイコンにおける(0,0)位置
f3js.drawCircle(x + 5 + 16, y + height + 5 + 20 + 12, 1.5);
f3js.drawCircle(x + 5 + 16.5, y + height + 5 + 20 + 60, 1.5);
f3js.drawCircle(x + 5 + 68, y + height + 5 + 20 + 17, 1.5);
f3js.drawCircle(x + 5 + 68, y + height + 5 + 20 + 45, 1.5);
f3js.drawCircle(x + 5 + 116, y + height + 5 + 20 + 13, 1.5);
f3js.drawCircle(x + 5 + 116, y + height + 5 + 20 + 65.8, 1.5);