Project

General

Profile

Download (2.3 KB) Statistics
| Branch: | Revision:

examples / src / main / java / org / distorted / examples / flatblur2 / OverlayGeneric.java @ 99a80c08

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2022 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is proprietary software licensed under an EULA which you should have received      //
7
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html        //
8
///////////////////////////////////////////////////////////////////////////////////////////////////
9

    
10
package org.distorted.examples.flatblur2;
11

    
12
import org.distorted.library.main.DistortedScreen;
13

    
14
import java.lang.reflect.Method;
15

    
16
///////////////////////////////////////////////////////////////////////////////////////////////////
17

    
18
public abstract class OverlayGeneric
19
{
20
   private enum Overlays
21
      {
22
      STARS ( OverlayStars.class )
23
      ;
24

    
25
      private final Class<? extends OverlayGeneric> mClass;
26

    
27
      Overlays(Class<? extends OverlayGeneric> clazz)
28
         {
29
         mClass = clazz;
30
         }
31
      }
32

    
33
///////////////////////////////////////////////////////////////////////////////////////////////////
34

    
35
   public static void enableEffects()
36
     {
37
     Method method;
38

    
39
     for(Overlays overlay: Overlays.values() )
40
        {
41
        try
42
          {
43
          method = overlay.mClass.getDeclaredMethod("enableEffects");
44
          }
45
        catch(NoSuchMethodException ex)
46
          {
47
          android.util.Log.e("OverlayGeneric", overlay.mClass.getSimpleName()+": exception getting method: "+ex.getMessage());
48
          method = null;
49
          }
50

    
51
        try
52
          {
53
          if( method!=null ) method.invoke(null);
54
          }
55
        catch(Exception ex)
56
          {
57
          android.util.Log.e("OverlayGeneric", overlay.mClass.getSimpleName()+": exception invoking method: "+ex.getMessage());
58
          }
59
        }
60
      }
61

    
62
///////////////////////////////////////////////////////////////////////////////////////////////////
63

    
64
   public abstract long startOverlay(DistortedScreen screen, ListenerOverlay listener, DataGeneric data);
65
}
(7-7/8)