The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.3KB

  1. package com.roli.juce;
  2. import android.content.Context;
  3. import android.graphics.Canvas;
  4. import android.view.SurfaceView;
  5. public class JuceOpenGLView extends SurfaceView
  6. {
  7. private long host = 0;
  8. JuceOpenGLView (Context context, long nativeThis)
  9. {
  10. super (context);
  11. host = nativeThis;
  12. }
  13. public void cancel ()
  14. {
  15. host = 0;
  16. }
  17. //==============================================================================
  18. @Override
  19. protected void onAttachedToWindow ()
  20. {
  21. super.onAttachedToWindow ();
  22. if (host != 0)
  23. onAttchedWindowNative (host);
  24. }
  25. @Override
  26. protected void onDetachedFromWindow ()
  27. {
  28. if (host != 0)
  29. onDetachedFromWindowNative (host);
  30. super.onDetachedFromWindow ();
  31. }
  32. @Override
  33. protected void dispatchDraw (Canvas canvas)
  34. {
  35. super.dispatchDraw (canvas);
  36. if (host != 0)
  37. onDrawNative (host, canvas);
  38. }
  39. //==============================================================================
  40. private native void onAttchedWindowNative (long nativeThis);
  41. private native void onDetachedFromWindowNative (long nativeThis);
  42. private native void onDrawNative (long nativeThis, Canvas canvas);
  43. }