New Icon and Thumbnails for wads

This commit is contained in:
Simon 2016-03-05 11:34:12 +00:00
parent ca1d92e24c
commit 21cc2a3a67
14 changed files with 90 additions and 43 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View file

@ -24,9 +24,13 @@ class DownloadTask extends AsyncTask<Void, String, Void> {
public boolean please_abort = false; public boolean please_abort = false;
private String url = "https://www.dropbox.com/s/whngowjwpkwjht2/freedoom.zip?dl=1"; private String url = "https://github.com/freedoom/freedoom/releases/download/v0.10.1/freedoom-0.10.1.zip";
private String freedoomZip = DoomTools.GetDVRFolder() + "/freedoom.zip"; private String freedoomZip = DoomTools.GetDVRFolder() + "/freedoom-0.10.1.zip";
private String wadfile = DoomTools.GetDVRFolder() + "/freedoom.wad";
//OLD Freedom
//private String url = "https://www.dropbox.com/s/whngowjwpkwjht2/freedoom.zip?dl=1";
//private String freedoomZip = DoomTools.GetDVRFolder() + "/freedoom.zip";
//private String wadfile = DoomTools.GetDVRFolder() + "/freedoom.wad";
public DownloadTask set_context(Context context){ public DownloadTask set_context(Context context){
this.context = context; this.context = context;
@ -157,7 +161,11 @@ class DownloadTask extends AsyncTask<Void, String, Void> {
Log.i("DownloadTask.java", "extracting WAD data"); Log.i("DownloadTask.java", "extracting WAD data");
ZipFile file = new ZipFile (freedoomZip); ZipFile file = new ZipFile (freedoomZip);
extract_file( file, "freedoom.wad", wadfile); //extract_file( file, "freedoom-0.10.1\\COPYING", DoomTools.GetDVRFolder() + File.separator + "COPYING.txt");
//extract_file( file, "freedoom-0.10.1\\CREDITS", DoomTools.GetDVRFolder() + File.separator + "CREDITS.txt");
extract_file( file, "freedoom-0.10.1/README.html", DoomTools.GetDVRFolder() + File.separator + "README.html");
extract_file( file, "freedoom-0.10.1/freedoom1.wad", DoomTools.GetDVRFolder() + File.separator + "freedoom1.wad");
extract_file( file, "freedoom-0.10.1/freedoom2.wad", DoomTools.GetDVRFolder() + File.separator + "freedoom2.wad");
file.close(); file.close();
@ -177,6 +185,7 @@ class DownloadTask extends AsyncTask<Void, String, Void> {
String short_name = new File(output_name).getName(); String short_name = new File(output_name).getName();
// create output directory // create output directory
publishProgress("Extracting Freedoom Zip" );
new File(output_name).getParentFile().mkdirs(); new File(output_name).getParentFile().mkdirs();
ZipEntry entry = file.getEntry(entry_name); ZipEntry entry = file.getEntry(entry_name);

View file

@ -205,7 +205,7 @@ public class MainActivity
// set dialog message // set dialog message
alertDialogBuilder alertDialogBuilder
.setMessage("Would you like to download the free FREEDOOM WAD (8MB)?\n\nIf you own or purchase the full game of Doom/Doom2 (or any other wad)you can click \'Cancel\' and copy the WAD file to the folder:\n\n{phonememory}/DVR") .setMessage("Would you like to download the free Freedoom WADs (17.5MB)?\n\nIf you own or purchase the full game of Doom/Doom2 (or any other wad)you can click \'Cancel\' and copy the WAD file to the folder:\n\n{phonememory}/DVR")
.setCancelable(false) .setCancelable(false)
.setPositiveButton("Download", new DialogInterface.OnClickListener() { .setPositiveButton("Download", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) { public void onClick(DialogInterface dialog, int id) {
@ -275,6 +275,8 @@ public class MainActivity
GLES20.glActiveTexture(GLES20.GL_TEXTURE0); GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, splashTexture[0]); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, splashTexture[0]);
openGL.CopyBitmapToTexture(bmp, splashTexture[0]); openGL.CopyBitmapToTexture(bmp, splashTexture[0]);
bmp.recycle();
} }
@Override @Override
@ -322,7 +324,7 @@ public class MainActivity
public void onDrawEye(Eye eye) { public void onDrawEye(Eye eye) {
if (!mShowingSpashScreen && mWADChooser.choosingWAD()) if (!mShowingSpashScreen && mWADChooser.choosingWAD())
{ {
mWADChooser.onDrawEye(eye); mWADChooser.onDrawEye(eye, this);
} }
else if (mDVRInitialised || mShowingSpashScreen) { else if (mDVRInitialised || mShowingSpashScreen) {
@ -483,6 +485,8 @@ public class MainActivity
mPlayer.stop(); mPlayer.stop();
mPlayer.release(); mPlayer.release();
mShowingSpashScreen = false; mShowingSpashScreen = false;
mWADChooser.Initialise();
} }
} }

View file

@ -1,17 +1,25 @@
package com.drbeef.dvr; package com.drbeef.dvr;
import android.content.Context;
import android.content.res.AssetManager;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.Rect;
import android.opengl.GLES20; import android.opengl.GLES20;
import android.opengl.Matrix; import android.opengl.Matrix;
import android.util.Pair;
import com.google.vrtoolkit.cardboard.Eye; import com.google.vrtoolkit.cardboard.Eye;
import java.io.File; import java.io.File;
import java.io.InputStream;
import java.nio.IntBuffer; import java.nio.IntBuffer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import doom.util.DoomTools; import doom.util.DoomTools;
import doom.util.Natives; import doom.util.Natives;
@ -22,12 +30,22 @@ import doom.util.Natives;
public class WADChooser { public class WADChooser {
OpenGL openGL = null; OpenGL openGL = null;
List<String> wads = new ArrayList<String>(); List<String> wads = new ArrayList<String>();
Map<String, String> wadThumbnails = new HashMap<String, String>();
private int selectedWAD = 0; private int selectedWAD = 0;
WADChooser(OpenGL openGL) { WADChooser(OpenGL openGL) {
this.openGL = openGL; this.openGL = openGL;
}
public void Initialise()
{
wadThumbnails.put(new String("doom.wad"), new String("d1.png"));
wadThumbnails.put(new String("doom2.wad"), new String("d2.png"));
wadThumbnails.put(new String("freedoom.wad"), new String("fd.png"));
wadThumbnails.put(new String("freedoom1.wad"), new String("fd1.png"));
wadThumbnails.put(new String("freedoom2.wad"), new String("fd2.png"));
File[] files = new File(DoomTools.GetDVRFolder()).listFiles(); File[] files = new File(DoomTools.GetDVRFolder()).listFiles();
@ -71,14 +89,32 @@ public class WADChooser {
selectedWAD = wads.size()-1; selectedWAD = wads.size()-1;
} }
void DrawWADName() void DrawWADName(Context ctx)
{ {
// Create an empty, mutable bitmap // Create an empty, mutable bitmap
Bitmap bitmap = Bitmap.createBitmap(256, 256, Bitmap.Config.ARGB_4444); Bitmap bitmap = Bitmap.createBitmap(256, 256, Bitmap.Config.ARGB_4444);
// get a canvas to paint over the bitmap // get a canvas to paint over the bitmap
Canvas canvas = new Canvas(bitmap); Canvas canvas = new Canvas(bitmap);
bitmap.eraseColor(0); bitmap.eraseColor(0);
Paint paint = new Paint();
if (wadThumbnails.containsKey(GetChosenWAD().toLowerCase())) {
try {
AssetManager assets = ctx.getAssets();
InputStream in = assets.open("thumbnails/" + wadThumbnails.get(GetChosenWAD().toLowerCase()));
Bitmap thumbnail = BitmapFactory.decodeStream(in);
in.close();
canvas.drawBitmap(thumbnail, null, new Rect(0, 0, 256, 200), paint);
} catch (Exception e) {
e.printStackTrace();
}
}
// get a background image from resources // get a background image from resources
// note the image format must match the bitmap format // note the image format must match the bitmap format
// Drawable background = context.getResources().getDrawable(R.drawable.background); // Drawable background = context.getResources().getDrawable(R.drawable.background);
@ -86,21 +122,19 @@ public class WADChooser {
// background.draw(canvas); // draw the background to our bitmap // background.draw(canvas); // draw the background to our bitmap
// Draw the text // Draw the text
Paint textPaint = new Paint(); paint.setTextSize(20);
textPaint.setTextSize(20);
textPaint.setAntiAlias(true); paint.setAntiAlias(true);
textPaint.setARGB(0xff, 0xff, 0x20, 0x00); paint.setARGB(0xff, 0xff, 0x20, 0x00);
// draw the text centered // draw the text centered
canvas.drawText("Choose WAD:", 16, 60, textPaint); canvas.drawText("<- " + GetChosenWAD() + " ->", 16, 220, paint);
canvas.drawText("<- " + GetChosenWAD() + " ->", 16, 112, textPaint);
openGL.CopyBitmapToTexture(bitmap, openGL.fbo.ColorTexture[0]); openGL.CopyBitmapToTexture(bitmap, openGL.fbo.ColorTexture[0]);
} }
public void onDrawEye(Eye eye) { public void onDrawEye(Eye eye, Context ctx) {
DrawWADName(); DrawWADName(ctx);
GLES20.glEnable(GLES20.GL_SCISSOR_TEST); GLES20.glEnable(GLES20.GL_SCISSOR_TEST);
GLES20.glScissor(eye.getViewport().x, eye.getViewport().y, GLES20.glScissor(eye.getViewport().x, eye.getViewport().y,

View file

@ -35,7 +35,7 @@ public class DoomTools {
// Game files we can handle // Game files we can handle
public static final String[] DOOM_WADS = public static final String[] DOOM_WADS =
{"freedoom.wad", "freedm.wad", "doom.wad", "doom2.wad"}; {"freedoom.wad", "freedoom1.wad", "freedoom2.wad", "freedm.wad", "doom.wad", "doom2.wad"};
// These are required for the game to run // These are required for the game to run
public static final String REQUIRED_DOOM_WAD = "prboom.wad"; public static final String REQUIRED_DOOM_WAD = "prboom.wad";

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 17 KiB