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

View File

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

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_height="match_parent"
android:background="#333"
android:padding="10dp"
tools:context=".MainActivity"
>
tools:context=".MainActivity">
<ImageView
android:layout_width="match_parent"