Use explicit modifiers for Android code.
This commit is contained in:
parent
016799060a
commit
1931919e2e
5 changed files with 57 additions and 58 deletions
|
@ -9,9 +9,9 @@ using System;
|
||||||
|
|
||||||
namespace OpenTK.Platform.Android
|
namespace OpenTK.Platform.Android
|
||||||
{
|
{
|
||||||
class AndroidDisplayDeviceDriver : IDisplayDeviceDriver
|
internal class AndroidDisplayDeviceDriver : IDisplayDeviceDriver
|
||||||
{
|
{
|
||||||
static DisplayDevice dev;
|
private static DisplayDevice dev;
|
||||||
static AndroidDisplayDeviceDriver ()
|
static AndroidDisplayDeviceDriver ()
|
||||||
{
|
{
|
||||||
dev = new DisplayDevice ();
|
dev = new DisplayDevice ();
|
||||||
|
|
|
@ -10,7 +10,7 @@ using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace OpenTK.Platform.Android
|
namespace OpenTK.Platform.Android
|
||||||
{
|
{
|
||||||
sealed class AndroidFactory : PlatformFactoryBase
|
internal sealed class AndroidFactory : PlatformFactoryBase
|
||||||
{
|
{
|
||||||
public override IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
|
public override IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,28 +32,28 @@ namespace OpenTK.Platform.Android
|
||||||
[Register ("opentk_1_1/platform/android/AndroidGameView")]
|
[Register ("opentk_1_1/platform/android/AndroidGameView")]
|
||||||
public partial class AndroidGameView : GameViewBase, ISurfaceHolderCallback
|
public partial class AndroidGameView : GameViewBase, ISurfaceHolderCallback
|
||||||
{
|
{
|
||||||
bool disposed;
|
private bool disposed;
|
||||||
System.Timers.Timer timer;
|
private System.Timers.Timer timer;
|
||||||
Java.Util.Timer j_timer;
|
private Java.Util.Timer j_timer;
|
||||||
ISurfaceHolder mHolder;
|
private ISurfaceHolder mHolder;
|
||||||
GLCalls gl;
|
private GLCalls gl;
|
||||||
AndroidWindow windowInfo;
|
private AndroidWindow windowInfo;
|
||||||
Object ticking = new Object ();
|
private Object ticking = new Object ();
|
||||||
bool stopped = true;
|
private bool stopped = true;
|
||||||
bool renderOn = false;
|
private bool renderOn = false;
|
||||||
bool sizeChanged = false;
|
private bool sizeChanged = false;
|
||||||
bool requestRender = false;
|
private bool requestRender = false;
|
||||||
bool autoSetContextOnRenderFrame = true;
|
private bool autoSetContextOnRenderFrame = true;
|
||||||
bool renderOnUIThread = true;
|
private bool renderOnUIThread = true;
|
||||||
bool callMakeCurrent = false;
|
private bool callMakeCurrent = false;
|
||||||
CancellationTokenSource source;
|
private CancellationTokenSource source;
|
||||||
Task renderTask;
|
private Task renderTask;
|
||||||
Thread renderingThread;
|
private Thread renderingThread;
|
||||||
ManualResetEvent pauseSignal;
|
private ManualResetEvent pauseSignal;
|
||||||
global::Android.Graphics.Rect surfaceRect;
|
private global::Android.Graphics.Rect surfaceRect;
|
||||||
Size size;
|
private Size size;
|
||||||
System.Diagnostics.Stopwatch stopWatch;
|
private System.Diagnostics.Stopwatch stopWatch;
|
||||||
double tick = 0;
|
private double tick = 0;
|
||||||
|
|
||||||
[Register (".ctor", "(Landroid/content/Context;)V", "")]
|
[Register (".ctor", "(Landroid/content/Context;)V", "")]
|
||||||
public AndroidGameView (Context context) : base (context)
|
public AndroidGameView (Context context) : base (context)
|
||||||
|
@ -202,7 +202,7 @@ namespace OpenTK.Platform.Android
|
||||||
GraphicsContext.SwapBuffers ();
|
GraphicsContext.SwapBuffers ();
|
||||||
}
|
}
|
||||||
|
|
||||||
double updates;
|
private double updates;
|
||||||
public override void Run ()
|
public override void Run ()
|
||||||
{
|
{
|
||||||
EnsureUndisposed ();
|
EnsureUndisposed ();
|
||||||
|
@ -248,18 +248,18 @@ namespace OpenTK.Platform.Android
|
||||||
ResumeThread ();
|
ResumeThread ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadInternal (EventArgs e)
|
private void LoadInternal (EventArgs e)
|
||||||
{
|
{
|
||||||
OnLoad (e);
|
OnLoad (e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnloadInternal (EventArgs e)
|
private void UnloadInternal (EventArgs e)
|
||||||
{
|
{
|
||||||
OnUnload (e);
|
OnUnload (e);
|
||||||
DestroyFrameBuffer ();
|
DestroyFrameBuffer ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderFrameInternal (FrameEventArgs e)
|
private void RenderFrameInternal (FrameEventArgs e)
|
||||||
{
|
{
|
||||||
#if TIMING
|
#if TIMING
|
||||||
Mark ();
|
Mark ();
|
||||||
|
@ -301,7 +301,7 @@ namespace OpenTK.Platform.Android
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void UpdateFrameInternal (FrameEventArgs e)
|
private void UpdateFrameInternal (FrameEventArgs e)
|
||||||
{
|
{
|
||||||
if (!ReadyToRender)
|
if (!ReadyToRender)
|
||||||
return;
|
return;
|
||||||
|
@ -309,19 +309,19 @@ namespace OpenTK.Platform.Android
|
||||||
OnUpdateFrame (e);
|
OnUpdateFrame (e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnsureUndisposed ()
|
private void EnsureUndisposed ()
|
||||||
{
|
{
|
||||||
if (disposed)
|
if (disposed)
|
||||||
throw new ObjectDisposedException ("");
|
throw new ObjectDisposedException ("");
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssertContext ()
|
private void AssertContext ()
|
||||||
{
|
{
|
||||||
if (GraphicsContext == null)
|
if (GraphicsContext == null)
|
||||||
throw new InvalidOperationException ("Operation requires a GraphicsContext, which hasn't been created yet.");
|
throw new InvalidOperationException ("Operation requires a GraphicsContext, which hasn't been created yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateSurface()
|
private void CreateSurface()
|
||||||
{
|
{
|
||||||
if (GraphicsContext == null)
|
if (GraphicsContext == null)
|
||||||
{
|
{
|
||||||
|
@ -337,13 +337,13 @@ namespace OpenTK.Platform.Android
|
||||||
MakeCurrent();
|
MakeCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DestroySurface()
|
private void DestroySurface()
|
||||||
{
|
{
|
||||||
log("DestroySurface");
|
log("DestroySurface");
|
||||||
windowInfo.DestroySurface();
|
windowInfo.DestroySurface();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateContext ()
|
private void CreateContext ()
|
||||||
{
|
{
|
||||||
log ("CreateContext");
|
log ("CreateContext");
|
||||||
|
|
||||||
|
@ -354,7 +354,7 @@ namespace OpenTK.Platform.Android
|
||||||
GraphicsContext = new GraphicsContext(GraphicsMode, WindowInfo, (int)ContextRenderingApi, 0, GraphicsContextFlags.Embedded);
|
GraphicsContext = new GraphicsContext(GraphicsMode, WindowInfo, (int)ContextRenderingApi, 0, GraphicsContextFlags.Embedded);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DestroyContext ()
|
private void DestroyContext ()
|
||||||
{
|
{
|
||||||
if (GraphicsContext != null) {
|
if (GraphicsContext != null) {
|
||||||
GraphicsContext.Dispose ();
|
GraphicsContext.Dispose ();
|
||||||
|
@ -362,11 +362,11 @@ namespace OpenTK.Platform.Android
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int restartCounter = 0;
|
private int restartCounter = 0;
|
||||||
public int RenderThreadRestartRetries { get; set; }
|
public int RenderThreadRestartRetries { get; set; }
|
||||||
public Exception RenderThreadException;
|
public Exception RenderThreadException;
|
||||||
|
|
||||||
void StartThread ()
|
private void StartThread ()
|
||||||
{
|
{
|
||||||
log ("StartThread");
|
log ("StartThread");
|
||||||
|
|
||||||
|
@ -441,7 +441,7 @@ namespace OpenTK.Platform.Android
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void StopThread ()
|
private void StopThread ()
|
||||||
{
|
{
|
||||||
log ("StopThread");
|
log ("StopThread");
|
||||||
restartCounter = 0;
|
restartCounter = 0;
|
||||||
|
@ -458,7 +458,7 @@ namespace OpenTK.Platform.Android
|
||||||
if (stopWatch != null) stopWatch.Stop ();
|
if (stopWatch != null) stopWatch.Stop ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PauseThread ()
|
private void PauseThread ()
|
||||||
{
|
{
|
||||||
log ("PauseThread");
|
log ("PauseThread");
|
||||||
restartCounter = 0;
|
restartCounter = 0;
|
||||||
|
@ -469,7 +469,7 @@ namespace OpenTK.Platform.Android
|
||||||
renderOn = false;
|
renderOn = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResumeThread ()
|
private void ResumeThread ()
|
||||||
{
|
{
|
||||||
log ("ResumeThread");
|
log ("ResumeThread");
|
||||||
restartCounter = 0;
|
restartCounter = 0;
|
||||||
|
@ -483,19 +483,19 @@ namespace OpenTK.Platform.Android
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReadyToRender {
|
private bool ReadyToRender {
|
||||||
get { return windowInfo.HasSurface && renderOn && !stopped; }
|
get { return windowInfo.HasSurface && renderOn && !stopped; }
|
||||||
}
|
}
|
||||||
|
|
||||||
DateTime prevUpdateTime;
|
private DateTime prevUpdateTime;
|
||||||
DateTime prevRenderTime;
|
private DateTime prevRenderTime;
|
||||||
DateTime curUpdateTime;
|
private DateTime curUpdateTime;
|
||||||
DateTime curRenderTime;
|
private DateTime curRenderTime;
|
||||||
FrameEventArgs updateEventArgs = new FrameEventArgs();
|
private FrameEventArgs updateEventArgs = new FrameEventArgs();
|
||||||
FrameEventArgs renderEventArgs = new FrameEventArgs();
|
private FrameEventArgs renderEventArgs = new FrameEventArgs();
|
||||||
|
|
||||||
// this method is called on the main thread if RenderOnUIThread is true
|
// this method is called on the main thread if RenderOnUIThread is true
|
||||||
void RunIteration (CancellationToken token)
|
private void RunIteration (CancellationToken token)
|
||||||
{
|
{
|
||||||
if (token.IsCancellationRequested)
|
if (token.IsCancellationRequested)
|
||||||
return;
|
return;
|
||||||
|
@ -558,7 +558,7 @@ namespace OpenTK.Platform.Android
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GLCalls GLCalls {
|
private GLCalls GLCalls {
|
||||||
get {
|
get {
|
||||||
if (gl == null || gl.Version != ContextRenderingApi)
|
if (gl == null || gl.Version != ContextRenderingApi)
|
||||||
gl = GLCalls.GetGLCalls (ContextRenderingApi);
|
gl = GLCalls.GetGLCalls (ContextRenderingApi);
|
||||||
|
@ -566,7 +566,7 @@ namespace OpenTK.Platform.Android
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IGraphicsContext Context {
|
private IGraphicsContext Context {
|
||||||
get { return GraphicsContext; }
|
get { return GraphicsContext; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -588,7 +588,7 @@ namespace OpenTK.Platform.Android
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GLVersion api;
|
private GLVersion api;
|
||||||
public GLVersion ContextRenderingApi
|
public GLVersion ContextRenderingApi
|
||||||
{
|
{
|
||||||
get {
|
get {
|
||||||
|
|
|
@ -16,8 +16,7 @@ using OpenTK.Graphics;
|
||||||
using OpenTK.Platform.Egl;
|
using OpenTK.Platform.Egl;
|
||||||
|
|
||||||
namespace OpenTK.Platform.Android {
|
namespace OpenTK.Platform.Android {
|
||||||
|
internal class AndroidGraphicsContext : EglContext
|
||||||
class AndroidGraphicsContext : EglContext
|
|
||||||
{
|
{
|
||||||
public AndroidGraphicsContext(GraphicsMode mode, EglWindowInfo window, IGraphicsContext sharedContext,
|
public AndroidGraphicsContext(GraphicsMode mode, EglWindowInfo window, IGraphicsContext sharedContext,
|
||||||
int major, int minor, GraphicsContextFlags flags)
|
int major, int minor, GraphicsContextFlags flags)
|
||||||
|
@ -39,8 +38,8 @@ namespace OpenTK.Platform.Android {
|
||||||
|
|
||||||
public class AndroidWindow : IWindowInfo, IDisposable
|
public class AndroidWindow : IWindowInfo, IDisposable
|
||||||
{
|
{
|
||||||
bool disposed;
|
private bool disposed;
|
||||||
WeakReference refHolder;
|
private WeakReference refHolder;
|
||||||
private EglWindowInfo eglWindowInfo;
|
private EglWindowInfo eglWindowInfo;
|
||||||
|
|
||||||
// Get native window from surface
|
// Get native window from surface
|
||||||
|
@ -136,7 +135,7 @@ namespace OpenTK.Platform.Android {
|
||||||
GC.SuppressFinalize (this);
|
GC.SuppressFinalize (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dispose (bool disposing)
|
private void Dispose (bool disposing)
|
||||||
{
|
{
|
||||||
if (!disposed)
|
if (!disposed)
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,7 +19,7 @@ using ES30 = OpenTK.Graphics.ES30;
|
||||||
|
|
||||||
namespace OpenTK
|
namespace OpenTK
|
||||||
{
|
{
|
||||||
sealed class GLCalls
|
internal sealed class GLCalls
|
||||||
{
|
{
|
||||||
public GLVersion Version;
|
public GLVersion Version;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue