maj pour restore
This commit is contained in:
parent
68edb7645c
commit
e34c000f65
@ -12,6 +12,11 @@ public class HotSeatActivity extends Activity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(new GameView(this, new Saisie(), new Grille()));
|
||||
Saisie saisie = new Saisie();
|
||||
Grille grille = new Grille();
|
||||
GameView vuePartie = new GameView(this, saisie, grille);
|
||||
setContentView(vuePartie);
|
||||
new SuiviPartie(vuePartie);
|
||||
|
||||
}
|
||||
}
|
@ -5,6 +5,8 @@ import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TableLayout;
|
||||
|
||||
import com.example.mastermind.R;
|
||||
|
||||
@ -16,16 +18,24 @@ public class GameView extends View {
|
||||
private Collection<Integer> pionsAttaquant;
|
||||
private Collection<Integer> pionsDefenseur;
|
||||
private Collection<Integer> pionsPasPlaces;
|
||||
private TableLayout grilleView;
|
||||
private TableLayout notation1View;
|
||||
private TableLayout notation2View;
|
||||
private LinearLayout buttonsView;
|
||||
private LinearLayout choixView;
|
||||
private LinearLayout selectionView;
|
||||
private Saisie saisie;
|
||||
private Grille grille;
|
||||
private Paint circle;
|
||||
private Context context;
|
||||
public GameView(Context context,Saisie saisie,Grille grille) {
|
||||
super(context);
|
||||
this.context=context;
|
||||
this.saisie=saisie;
|
||||
this.grille=grille;
|
||||
this.setOnTouchListener(new TouchListener());
|
||||
//on initialise les collections de pions
|
||||
initpions();
|
||||
createViews();
|
||||
this.circle = new Paint();
|
||||
}
|
||||
|
||||
@ -69,6 +79,15 @@ public class GameView extends View {
|
||||
invalidate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//Créer les vues nécessaires pour le jeu
|
||||
public void createViews(){
|
||||
LinearLayout parent = new LinearLayout(this.context);
|
||||
parent.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
||||
parent.setOrientation(LinearLayout.HORIZONTAL);
|
||||
}
|
||||
//initialise les collections de pions
|
||||
public void initpions(){
|
||||
//on initialise les pions
|
||||
|
@ -1,22 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
@ -4,9 +4,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#333"
|
||||
android:padding="10dp"
|
||||
tools:context=".MainActivity"
|
||||
>
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
|
Loading…
Reference in New Issue
Block a user