-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
NativeGLSurfaceView.java
68 lines (59 loc) · 1.35 KB
/
NativeGLSurfaceView.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
* Copyright 2013 Dolphin Emulator Project
* Licensed under GPLv2
* Refer to the license.txt file included.
*/
package org.dolphinemu.dolphinemu;
import android.content.Context;
import android.util.AttributeSet;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
/**
* The surface that rendering is done to.
*/
public final class NativeGLSurfaceView extends SurfaceView
{
private static Thread myRun;
private static boolean Running = false;
private static boolean Created = false;
/**
* Constructor.
*
* @param context The current {@link Context}.
*/
public NativeGLSurfaceView(Context context, AttributeSet attribs)
{
super(context, attribs);
if (!Created)
{
myRun = new Thread()
{
@Override
public void run() {
NativeLibrary.Run(getHolder().getSurface());
}
};
getHolder().addCallback(new SurfaceHolder.Callback()
{
public void surfaceCreated(SurfaceHolder holder)
{
// TODO Auto-generated method stub
if (!Running)
{
myRun.start();
Running = true;
}
}
public void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2, int arg3)
{
// TODO Auto-generated method stub
}
public void surfaceDestroyed(SurfaceHolder arg0)
{
// TODO Auto-generated method stub
}
});
Created = true;
}
}
}