質問編集履歴

10

主文と備考の文の変更

2017/04/25 15:32

投稿

ko20vonobird
ko20vonobird

スコア50

test CHANGED
File without changes
test CHANGED
@@ -1,12 +1,12 @@
1
1
  いつも仮想端末でプログラムを実行して調整などをしているのですが、それを実機で実行した時に同じプログラムのはずなのに当たり判定にズレが生じてしまいます。(左上にずれていたかと思います。)
2
2
 
3
- **Activityからタッチイベントを取得しているのですが、Viewから取得した方が良いのでしょうか?**
4
-
5
- **また、解像度ども関係してくるのでしょうか?**
3
+ どうすればズレなくるのでしょうか?
6
4
 
7
5
  ###備考
8
6
 
9
- ステータスバーなどをなくしてます。
7
+ ステータスバーなどをなくしてます。
8
+
9
+ ・左右反転させた元になるカスタムビューに対するタッチイベントは仮想端末でも実機でも正常です。
10
10
 
11
11
  ###情報追記
12
12
 

9

備考の追加

2017/04/25 15:32

投稿

ko20vonobird
ko20vonobird

スコア50

test CHANGED
File without changes
test CHANGED
@@ -4,6 +4,10 @@
4
4
 
5
5
  **また、解像度なども関係してくるのでしょうか?**
6
6
 
7
+ ###備考
8
+
9
+ ステータスバーなどをなくしてます。
10
+
7
11
  ###情報追記
8
12
 
9
13
  ・仮想端末解像度:480×800: hdpi

8

文章の簡略化

2017/04/25 12:46

投稿

ko20vonobird
ko20vonobird

スコア50

test CHANGED
@@ -1 +1 @@
1
- 仮想端末と実機で実行結果違うのでが、タッチイベントをViewから取得した方が良いのでしょうか?
1
+ 仮想端末と実機で当たり判定のズレ生じま
test CHANGED
@@ -1,14 +1,8 @@
1
- いつも仮想端末でプログラムを実行して調整などをしているのですが、それを実機で実行した時に同じプログラムのはずなのに実行結果にズレが生じてしまいます。
1
+ いつも仮想端末でプログラムを実行して調整などをしているのですが、それを実機で実行した時に同じプログラムのはずなのに当たり判定にズレが生じてしまいます。(左上にずれていたかと思います。)
2
-
3
- 具体的には、スクリーンショットを添付させていただいたのですが、黒い領域が当たり判定でtrueが返る部分です。緑の円はタッチしている場所を表しており、スクリーンショットを撮ったときに左側の黒い領域の中間下部にタッチされていたことが分かります。
4
-
5
- 本来ならばこの黒い部分をタッチすれば反応して色が変わるのですが、仮想端末ではちゃんとした判定になっているのに実機ではずれてしまっています。ついでに言いますと、色も黒のはずが少し色が違います。領域の大きさも違うように見えました。
6
-
7
- しかし、全ての値には割合(百分率)を使っており、どの画面の大きさや比率でも対応できるようにしています。
8
2
 
9
3
  **Activityからタッチイベントを取得しているのですが、Viewから取得した方が良いのでしょうか?**
10
4
 
11
- 長文になりがよろしくお願います。
5
+ **また、解像度なども関係るのでょうか?**
12
6
 
13
7
  ###情報追記
14
8
 

7

タイトルの変更、主文の変更

2017/04/25 12:03

投稿

ko20vonobird
ko20vonobird

スコア50

test CHANGED
@@ -1 +1 @@
1
- パソコン上の仮想端末と実機で実行結果が違って困ってます
1
+ 仮想端末と実機で実行結果が違うのですが、タッチイベントをViewから取得した方が良のでしょうか?
test CHANGED
@@ -6,20 +6,10 @@
6
6
 
7
7
  しかし、全ての値には割合(百分率)を使っており、どの画面の大きさや比率でも対応できるようにしています。
8
8
 
9
- 私は原因が分りません。何が原因として考えられるか、可能性を教えてくださ
9
+ **Activityらタッチイベントを取得してのですが、Viewら取得した方が良のでしょうか?**
10
-
11
- **可能性だけでも良いので教えてください**
12
10
 
13
11
  長文になりましたがよろしくお願いします。
14
12
 
15
- ・追記
16
-
17
- もう一つ気になったのが、これの元の画面構成は反転したものだったのですが、それは実機でも仮想でもちゃんと動いていました。
18
-
19
- ・追記
20
-
21
- 同時並行して調べていたのですが、タッチイベントはActivityで取得していたのですが、Viewで取得するべきなのでしょうか?
22
-
23
13
  ###情報追記
24
14
 
25
15
  ・仮想端末解像度:480×800: hdpi

6

主文の追加

2017/04/25 10:40

投稿

ko20vonobird
ko20vonobird

スコア50

test CHANGED
File without changes
test CHANGED
@@ -8,6 +8,8 @@
8
8
 
9
9
  私は原因が分かりません。何が原因として考えられるか、可能性を教えてください。
10
10
 
11
+ **可能性だけでも良いので教えてください**
12
+
11
13
  長文になりましたがよろしくお願いします。
12
14
 
13
15
  ・追記

5

追記の記述

2017/04/25 10:28

投稿

ko20vonobird
ko20vonobird

スコア50

test CHANGED
File without changes
test CHANGED
@@ -102,29 +102,7 @@
102
102
 
103
103
  }
104
104
 
105
- public boolean Rightyhikite(float x, float y, float c3r, float c4r) {//ズレcleared
106
-
107
- if (((y >= ((-1 * x) / 0.524455263f) + ((winW * 6.5f) / (12 * 0.524455263f)) + ((winW * 6.5f * 0.524455263f) / 12) + (winW * 0.09535550236f) - (winH / 8)) &&
108
-
109
- (y <= ((-1 * x) / 0.524455263f) + ((winW * 10) / (12 * 0.524455263f)) + ((winW * 10 * 0.524455263f) / 12) + (winW * 0.09535550236f) - (winH / 8)) &&
110
-
111
- (y + ((((6 * c3r) / 5) - c3r) * Math.abs(Math.sin((Math.PI * 123.3f) / 180))) <= (((winH * (x + ((((6 * c3r) / 5) - c3r) * Math.abs(Math.cos((Math.PI * 123.3f) / 180)))) * 7) / 24) / (((winW * 9.1f) / 44) + (winH / 10))) - (winH / 8) + ((((winH * 7) / 24) / (((winW * 9.1f) / 44) + (winH / 10))) * (winW / 5.5f))) &&
112
-
113
- (y - ((((6 * c3r) / 5) - c3r) * Math.abs(Math.sin((Math.PI * 112) / 180))) >= ((winH * (x - ((((6 * c3r) / 5) - c3r) * Math.abs(Math.cos((Math.PI * 112) / 180)))) * 20.9f) / (winW * 31.2f)) + ((winH * 2) / 3) - ((winH * 20.9f) / 31.2f)))
114
-
115
- || Math.sqrt(Math.pow(x - ((winW * 6.5f) / 12), 2) + Math.pow(y - (((winW * 6.5 * 0.524455263f) / 12) + (winW * 0.09535550236f) - (winH / 8)), 2)) <= c3r ||
116
-
117
- Math.sqrt(Math.pow(x - ((winW * 10) / 12), 2) + Math.pow(y - (((winW * 10 * 0.524455263f) / 12) + (winW * 0.09535550236f) - (winH / 8)), 2)) <= c4r) {
118
-
119
- return true;
120
-
121
- }
122
-
123
- return false;
124
-
125
- }
126
-
127
- //以下2メソッドについて、実機とバーチャルで違いあり。
105
+ //
128
106
 
129
107
  //以下略
130
108
 
@@ -174,72 +152,154 @@
174
152
 
175
153
  ```
176
154
 
177
- ・図形の描画コード(文字数制限のため、抽出してます)
155
+ ・図形の描画コード**(文字数制限のため、抽出してます)**
178
156
 
179
157
  ```java
180
158
 
181
- p2.setStyle(Paint.Style.FILL_AND_STROKE);
182
-
183
- p2.setStrokeWidth(3);
184
-
185
- c.drawCircle(winW - c1x, c1y, c1r, p2);
186
-
187
- //
188
-
189
- p2.setStyle(Paint.Style.FILL_AND_STROKE);
190
-
191
- p2.setStrokeWidth(3);
192
-
193
- c.drawCircle(winW - c2x, c2y, c2r, p2);
194
-
195
- //略
196
-
197
- p2.setStyle(Paint.Style.FILL_AND_STROKE);
198
-
199
- p2.setStrokeWidth(3);
200
-
201
- c.drawCircle(winW - c3x, c3y, c3r, p2);
202
-
203
- //
204
-
205
- p2.setStyle(Paint.Style.FILL_AND_STROKE);
206
-
207
- p2.setStrokeWidth(3);
208
-
209
- c.drawCircle(winW - c4x, c4y, c4r, p2);
210
-
211
- //
212
-
213
- p2.setStyle(Paint.Style.FILL_AND_STROKE);
214
-
215
- Path path = new Path();
216
-
217
- path.moveTo(winW - ax, ay);
218
-
219
- path.lineTo(winW - cx, cy);
220
-
221
- path.lineTo(winW - dx, dy);
222
-
223
- path.lineTo(winW - bx, by);
224
-
225
- path.lineTo(winW - ax, ay);
226
-
227
- c.drawPath(path, p2);
228
-
229
- Path path2 = new Path();
230
-
231
- path2.moveTo(winW - ex, ey);
232
-
233
- path2.lineTo(winW - gx, gy);
234
-
235
- path2.lineTo(winW - hx, hy);
236
-
237
- path2.lineTo(winW - fx, fy);
238
-
239
- path2.lineTo(winW - ex, ey);
240
-
241
- c.drawPath(path2 , p2);
159
+ bx = (((winW / (5 * 0.8105067459f)) + ((winW * 0.8105067459f) / 5) + (winW * 0.1473648629f) - (winH / 8) + (winH / 8) - ((((winH * 7) / 24) / (((winW * 9.1f) / 44) + (winH / 10))) * (winW / 5.5f))) / (((winH * 7) / 24) / ((((winW * 9.1f) / 44) + (winH / 10))) + (1 / 0.8105067459f)));
160
+
161
+ by = ((((winH * 7) / 24) * bx) / (((winW * 9.1f) / 44) + (winH / 10))) - (winH / 8) + ((((winH * 7) / 24) / (((winW * 9.1f) / 44) + (winH / 10))) * (winW / 5.5f));
162
+
163
+ //cx = ((((winW * 3.8f) / (12 * 0.8105067459f)) + ((winW * 3.8f * 0.8105067459f) / 12) + (winW * 0.1473648629f) - ((winH * 7) / 40) - (winH / 8)) / (((winH * 66) / (winW * 40)) + (1 / 0.8105067459f)));
164
+
165
+ //cy = ((winH * 66 * cx) / (winW * 40)) + ((winH * 7) / 40);
166
+
167
+ dx = ((((winW * 3.8f) / (12 * 0.8105067459f)) + ((winW * 3.8f * 0.8105067459f) / 12) + (winW * 0.1473648629f) - (winH / 8) + (winH / 8) - ((((winH * 7) / 24) / (((winW * 9.1f) / 44) + (winH / 10))) * (winW / 5.5f))) / (((winH * 7) / 24) / ((((winW * 9.1f) / 44) + (winH / 10))) + (1 / 0.8105067459f)));
168
+
169
+ dy = ((((winH * 7 * dx) / 24)) / (((winW * 9.1f) / 44) + (winH / 10))) - (winH / 8) + ((((winH * 7) / 24) / (((winW * 9.1f) / 44) + (winH / 10))) * (winW / 5.5f));
170
+
171
+ axa = (winW / (5 * 0.8105067459f));
172
+
173
+ axb = ((winW * 0.8105067459f) / 5);
174
+
175
+ axc = winW * 0.1473648629f;
176
+
177
+ axd = ((winH * 7) / 40);
178
+
179
+ axe = winH / 8;
180
+
181
+ axf = axa + axb + axc - axd - axe;//分子
182
+
183
+ axg = ((winH * 66) / (winW * 40));
184
+
185
+ axh = 1.0f / 0.8105067459f;
186
+
187
+ axi = axg + axh;//分母
188
+
189
+ //ax = axf / axi;
190
+
191
+ aya = axg;
192
+
193
+ ayb = aya * ax;
194
+
195
+ ayc = axd;
196
+
197
+ //ay = ayb + ayc;
198
+
199
+ cxa = ((winW * 3.8f) / (12 * 0.8105067459f));
200
+
201
+ cxb = ((winW * 3.8f * 0.8105067459f) / 12);
202
+
203
+ cxc = winW * 0.1473648629f;
204
+
205
+ cxd = ((winH * 7) / 40);
206
+
207
+ cxe = winH / 8;
208
+
209
+ cxf = cxa + cxb + cxc - cxd - cxe;//分子
210
+
211
+ cxg = ((winH * 66) / (winW * 40));
212
+
213
+ cxh = 1.0f / 0.8105067459f;
214
+
215
+ cxi = cxg + cxh;//分母
216
+
217
+ //cx = cxf / cxi;
218
+
219
+ cya = cxg;
220
+
221
+ cyb = cya * cx;
222
+
223
+ cyc = cxd;
224
+
225
+ //cy = cyb + cyc;
226
+
227
+ zax = Math.abs(bx - c1x);
228
+
229
+ zay = Math.abs(by - c1y);
230
+
231
+ zbx = Math.abs(dx - c2x);
232
+
233
+ zby = Math.abs(dy - c2y);
234
+
235
+ ax = c1x - zax;
236
+
237
+ ay = c1y + zay;
238
+
239
+ cx = c2x - zbx;
240
+
241
+ cy = c2y + zby;
242
+
243
+ beta = ((winW * 6.5f) / (12 * 0.524455263f)) + ((winW * 6.5f * 0.524455263f) / 12) + (winW * 0.09535550236f) - (winH / 8);
244
+
245
+ alpha = ((winW * 10.0f) / (12 * 0.524455263f)) + ((winW * 10.0f * 0.524455263f) / 12) + (winW * 0.09535550236f) - (winH / 8);
246
+
247
+ c3a = (winW * 6.5f) / 12;
248
+
249
+ c3b = ((winW * 6.5f * 0.524455263f) / 12) + (winW * 0.09535550236f) - (winH / 8);
250
+
251
+ c3c = (float)(1 + Math.pow(1 / 0.524455263f, 2));
252
+
253
+ c4a = (winW * 10.0f) / 12;
254
+
255
+ c4b = ((winW * 10.0f * 0.524455263f) / 12) + (winW * 0.09535550236f) - (winH / 8);
256
+
257
+ c4c = (float)(1 + Math.pow(1 / 0.524455263f, 2));
258
+
259
+ pa1 = (float)(1 + Math.pow(1.0f / 0.524455263f, 2)); //1:e,2:f,3:g,4:h
260
+
261
+ pa2 = (float)(1 + Math.pow(1.0f / 0.524455263f, 2));
262
+
263
+ pa3 = (float)(1 + Math.pow(1.0f / 0.524455263f, 2));
264
+
265
+ pa4 = (float)(1 + Math.pow(1.0f / 0.524455263f, 2));
266
+
267
+ pb1 = c3a + (beta / 0.524455263f) - (c3b / 0.524455263f);
268
+
269
+ pb2 = c3a + (beta / 0.524455263f) - (c3b / 0.524455263f);
270
+
271
+ pb3 = c4a + (alpha / 0.524455263f) - (c4b / 0.524455263f);
272
+
273
+ pb4 = c4a + (alpha / 0.524455263f) - (c4b / 0.524455263f);
274
+
275
+ pc1 = (float)(Math.pow(c3a, 2) + Math.pow(beta, 2) - (2 * c3b * beta) + Math.pow(c3b, 2) - Math.pow(c3r, 2));
276
+
277
+ pc2 = (float)(Math.pow(c3a, 2) + Math.pow(beta, 2) - (2 * c3b * beta) + Math.pow(c3b, 2) - Math.pow(c3r, 2));
278
+
279
+ pc3 = (float)(Math.pow(c4a, 2) + Math.pow(alpha, 2) - (2 * c4b * alpha) + Math.pow(c4b, 2) - Math.pow(c4r, 2));
280
+
281
+ pc4 = (float)(Math.pow(c4a, 2) + Math.pow(alpha, 2) - (2 * c4b * alpha) + Math.pow(c4b, 2) - Math.pow(c4r, 2));
282
+
283
+ ex = (float)((pb1 - Math.sqrt(Math.pow(pb1, 2) - (pa1 * pc1))) / pa1);
284
+
285
+ ey = (((-1) * ex) / 0.524455263f) + beta;
286
+
287
+ fx = (float)((pb2 + Math.sqrt(Math.pow(pb2, 2) - (pa2 * pc2))) / pa2);
288
+
289
+ fy = (((-1) * fx) / 0.524455263f) + beta;
290
+
291
+ gx = (float)((pb3 - Math.sqrt(Math.pow(pb3, 2) - (pa3 * pc3))) / pa3);
292
+
293
+ gy = (((-1) * gx) / 0.524455263f) + alpha;
294
+
295
+ hx = (float)((pb4 + Math.sqrt(Math.pow(pb4, 2) - (pa4 * pc4))) / pa4);
296
+
297
+ hy = (((-1) * hx) / 0.524455263f) + alpha;
242
298
 
243
299
  ```
244
300
 
301
+ ###追記
302
+
303
+ マジックナンバーについて、もとはy=xなどの方程式です。なので、その意味は係数やそれに関係するものということになります。
304
+
245
305
  ![![スクリーンショット](d8aaa66f1f50d7bf9a885b403b160d24.png)](7750a4ff56bee5f1d46223e5f349d6ae.png)

4

情報追記

2017/04/25 09:43

投稿

ko20vonobird
ko20vonobird

スコア50

test CHANGED
File without changes
test CHANGED
@@ -174,4 +174,72 @@
174
174
 
175
175
  ```
176
176
 
177
+ ・図形の描画コード(文字数制限のため、抽出してます)
178
+
179
+ ```java
180
+
181
+ p2.setStyle(Paint.Style.FILL_AND_STROKE);
182
+
183
+ p2.setStrokeWidth(3);
184
+
185
+ c.drawCircle(winW - c1x, c1y, c1r, p2);
186
+
187
+ //略
188
+
189
+ p2.setStyle(Paint.Style.FILL_AND_STROKE);
190
+
191
+ p2.setStrokeWidth(3);
192
+
193
+ c.drawCircle(winW - c2x, c2y, c2r, p2);
194
+
195
+ //略
196
+
197
+ p2.setStyle(Paint.Style.FILL_AND_STROKE);
198
+
199
+ p2.setStrokeWidth(3);
200
+
201
+ c.drawCircle(winW - c3x, c3y, c3r, p2);
202
+
203
+ //略
204
+
205
+ p2.setStyle(Paint.Style.FILL_AND_STROKE);
206
+
207
+ p2.setStrokeWidth(3);
208
+
209
+ c.drawCircle(winW - c4x, c4y, c4r, p2);
210
+
211
+ //略
212
+
213
+ p2.setStyle(Paint.Style.FILL_AND_STROKE);
214
+
215
+ Path path = new Path();
216
+
217
+ path.moveTo(winW - ax, ay);
218
+
219
+ path.lineTo(winW - cx, cy);
220
+
221
+ path.lineTo(winW - dx, dy);
222
+
223
+ path.lineTo(winW - bx, by);
224
+
225
+ path.lineTo(winW - ax, ay);
226
+
227
+ c.drawPath(path, p2);
228
+
229
+ Path path2 = new Path();
230
+
231
+ path2.moveTo(winW - ex, ey);
232
+
233
+ path2.lineTo(winW - gx, gy);
234
+
235
+ path2.lineTo(winW - hx, hy);
236
+
237
+ path2.lineTo(winW - fx, fy);
238
+
239
+ path2.lineTo(winW - ex, ey);
240
+
241
+ c.drawPath(path2 , p2);
242
+
243
+ ```
244
+
177
245
  ![![スクリーンショット](d8aaa66f1f50d7bf9a885b403b160d24.png)](7750a4ff56bee5f1d46223e5f349d6ae.png)

3

情報追記

2017/04/25 08:37

投稿

ko20vonobird
ko20vonobird

スコア50

test CHANGED
File without changes
test CHANGED
@@ -18,4 +18,160 @@
18
18
 
19
19
  同時並行して調べていたのですが、タッチイベントはActivityで取得していたのですが、Viewで取得するべきなのでしょうか?
20
20
 
21
+ ###情報追記
22
+
23
+ ・仮想端末解像度:480×800: hdpi
24
+
25
+ ・実機解像度:フルHD:1080×1920
26
+
27
+ ・どのようにタッチを取得しているかわかるコード
28
+
29
+ ```java
30
+
31
+ //Activity側で取得
32
+
33
+ @Override
34
+
35
+ public boolean onTouchEvent(MotionEvent event) {
36
+
37
+ int index;
38
+
39
+ baab = 0;
40
+
41
+ Ochk = "";
42
+
43
+ Hchk = "";
44
+
45
+ Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
46
+
47
+ switch (event.getAction() & MotionEvent.ACTION_MASK) { ///MotionEventCompat.getActionMasked(event)
48
+
49
+ case MotionEvent.ACTION_DOWN:
50
+
51
+ colchk = 0;
52
+
53
+ fingnum = event.getPointerCount();
54
+
55
+ // タッチされている数だけ処理を行う。
56
+
57
+ for (int cnt = 0; cnt < fingnum; cnt++) {
58
+
59
+ pid = event.getPointerId(cnt);
60
+
61
+ index = event.findPointerIndex(pid);
62
+
63
+ tx = event.getX(index);
64
+
65
+ ty = event.getY(index);
66
+
67
+ //---以下省略
68
+
69
+ ```
70
+
71
+ ・どのように当たり判定をしているか分かるコード
72
+
73
+ ```java
74
+
75
+ public boolean Rightyoshite(float x, float y, float c1r, float c2r) {//righty=右利き,lefty=左利き
76
+
77
+ if (((y >= ((-1 * x) / 0.8105067459f) + (winW / (5 * 0.8105067459f)) + ((winW * 0.8105067459f) / 5) + (winW * 0.1473648629f) - (winH / 8)) &&
78
+
79
+ (y <= ((-1 * x) / 0.8105067459f) + ((winW * 3.8f) / (12 * 0.8105067459f)) + ((winW * 3.8f * 0.8105067459f) / 12) + (winW * 0.1473648629f) - (winH / 8)) &&
80
+
81
+ (y <= ((winH * x * 66) / (winW * 40)) + ((winH * 7) / 40)) &&
82
+
83
+ (y >= (((winH * x * 7) / 24) / (((winW * 9.1f) / 44) + (winH / 10))) - (winH / 8) + ((((winH * 7) / 24) / (((winW * 9.1f) / 44) + (winH / 10))) * (winW / 5.5f))))
84
+
85
+ || Math.sqrt(Math.pow(x - (winW / 5), 2) + Math.pow(y - (((winW * 0.8105067459f) / 5) + (winW * 0.1473648629f) - (winH / 8)), 2)) <= c1r ||
86
+
87
+ Math.sqrt(Math.pow(x - ((winW * 3.8) / 12), 2) + Math.pow(y - (((winW * 3.8f * 0.8105067459f) / 12) + (winW * 0.1473648629f) - (winH / 8)), 2)) <= c2r){
88
+
89
+ Log.d("true", "right");
90
+
91
+ return true;
92
+
93
+ }
94
+
95
+ String lc1r = String.valueOf(c1r);
96
+
97
+ Log.d("c1r", lc1r);
98
+
99
+ Log.d("false", "right");
100
+
101
+ return false;
102
+
103
+ }
104
+
105
+ public boolean Rightyhikite(float x, float y, float c3r, float c4r) {//ズレcleared
106
+
107
+ if (((y >= ((-1 * x) / 0.524455263f) + ((winW * 6.5f) / (12 * 0.524455263f)) + ((winW * 6.5f * 0.524455263f) / 12) + (winW * 0.09535550236f) - (winH / 8)) &&
108
+
109
+ (y <= ((-1 * x) / 0.524455263f) + ((winW * 10) / (12 * 0.524455263f)) + ((winW * 10 * 0.524455263f) / 12) + (winW * 0.09535550236f) - (winH / 8)) &&
110
+
111
+ (y + ((((6 * c3r) / 5) - c3r) * Math.abs(Math.sin((Math.PI * 123.3f) / 180))) <= (((winH * (x + ((((6 * c3r) / 5) - c3r) * Math.abs(Math.cos((Math.PI * 123.3f) / 180)))) * 7) / 24) / (((winW * 9.1f) / 44) + (winH / 10))) - (winH / 8) + ((((winH * 7) / 24) / (((winW * 9.1f) / 44) + (winH / 10))) * (winW / 5.5f))) &&
112
+
113
+ (y - ((((6 * c3r) / 5) - c3r) * Math.abs(Math.sin((Math.PI * 112) / 180))) >= ((winH * (x - ((((6 * c3r) / 5) - c3r) * Math.abs(Math.cos((Math.PI * 112) / 180)))) * 20.9f) / (winW * 31.2f)) + ((winH * 2) / 3) - ((winH * 20.9f) / 31.2f)))
114
+
115
+ || Math.sqrt(Math.pow(x - ((winW * 6.5f) / 12), 2) + Math.pow(y - (((winW * 6.5 * 0.524455263f) / 12) + (winW * 0.09535550236f) - (winH / 8)), 2)) <= c3r ||
116
+
117
+ Math.sqrt(Math.pow(x - ((winW * 10) / 12), 2) + Math.pow(y - (((winW * 10 * 0.524455263f) / 12) + (winW * 0.09535550236f) - (winH / 8)), 2)) <= c4r) {
118
+
119
+ return true;
120
+
121
+ }
122
+
123
+ return false;
124
+
125
+ }
126
+
127
+ //以下2メソッドについて、実機とバーチャルで違いあり。
128
+
129
+ //以下略
130
+
131
+ ```
132
+
133
+ タッチイベント内の当たり判定呼び出し部分
134
+
135
+ ```java
136
+
137
+ //onTouch内
138
+
139
+ if (colchk == 0) {
140
+
141
+ //new
142
+
143
+ if (LR.equals("right")) {
144
+
145
+ if (Rightyoshite(tx, ty, dg.getC1r(), dg.getC2r())) {
146
+
147
+ Ochk = "Oshite";
148
+
149
+ }
150
+
151
+ if (Rightyhikite(tx, ty, dg.getC3r(), dg.getC4r())) {
152
+
153
+ Hchk = "Hikite";
154
+
155
+ }
156
+
157
+ }
158
+
159
+ if (LR.equals("left")) {
160
+
161
+ if (Leftyoshite(tx, ty, dgl.getC1r(), dgl.getC2r())) {
162
+
163
+ Ochk = "Oshite";
164
+
165
+ }
166
+
167
+ if (Leftyhikite(tx, ty, dgl.getC3r(), dgl.getC4r())) {
168
+
169
+ Hchk = "Hikite";
170
+
171
+ }
172
+
173
+ }
174
+
175
+ ```
176
+
21
177
  ![![スクリーンショット](d8aaa66f1f50d7bf9a885b403b160d24.png)](7750a4ff56bee5f1d46223e5f349d6ae.png)

2

追記の記述

2017/04/25 04:18

投稿

ko20vonobird
ko20vonobird

スコア50

test CHANGED
File without changes
test CHANGED
@@ -14,4 +14,8 @@
14
14
 
15
15
  もう一つ気になったのが、これの元の画面構成は反転したものだったのですが、それは実機でも仮想でもちゃんと動いていました。
16
16
 
17
+ ・追記
18
+
19
+ 同時並行して調べていたのですが、タッチイベントはActivityで取得していたのですが、Viewで取得するべきなのでしょうか?
20
+
17
21
  ![![スクリーンショット](d8aaa66f1f50d7bf9a885b403b160d24.png)](7750a4ff56bee5f1d46223e5f349d6ae.png)

1

追記を記述

2017/04/24 14:15

投稿

ko20vonobird
ko20vonobird

スコア50

test CHANGED
File without changes
test CHANGED
@@ -10,4 +10,8 @@
10
10
 
11
11
  長文になりましたがよろしくお願いします。
12
12
 
13
+ ・追記
14
+
15
+ もう一つ気になったのが、これの元の画面構成は反転したものだったのですが、それは実機でも仮想でもちゃんと動いていました。
16
+
13
17
  ![![スクリーンショット](d8aaa66f1f50d7bf9a885b403b160d24.png)](7750a4ff56bee5f1d46223e5f349d6ae.png)