Project

General

Profile

« Previous | Next » 

Revision 7cfeeb63

Added by Leszek Koltunski almost 8 years ago

Progress with Save app.

View differences:

src/main/AndroidManifest.xml
6 6

  
7 7
    <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="23" />
8 8
    <uses-feature android:glEsVersion="0x00020000" android:required="true" />
9
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
9 10

  
10 11
    <application android:icon="@drawable/icon" android:label="@string/app_name" android:allowBackup="true" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
11 12
        <activity android:name=".TableOfContents">
src/main/java/org/distorted/examples/save/SaveActivity.java
69 69

  
70 70
    public void Save(View v)
71 71
      {
72
      android.util.Log.e("SAVE", "Save button!!");
72
      SaveRenderer.Save();
73 73
      }
74 74

  
75 75
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/save/SaveRenderer.java
1 1

  
2 2
package org.distorted.examples.save;
3 3

  
4
import java.io.File;
4 5
import java.io.IOException;
5 6
import java.io.InputStream;
6 7

  
......
21 22
import android.graphics.BitmapFactory;
22 23
import android.opengl.GLES20;
23 24
import android.opengl.GLSurfaceView;
25
import android.os.Environment;
24 26

  
25 27
///////////////////////////////////////////////////////////////////////////////////////////////////
26 28

  
27 29
class SaveRenderer implements GLSurfaceView.Renderer 
28 30
{
29 31
    private GLSurfaceView mView;
30
    private DistortedBitmap mGirl;
32
    private static DistortedBitmap mGirl;
31 33
    private Float2D pLeft, pRight;
32 34
    private Float4D sinkRegion;
33 35
    private static Interpolator1D diSink;
......
67 69
     s0.set(boobsSink);
68 70
     }
69 71

  
72
///////////////////////////////////////////////////////////////////////////////////////////////////
73

  
74
   public static void Save()
75
     {
76
     File file;
77
     String filePath;
78
     int lowestNotFound = 1;
79

  
80
     while(true)
81
       {
82
       filePath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + "/girl" + lowestNotFound +".png";
83
       file = new File(filePath);
84

  
85
       if( !file.exists() )
86
         {
87
         android.util.Log.e("SAVE", "Saving to "+file.getAbsolutePath());
88
         mGirl.savePNG(file.getAbsolutePath());
89
         break;
90
         }
91
       lowestNotFound++;
92
       }
93
     }
94

  
70 95
///////////////////////////////////////////////////////////////////////////////////////////////////
71 96
   
72 97
   public void onDrawFrame(GL10 glUnused) 

Also available in: Unified diff