maj pour restore

This commit is contained in:
Haïssous Kayyissa 2023-04-05 17:10:36 +02:00
parent 68edb7645c
commit e34c000f65
4 changed files with 27 additions and 27 deletions

View File

@ -12,6 +12,11 @@ public class HotSeatActivity extends Activity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(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);
} }
} }

View File

@ -5,6 +5,8 @@ import android.graphics.Canvas;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Paint; import android.graphics.Paint;
import android.view.View; import android.view.View;
import android.widget.LinearLayout;
import android.widget.TableLayout;
import com.example.mastermind.R; import com.example.mastermind.R;
@ -16,16 +18,24 @@ public class GameView extends View {
private Collection<Integer> pionsAttaquant; private Collection<Integer> pionsAttaquant;
private Collection<Integer> pionsDefenseur; private Collection<Integer> pionsDefenseur;
private Collection<Integer> pionsPasPlaces; 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 Saisie saisie;
private Grille grille; private Grille grille;
private Paint circle; private Paint circle;
private Context context;
public GameView(Context context,Saisie saisie,Grille grille) { public GameView(Context context,Saisie saisie,Grille grille) {
super(context); super(context);
this.context=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();
createViews();
this.circle = new Paint(); this.circle = new Paint();
} }
@ -69,6 +79,15 @@ public class GameView extends View {
invalidate(); 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 //initialise les collections de pions
public void initpions(){ public void initpions(){
//on initialise les pions //on initialise les pions

View File

@ -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;
}
}

View File

@ -4,9 +4,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#333" android:background="#333"
android:padding="10dp" tools:context=".MainActivity">
tools:context=".MainActivity"
>
<ImageView <ImageView
android:layout_width="match_parent" android:layout_width="match_parent"