Skip to content

Commit

Permalink
OPENGL starts with no problems
Browse files Browse the repository at this point in the history
  • Loading branch information
jgzuke committed May 15, 2015
1 parent 21ee941 commit 69e0eab
Show file tree
Hide file tree
Showing 33 changed files with 370 additions and 103 deletions.
Binary file modified .gradle/2.2.1/taskArtifacts/cache.properties.lock
Binary file not shown.
Binary file modified .gradle/2.2.1/taskArtifacts/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/2.2.1/taskArtifacts/fileSnapshots.bin
Binary file not shown.
Binary file modified .gradle/2.2.1/taskArtifacts/outputFileStates.bin
Binary file not shown.
Binary file modified .gradle/2.2.1/taskArtifacts/taskArtifacts.bin
Binary file not shown.
4 changes: 3 additions & 1 deletion .idea/libraries/support_v4_21_0_3.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

266 changes: 227 additions & 39 deletions .idea/workspace.xml

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified app/build/intermediates/dex/debug/classes.dex
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<merger version="3"><dataSet config="21.0.3"><source path="/Users/jgzuke/Desktop/CODE/DrawingGame/app/build/intermediates/exploded-aar/com.android.support/support-v4/21.0.3/assets"/></dataSet><dataSet config="main"><source path="/Users/jgzuke/Desktop/CODE/DrawingGame/app/src/main/assets"/></dataSet><dataSet config="debug"><source path="/Users/jgzuke/Desktop/CODE/DrawingGame/app/src/debug/assets"/></dataSet></merger>
<merger version="3"><dataSet config="main"><source path="/Users/jgzuke/Desktop/CODE/DrawingGame/app/src/main/assets"/></dataSet><dataSet config="debug"><source path="/Users/jgzuke/Desktop/CODE/DrawingGame/app/src/debug/assets"/></dataSet></merger>
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<uses-sdk
android:minSdkVersion="18"
android:targetSdkVersion="21" />

<!-- Tell the system this app requires OpenGL ES 2.0. -->
<uses-feature
android:glEsVersion="0x00030000"
android:glEsVersion="0x00020000"
android:required="true" />

<application
Expand Down
Binary file modified app/build/intermediates/resources/resources-debug.ap_
Binary file not shown.
Binary file modified app/build/outputs/apk/app-debug-unaligned.apk
Binary file not shown.
Binary file modified app/build/outputs/apk/app-debug.apk
Binary file not shown.
36 changes: 18 additions & 18 deletions app/build/outputs/logs/manifest-merger-debug-report.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,38 +24,38 @@ MERGED from com.android.support:support-v4:21.0.3:15:5
ADDED from AndroidManifest.xml:8:9
INJECTED from AndroidManifest.xml:0:0
INJECTED from AndroidManifest.xml:0:0
uses-feature#0x00030000
ADDED from AndroidManifest.xml:10:5
uses-feature#0x00020000
ADDED from AndroidManifest.xml:11:5
android:glEsVersion
ADDED from AndroidManifest.xml:10:19
ADDED from AndroidManifest.xml:11:19
android:required
ADDED from AndroidManifest.xml:10:52
ADDED from AndroidManifest.xml:11:52
application
ADDED from AndroidManifest.xml:12:5
ADDED from AndroidManifest.xml:13:5
MERGED from com.android.support:support-v4:21.0.3:16:5
android:label
ADDED from AndroidManifest.xml:15:9
ADDED from AndroidManifest.xml:16:9
android:allowBackup
ADDED from AndroidManifest.xml:13:9
android:icon
ADDED from AndroidManifest.xml:14:9
android:icon
ADDED from AndroidManifest.xml:15:9
android:theme
ADDED from AndroidManifest.xml:16:9
ADDED from AndroidManifest.xml:17:9
activity#com.drawinggame.StartActivity
ADDED from AndroidManifest.xml:17:9
ADDED from AndroidManifest.xml:18:9
android:screenOrientation
ADDED from AndroidManifest.xml:20:13
ADDED from AndroidManifest.xml:21:13
android:label
ADDED from AndroidManifest.xml:19:13
ADDED from AndroidManifest.xml:20:13
android:name
ADDED from AndroidManifest.xml:18:13
ADDED from AndroidManifest.xml:19:13
intent-filter#android.intent.action.MAIN+android.intent.category.LAUNCHER
ADDED from AndroidManifest.xml:21:13
ADDED from AndroidManifest.xml:22:13
action#android.intent.action.MAIN
ADDED from AndroidManifest.xml:22:17
ADDED from AndroidManifest.xml:23:17
android:name
ADDED from AndroidManifest.xml:22:25
ADDED from AndroidManifest.xml:23:25
category#android.intent.category.LAUNCHER
ADDED from AndroidManifest.xml:24:17
ADDED from AndroidManifest.xml:25:17
android:name
ADDED from AndroidManifest.xml:24:27
ADDED from AndroidManifest.xml:25:27
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<uses-sdk
android:minSdkVersion="18"
android:targetSdkVersion="21" />
<uses-feature android:glEsVersion="0x00030000" android:required="true" />
<!-- Tell the system this app requires OpenGL ES 2.0. -->
<uses-feature android:glEsVersion="0x00020000" android:required="true" />

<application
android:allowBackup="true"
Expand Down
12 changes: 7 additions & 5 deletions app/src/main/java/com/drawinggame/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ public final class Controller
protected SelectionSpriteController selectionSpriteController;
protected WallController wallController;
protected LevelController levelController;
protected GraphicsController graphicsController;
//protected GraphicsController graphicsController;
protected MyGLSurfaceView graphicsController;
protected SoundController soundController;

protected boolean paused = false;
protected Runnable frameCaller = new Runnable()
{
Expand Down Expand Up @@ -95,7 +96,7 @@ public Controller(Context startSet, StartActivity activitySet, double [] dimensi
spriteController = new SpriteController(startSet, this);
spriteController.playerGameControl.setEnemies(true);
spriteController.enemyGameControl.setEnemies(false);
Log.e("myid", "sprite, wall, sound, gesture: ".concat(Long.toString((System.nanoTime()-time)/100000)));
Log.e("myid", "sprite, wall, sound, gesture: ".concat(Long.toString((System.nanoTime() - time) / 100000)));

time = System.nanoTime();
imageLibrary = new ImageLibrary(startSet, this, (int)dimensions[0], (int)dimensions[1]); // creates image library
Expand All @@ -105,10 +106,11 @@ public Controller(Context startSet, StartActivity activitySet, double [] dimensi
levelController = new LevelController(this);
levelController.loadLevel(1);
spriteController.setMapSize(levelController);
Log.e("myid", "levelControl: ".concat(Long.toString((System.nanoTime()-time)/100000)));
Log.e("myid", "levelControl: ".concat(Long.toString((System.nanoTime() - time) / 100000)));

time = System.nanoTime();
graphicsController = new GraphicsController(this, imageLibrary, spriteController, wallController, levelController, startSet, dimensions);
graphicsController = new MyGLSurfaceView(context);
//graphicsController = new GraphicsController(this, imageLibrary, spriteController, wallController, levelController, startSet, dimensions);
graphicsController.setOnTouchListener(gestureDetector);
gestureDetector.setGraphics(graphicsController);
Log.e("myid", "graphicsControl: ".concat(Long.toString((System.nanoTime()-time)/100000)));
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/drawinggame/Game_Control.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ abstract public class Game_Control
protected Controller control;
protected SpriteController spriteControl;
protected double mana;
protected double manaGain = 0.3;
protected double manaGain = 0.2;
protected int startMana = 200;
protected double maxMana = 500;
protected double score = 0;
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/drawinggame/GestureDetector.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class GestureDetector implements OnTouchListener
protected Recognizer recognizer;
protected String selectType = "none";
protected Long fadeTime = (long) 50000;
private GraphicsController graphics = null;
private MyGLSurfaceView graphics = null;
int ID = 0;

private Path lastShape;
Expand Down Expand Up @@ -70,7 +70,7 @@ public GestureDetector(Context contextSet, Controller controllerSet, int widthSe
average.add(new Point(0,0));
}
}
protected void setGraphics(GraphicsController graphicsSet)
protected void setGraphics(MyGLSurfaceView graphicsSet)
{
graphics = graphicsSet;
}
Expand Down
27 changes: 27 additions & 0 deletions app/src/main/java/com/drawinggame/MyGLRenderer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.drawinggame;

import android.opengl.GLSurfaceView;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

/**
* Created by jgzuke on 15-05-15.
*/
public class MyGLRenderer implements GLSurfaceView.Renderer {

@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {

}

@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {

}

@Override
public void onDrawFrame(GL10 gl) {

}
}
66 changes: 66 additions & 0 deletions app/src/main/java/com/drawinggame/MyGLSurfaceView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package com.drawinggame;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.opengl.GLSurfaceView;
import android.util.AttributeSet;
/**
* Created by jgzuke on 15-05-15.
*/
public class MyGLSurfaceView extends GLSurfaceView {
private Renderer mRenderer;

protected double playScreenSize = 1;
protected double playScreenSizeMax = 1;
protected int mapXSlide = 0;
protected int mapYSlide = 0;
protected int curXShift;
protected int curYShift;
protected int phoneWidth;
private int spacing = 10;
protected int phoneHeight;
protected double unitWidth;
protected double unitHeight;
protected Paint paint = new Paint();
protected Matrix rotateImages = new Matrix();
private int manaColor = Color.rgb(30, 0, 170);
private int manaColorDark = Color.rgb(20, 0, 110);
private int manaColorCover = Color.argb(50, 255, 255, 255);
private ImageLibrary imageLibrary;
private Controller control;
private SpriteController spriteController;
private LevelController levelController;
private int grassGreen = Color.rgb(51, 102, 0);
private Context context;
protected boolean [] drawSection = new boolean[4]; // top left middle right
Bitmap saveCanvas = null;

public MyGLSurfaceView(Context context) {
super(context);
mRenderer = new MyGLRenderer();
setRenderer(mRenderer);
}

public MyGLSurfaceView(Context context, AttributeSet attrs) {
super(context, attrs);
mRenderer = new MyGLRenderer();
setRenderer(mRenderer);
}
protected void frameCall()
{
//invalidate();
}
@ Override
public void onPause()
{
super.onPause();
}
@ Override
public void onResume()
{
super.onResume();
}
}
41 changes: 8 additions & 33 deletions app/src/main/java/com/drawinggame/SpriteController.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ protected void clearObjectArrays()
* @param type whether they are warrior, archer, mage etc
* @param x x to walk to
* @param y y to wakl to
* @param r rotation
* @param isOnPlayersTeam which team they are on
*/
protected void makeEnemy(int type, int x, int y, boolean isOnPlayersTeam)
Expand Down Expand Up @@ -392,7 +391,7 @@ protected void drawStructures(Canvas g, Paint paint, ImageLibrary imageLibrary)
drawFlat(enemyStructures.get(i), g, paint);
}
}
protected void drawFog(Canvas g, Paint paint)
protected void drawFog(Canvas g)
{
int wide = visibilityMap.length;
boolean[][] visibleEdge= new boolean[wide][wide];
Expand All @@ -414,33 +413,12 @@ protected void drawFog(Canvas g, Paint paint)
if(visibleEdge[i][j])
{
visibleEdgeCounts[i][j] = connectingEdges(i, j, visibleEdge, wide);
/*if(visibleEdgeCounts[i][j] == 1)
{
int pX = i*fogSize;
int pY = j*fogSize;
g.drawRect(pX, pY, pX + fogSize, pY + fogSize, paint);
}
if(visibleEdgeCounts[i][j] == 2)
{
paint.setColor(Color.argb(100, 0, 0, 255));
int pX = i*fogSize;
int pY = j*fogSize;
g.drawRect(pX, pY, pX + fogSize, pY + fogSize, paint);
paint.setColor(Color.argb(100, 255, 0, 0));
}*/
}
}
}
Vector<Point> points = new Vector<Point>();
addToEdgePath(points, visibleEdgeCounts);
g.drawPath(getPathFromVector(points), fogPaint);
/*fogPaint.setColor(Color.argb(50, 0, 0, 0));
fogPaint.setStyle(Style.FILL);
g.drawPath(getPathFromVector(points), fogPaint);
fogPaint.setColor(Color.rgb(0, 0, 0));
fogPaint.setStyle(Style.STROKE);
fogPaint.setStrokeWidth(1);
g.drawPath(getPathFromVector(points), fogPaint);*/
}
protected int fogSize = 40;
private int skip = 1;
Expand All @@ -457,13 +435,12 @@ protected Path getPathFromVector(Vector<Point> points)
Point p;
for(int j = 0; j < points.size() - 1; j+=2)
{
p = (Point) points.get(j);
p = points.get(j);
Point n = points.get(j + 1);
//path.quadTo((int)p.X, (int)p.Y, (int)n.X, (int)n.Y);
path.lineTo((int)p.X, (int)p.Y);
path.lineTo((int)n.X, (int)n.Y);
}
p = (Point) points.get(points.size() - 1);
p = points.get(points.size() - 1);
path.lineTo((int)p.X, (int)p.Y);
path.lineTo(-50, -50);
return path;
Expand Down Expand Up @@ -591,8 +568,7 @@ protected void getVisibilityMap()
/**
* creates an enemy power ball
* @param rotation rotation of Proj_Tracker
* @param xVel horizontal velocity of ball
* @param yVel vertical velocity of ball
* @param Vel Velocity of ball
* @param power power of ball
* @param x x position
* @param y y position
Expand Down Expand Up @@ -628,8 +604,6 @@ protected void createProj_TrackerBurst(double x, double y, double power, boolean
protected boolean onScreen(double x, double y, int width, int height) {return true;}
/**
* selects enemy with click
* @param x click x
* @param y click y
* @return whether anything was selected
*/
protected void selectCircle(Vector<Point> points)
Expand Down Expand Up @@ -906,7 +880,7 @@ protected void drawSprites(Canvas g, Paint paint, ImageLibrary imageLibrary)
{
drawAOE(proj_TrackerA_AOEs.get(i), g, paint);
}
drawFog(g, paint);
drawFog(g);
}
private boolean spriteOnScreen(Sprite s)
{
Expand All @@ -929,10 +903,11 @@ private boolean pointOnScreen(double x, double y)
return true;
}
protected boolean mapPointOnScreen(double x2, double y2)
{ // reversed one
{
// reversed one
//double x2 = xR + x*R
// x = (x2-xR)/R
GraphicsController g = control.graphicsController;
MyGLSurfaceView g = control.graphicsController;
double screenX = (x2-g.mapXSlide)/g.playScreenSize;
double screenY = (y2-g.mapYSlide)/g.playScreenSize;
return (screenX>0 && screenY>0 && screenX<g.phoneWidth && screenY<g.phoneHeight);
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/java/com/drawinggame/StartActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ public void onResume()
readSaveData();
}*/
control.soundController.startMusic();
if (control.graphicsController != null) {
control.graphicsController.onResume();
}
}
/**
* stops music, stops timer, saves data
Expand All @@ -114,6 +117,9 @@ public void onPause()
control.activityPaused = true;
Log.e("mine", "onPau");
//control.paused = true;
if (control.graphicsController != null) {
control.graphicsController.onPause();
}
}
@ Override
public void onStop()
Expand Down
Binary file modified build/intermediates/gradle_project_sync_data.bin
Binary file not shown.

0 comments on commit 69e0eab

Please sign in to comment.