Advertisement
Ricarte

game

Apr 16th, 2023
846
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.12 KB | None | 0 0
  1. package br.com.casadocodigo.impossible;
  2. import android.content.Context;
  3. import android.view.SurfaceView;
  4.  
  5. public class Impossible extends SurfaceView implements  Runnable{
  6.     boolean running = false;
  7.     Thread renderThread = null;
  8.     public Impossible(Context context){
  9.         super(context);
  10.     }
  11.     @Override
  12.     public void run(){
  13.         //Todo Auto-generated method stub
  14.         while(running){
  15.             System.out.println("Impossible Running!");
  16.         }
  17.     }
  18.     public void resume(){
  19.         running = true;
  20.         renderThread = new Thread(this);
  21.         renderThread.start();
  22.     }
  23. }
  24. ***
  25. package br.com.casadocodigo.impossible;
  26. import android.app.Activity;
  27. import android.os.Bundle;
  28. public class ActivityGame extends Activity{
  29.     Impossible view;
  30.     @Override
  31.     protected void onCreate(Bundle savedInstanceState) {
  32.         super.onCreate(savedInstanceState);
  33.  
  34.         // Logica do jogo
  35.         view = new Impossible(this);
  36.         // Configura view
  37.         setContentView(view);
  38.         }
  39.     protected void onResume() {
  40.         super.onResume();
  41.         view.resume();
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement