rild / android-joystick-test Goto Github PK
View Code? Open in Web Editor NEWclone joystick app
clone joystick app
ネストが深くて闇が深まりそうなのでなんとかする
perform()
performInternal()
とかに切り分ける?
自動的にうまいことやってくれるようにしないといけない
コードの中に R.drawable. ... が埋もれていて、汎用性がないのでなんとかする
unnecessary code, furthermore something wrong
private void drawLoadingAnimation() {
while (isLoading) {
Canvas canvas = surfaceHolder.lockCanvas();
canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
Matrix matrix = new Matrix();
matrix.postRotate((float) 12.5);
loadingImg = Bitmap.createBitmap(loadingImg, 0, 0, loadingImg.getWidth(), loadingImg.getHeight(), matrix, true);
drawProcessingCircle(canvas);
surfaceHolder.unlockCanvasAndPost(canvas);
try {
Thread.sleep(30);
} catch (InterruptedException e) {
}
}
}
private void drawProcessingCircle(Canvas canvas) {
int w = 0;
int h = 0;
if (params != null) {
w = params.width;
h = params.height;
}
canvas.drawBitmap(loadingImg, w / 2 - loadingImg.getWidth() / 2, h / 2 - loadingImg.getHeight() / 2, alphaSignal);
}
上記の通り
when trying to change JoystickMoveListener to JoyStickMoveListener,
it causes compile error
押し込んだ時に今は interval を早くするだけだけど、
MORE_UP,
MORE_UPRIGHT,
MORE_RIGHT,
MORE_DOWNRIGHT,
MORE_DOWN,
MORE_DOWNLEFT,
MORE_LEFT,
MORE_UPLEFT,
これ追加する...?
それぞれの処理が連続で呼ばれるので、イベントハンドリングしなきゃ辛い
ハンドラ使ってやる
postDelayed, removeCallbacks を使う
リサイズ後のアドレスをリリースした (signal on)
private void resizeImages() {
Bitmap tmp;
if (shadow != null) {
tmp = shadow;
shadow = Bitmap.createScaledBitmap(tmp, shadowWidth, shadowHeight, false);
tmp.recycle();
}
tmp = stick;
stick = Bitmap.createScaledBitmap(tmp, stickWidth, stickHeight, false);
tmp.recycle();
tmp = background;
background = Bitmap.createScaledBitmap(tmp, params.width, params.height, false);
tmp.recycle();
if (canUseSignal) {
tmp = signalUp;
signalUp = Bitmap.createScaledBitmap(tmp, params.width, params.height, false);
tmp.recycle();
tmp = signalRight;
signalRight = Bitmap.createScaledBitmap(tmp, params.width, params.height, false);
tmp.recycle();
tmp = signalDown;
signalDown = Bitmap.createScaledBitmap(tmp, params.width, params.height, false);
tmp.recycle();
tmp = signalLeft;
signalLeft = Bitmap.createScaledBitmap(tmp, params.width, params.height, false);
tmp.recycle();
}
}
この実装しかないのか....
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.