처리 용 멀티 터치 게임 패드 컨트롤을 만들고 원격 Arduino 로봇을 제어하는 데 사용하고 싶습니다. Processing에서 GUI를 만들고 Android 용으로 컴파일하고 싶습니다. 여기 Processing + Arduino Robot을 제어하기위한 Android 용 게임 패드
처리를 위해 GUI 게임 패드입니다 지금까지 만든 :float easing = 0.09;
// start position
int posX = 50;
int posY = 200;
// target position
int targetX = 50;
int targetY = 200;
boolean dragging = false;
void setup()
{
size(500,250);
smooth();
}
void draw()
{
background(255);
if (!dragging)
{
// calculate the difference in position, apply easing and add to vx/vy
float vx = (targetX - (posX)) * easing;
float vy = (targetY - (posY)) * easing;
// Add the velocity to the current position: make it move!
posX += vx;
posY += vy;
}
if(mousePressed)
{
dragging = true;
posX = mouseX;
posY = mouseY;
}
else
{
dragging = false;
}
DrawGamepad();
DrawButtons();
}
void DrawGamepad()
{
//fill(0,155,155);
//rect(0, 150, 100, 100, 15);
ellipseMode(RADIUS); // Set ellipseMode to RADIUS
fill(0,155,155); // Set fill to blue
ellipse(50, 200, 50, 50); // Draw white ellipse using RADIUS mode
ellipseMode(CENTER); // Set ellipseMode to CENTER
fill(255); // Set fill to white//
ellipse(posX, posY, 35, 35); // Draw gray ellipse using CENTER mode
}
void DrawButtons()
{
fill(0,155,155); // Set fill to blue
ellipse(425, 225, 35, 35);
ellipse(475, 225, 35, 35);
fill(255,0,0); // Set fill to blue
ellipse(425, 175, 35, 35);
ellipse(475, 175, 35, 35);
}
나는 그래서이 링크
에서 발견 다른 코드를 내놓았다 아마 코드가 안드로이드 멀티 터치 이벤트를 지원하지 않습니다 실현Can Processing handle multi-touch?
그래서이 프로젝트의 목적은 내 아두 이노 로봇을 제어하는 데 사용할 수 드 멀티 터치 게임 패드를 만드는 것입니다. 게임 패드는 조이스틱의 방향뿐만 아니라 어떤 키가 눌 렸는지 탐지해야합니다.
도움을 주시면 감사하겠습니다.
정확히 질문은 무엇입니까? http://stackoverflow.com/questions/17166522/can-processing-handle-multi-touch에서 코드를 사용할 수없는 이유는 무엇입니까? –
요점은 내가 지금 두 개의 코드가 있다는 것입니다. 하나는 multitouchevents를 처리하고 다른 하나는 gamepad control입니다. 둘 다 단일 코드로 결합하여 Android 장치에서 실행하고 싶습니다. 기능성 게임 패드를 완성하고 멀티 터치 코드와 결합하고 싶지만 작동시킬 수는 없습니다. 나는 어떤 도움을 주셔서 감사합니다. 감사합니다. – Iker