Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions src/com/badlogic/androidgames/SurfaceViewTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
import android.view.Window;
import android.view.WindowManager;

// Comments
// Comments
public class SurfaceViewTest extends Activity {
FastRenderView renderView;
private FastRenderView renderView;

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -26,9 +28,8 @@ protected void onResume() {
renderView.resume();
}

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super.onPause();

// Comment
protected void onPause() {
super.onPause();
renderView.pause();
}

class FastRenderView extends SurfaceView implements Runnable {
Expand All @@ -49,20 +50,20 @@ public void resume() {

public void pause() {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[1] public void pause() {

running = false;
while(true) {
while (true) {
try {
renderThread.join();
break;
} catch (InterruptedException e) {
// retry
// Retry
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Retry

}
}
renderThread = null;
}

public void run() {
while(running) {
if(!holder.getSurface().isValid())
while (running) {
if (!holder.getSurface().isValid())
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (!holder.getSurface().isValid())

continue;

Canvas canvas = holder.lockCanvas();
Expand All @@ -72,7 +73,7 @@ public void run() {
}

private void drawSurface(Canvas canvas) {
canvas.drawRGB(255, 0, 0);
canvas.drawRGB(255, 255, 255);
}
}
}
}