First start of adding GameStage Pipeline
This commit is contained in:
1 parent
a29b118488
commit
1a34673859
8 files changed
+24
-7
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -21,7 +21,7 @@ import java.util.TimerTask;
|
|||||||
|
|
||||||
public class CanvasView extends View
|
public class CanvasView extends View
|
||||||
{
|
{
|
||||||
//region variabelen
|
// Variabelen
|
||||||
Resources r;
|
Resources r;
|
||||||
|
|
||||||
// Sizes
|
// Sizes
|
||||||
@@ -281,17 +281,28 @@ public class CanvasView extends View
|
|||||||
|
|
||||||
Bitmap Font0, Font1, Font2, Font3, Font4, Font5, Font6, Font7, Font8, Font9;
|
Bitmap Font0, Font1, Font2, Font3, Font4, Font5, Font6, Font7, Font8, Font9;
|
||||||
|
|
||||||
|
// Score.
|
||||||
public int startLevel = 0;
|
public int startLevel = 0;
|
||||||
int level = 0;
|
int level = 0;
|
||||||
|
|
||||||
int lines = 0;
|
int lines = 0;
|
||||||
int score = 0;
|
int score = 0;
|
||||||
|
|
||||||
|
// Game State.
|
||||||
boolean GamePlaying = false;
|
boolean GamePlaying = false;
|
||||||
boolean GameOver = false;
|
boolean GameOver = false;
|
||||||
|
|
||||||
|
final int GS_STOPPED = 0;
|
||||||
|
final int GS_LOADING = 1;
|
||||||
|
final int GS_PLAYING = 2;
|
||||||
|
final int GS_GAMEOVER = 3;
|
||||||
|
final int GS_PAUSED = 4;
|
||||||
|
int GameState = GS_STOPPED;
|
||||||
|
|
||||||
|
// Add Settings.
|
||||||
public boolean PayedVersion;
|
public boolean PayedVersion;
|
||||||
|
|
||||||
|
// Timer.
|
||||||
TimerTask MoveEvent = new TimerTask() {
|
TimerTask MoveEvent = new TimerTask() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -312,8 +323,6 @@ public class CanvasView extends View
|
|||||||
|
|
||||||
MediaPlayer mp;
|
MediaPlayer mp;
|
||||||
|
|
||||||
//endregion variabelen
|
|
||||||
|
|
||||||
/// Init functions
|
/// Init functions
|
||||||
|
|
||||||
public CanvasView(Context context)
|
public CanvasView(Context context)
|
||||||
@@ -368,6 +377,8 @@ public class CanvasView extends View
|
|||||||
|
|
||||||
GamePlaying = true;
|
GamePlaying = true;
|
||||||
|
|
||||||
|
GameState = GS_PLAYING;
|
||||||
|
|
||||||
handler.removeCallbacksAndMessages(null);
|
handler.removeCallbacksAndMessages(null);
|
||||||
handler.postDelayed(runnable, 100);
|
handler.postDelayed(runnable, 100);
|
||||||
}
|
}
|
||||||
@@ -595,6 +606,8 @@ public class CanvasView extends View
|
|||||||
{
|
{
|
||||||
mp.pause();
|
mp.pause();
|
||||||
GamePlaying = false;
|
GamePlaying = false;
|
||||||
|
|
||||||
|
GameState = GS_PAUSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onResume()
|
public void onResume()
|
||||||
@@ -1231,12 +1244,13 @@ public class CanvasView extends View
|
|||||||
{
|
{
|
||||||
if (moveX >= 28 && moveX <= 55 && moveY >= 143 && moveY <= 155) // Menu
|
if (moveX >= 28 && moveX <= 55 && moveY >= 143 && moveY <= 155) // Menu
|
||||||
{
|
{
|
||||||
if (GamePlaying)
|
if (GameState == GS_PLAYING)
|
||||||
onPause();
|
onPause();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mp.start();
|
mp.start();
|
||||||
GamePlaying = true;
|
GamePlaying = true;
|
||||||
|
GameState = GS_PLAYING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1244,7 +1258,7 @@ public class CanvasView extends View
|
|||||||
|
|
||||||
if (!goingDown)
|
if (!goingDown)
|
||||||
{
|
{
|
||||||
if (GamePlaying)
|
if (GameState == GS_PLAYING)
|
||||||
{
|
{
|
||||||
if (!GameOver)
|
if (!GameOver)
|
||||||
{
|
{
|
||||||
@@ -1311,7 +1325,7 @@ public class CanvasView extends View
|
|||||||
/// Game Logic
|
/// Game Logic
|
||||||
private void GoDown()
|
private void GoDown()
|
||||||
{
|
{
|
||||||
if (GamePlaying)
|
if (GameState == GS_PLAYING)
|
||||||
{
|
{
|
||||||
if (!GameOver)
|
if (!GameOver)
|
||||||
{
|
{
|
||||||
@@ -1337,6 +1351,9 @@ public class CanvasView extends View
|
|||||||
// GameOver
|
// GameOver
|
||||||
GameOver = true;
|
GameOver = true;
|
||||||
GamePlaying = false;
|
GamePlaying = false;
|
||||||
|
|
||||||
|
GameState = GS_GAMEOVER ;
|
||||||
|
|
||||||
mp.stop();
|
mp.stop();
|
||||||
this.postInvalidate();
|
this.postInvalidate();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user