ajout listener
This commit is contained in:
		@@ -23,6 +23,7 @@ public class GameView extends View {
 | 
				
			|||||||
        super(context);
 | 
					        super(context);
 | 
				
			||||||
        this.saisie=saisie;
 | 
					        this.saisie=saisie;
 | 
				
			||||||
        this.grille=grille;
 | 
					        this.grille=grille;
 | 
				
			||||||
 | 
					        this.setOnTouchListener(new TouchListener());
 | 
				
			||||||
        //on initialise les collections de pions
 | 
					        //on initialise les collections de pions
 | 
				
			||||||
        initpions();
 | 
					        initpions();
 | 
				
			||||||
        this.circle = new Paint();
 | 
					        this.circle = new Paint();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,22 @@
 | 
				
			|||||||
 | 
					package com.example.mastermind.game;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import android.view.MotionEvent;
 | 
				
			||||||
 | 
					import android.view.View;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class TouchListener implements View.OnTouchListener{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public TouchListener(){}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public boolean onTouch(View v, MotionEvent event) {
 | 
				
			||||||
 | 
					        int action = event.getActionMasked();
 | 
				
			||||||
 | 
					        Float x = event.getX();
 | 
				
			||||||
 | 
					        Float y = event.getY();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (action==MotionEvent.ACTION_UP)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return true;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user