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
|
@TargetApi(Build.VERSION_CODES.KITKAT)
void buildMap( int val ){
FileOutputStream fOut = null;
OutputStreamWriter osw = null;
InputStream strem ;
deleteFile("map" + val );
try{
fOut = openFileOutput("map" + val, Context.MODE_APPEND);
osw = new OutputStreamWriter(fOut);
int xx = 150, yy = 48;
int sX = getCurrentFocus().getWidth();
int sY = getCurrentFocus().getHeight();
int valX = sX/6 ;
int valY = (sX/6)/4;
int c1 = 0, c2 = 0, vS = valX/4 ;
String wordd = "sea" ;
int sizeY = 0;
for ( int cont = 0 ; cont < 1500 ; cont ++ )
{
osw.write( wordd + ' ' + ( valX*c1 + vS + valX/4 ) + ' ' + valY*c2 + ' ');
c1 ++ ;
if (c1 > 20 ){ c1 = 0 ; c2++ ; vS = -vS ; sizeY ++ ;}
if ( cont == 200 ){ wordd = "desert";}
}
}
catch (Exception e){
}
finally {
try {
osw.close();
fOut.close();
} catch (IOException e) {
}
}
} |
Partager