Skip to content

Commit

Permalink
start screen chooser
Browse files Browse the repository at this point in the history
  • Loading branch information
awlzac committed Jul 21, 2015
1 parent 75f88d7 commit e90c387
Show file tree
Hide file tree
Showing 8 changed files with 231 additions and 62 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "com.bulsy.wbtempest"
minSdkVersion 11
targetSdkVersion 21
versionCode 7
versionName "1.0.4a"
versionCode 8
versionName "1.0.5"
}
buildTypes {
release {
Expand Down
64 changes: 36 additions & 28 deletions app/src/main/java/com/bulsy/wbtempest/Board.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ public Board() {
columns = new ArrayList<Column>();
}

public void init(View v, int levnum) {
public void init(int width, int height, int levnum) {
int ncols;
int colsPerSide;
this.levnum = levnum;

int cx = v.getWidth()/2; // center for drawing; not same as where z-axis goes to.
int cy = v.getHeight() * 25/60; // buttons at bottom of screen, so "center" is usually a little high of actual screen center
int cx = width/2; // center for drawing; not same as where z-axis goes to.
int cy = height * 25/60; // buttons at bottom of screen, so "center" is usually a little high of actual screen center

zpull_x = v.getWidth()/2; // where z-axis goes; default z pull to be just low of center.
zpull_y = v.getHeight() *33/60;
zpull_x = width/2; // where z-axis goes; default z pull to be just low of center.
zpull_y = height *33/60;

continuous = false;
boolean firsttime = true;
Expand All @@ -62,7 +62,7 @@ else if (levnum < FIRST_SPIKE_LEVEL*2)
else spikespct = (float) 1;
float rad_dist;
float step;
int radius = (int)(v.getWidth()*0.48); // consistent-ish radius for levels that have one
int radius = (int)(width*0.48); // consistent-ish radius for levels that have one
columns.clear();

// if we run out of screens....cycle
Expand All @@ -77,8 +77,8 @@ else if (levnum < FIRST_SPIKE_LEVEL*2)
step = rad_dist/(ncols);
for (float rads=0; rads < rad_dist+step/2; rads+=step)
{
x = cx - (int)(Math.sin(rads) * radius * .95);
y = cy - (int)(Math.cos(rads) * radius);
x = cx - (int)(Math.sin(rads) * radius * .94);
y = cy - (int)(Math.cos(rads) * radius *.99);
if (firsttime){
firsttime = false;
}
Expand All @@ -95,9 +95,11 @@ else if (levnum < FIRST_SPIKE_LEVEL*2)
continuous = true;
ncols = 16;
colsPerSide = ncols/4;
radius *= .95;
radius = (int)(width*0.43); // smaller radius for square
int cwid = radius*2/colsPerSide;
int i;
// left
for (x = cx - radius, y = cy-radius; y < cy+radius; y+=(radius*2/colsPerSide)){
for (x = cx - radius, y = cy-radius, i=0; i < colsPerSide; y+=cwid, i++){
if (firsttime){
firsttime = false;
}
Expand All @@ -109,31 +111,35 @@ else if (levnum < FIRST_SPIKE_LEVEL*2)
oldy = y;
}
// bottom
for (x = cx - radius, y = cy+radius; x < cx+radius; x+=(radius*2/colsPerSide)){
// for (x = cx - radius, y = cy+radius; x < cx+radius; x+=(radius*2/colsPerSide)){
for (i=0; i < colsPerSide; i++, x+=cwid){
Column col = new Column(oldx, oldy, x, y);
columns.add(col);
oldx = x;
oldy = y;
}
// right
for (x = cx + radius, y = cy+radius; y > cy-radius; y-=(radius*2/colsPerSide)){
// for (x = cx + radius, y = cy+radius; y > cy-radius; y-=(radius*2/colsPerSide)){
for (i=0; i< colsPerSide; i++, y-=cwid){
Column col = new Column(oldx, oldy, x, y);
columns.add(col);
oldx = x;
oldy = y;
}
// top
for (x = cx + radius, y = cy-radius; x >= cx-radius; x-=(radius*2/colsPerSide)){
// for (x = cx + radius, y = cy-radius; x >= cx-radius; x-=(radius*2/colsPerSide)){
for (i=0; i<colsPerSide; i++, x-=cwid){
Column col = new Column(oldx, oldy, x, y);
columns.add(col);
oldx = x;
oldy = y;
}
columns.add(new Column(oldx, oldy, x, y));
break;

case 2: // plus
continuous = true;
int colwidth = v.getWidth()/5;
int colwidth = width/5;
zpull_x=cx;
zpull_y= cy+(int)(colwidth*0.8);
x = oldx = cx-colwidth;
Expand Down Expand Up @@ -198,7 +204,7 @@ else if (levnum < FIRST_SPIKE_LEVEL*2)
int cxc = (int)((float)cx * .44);
//radius = (int)((cx - cxc)*0.81f);
radius = (int)((cx - cxc)*0.89f);
int i = 0;
i = 0;
for (float rads=-1.5f*step; rads < rad_dist-step*1.5; rads+=step)
{
x = cxc - (int)(Math.sin(rads) * radius * .90);
Expand Down Expand Up @@ -242,9 +248,8 @@ else if (levnum < FIRST_SPIKE_LEVEL*2)
//radius = 320;
ncols = 15;
colsPerSide = ncols/3;
// cy = v.getHeight()*11/20;
zpull_x = v.getWidth()/2;
zpull_y = v.getHeight() *29/60;
zpull_x = width/2;
zpull_y = height *29/60;
// left
for (x = cx, y = cy-radius; y < cy+radius*4/5; y+=(radius*4/3/colsPerSide),x-=radius*3/4/colsPerSide){
if (firsttime){
Expand Down Expand Up @@ -278,13 +283,16 @@ else if (levnum < FIRST_SPIKE_LEVEL*2)
oldx = x;
oldy = y;
}
// force rounding error mess to go away
Column lastcol = columns.get(columns.size()-1);
lastcol.setFrontPoint2(columns.get(0).getFrontPoint1());
break;

case 5: // straight, angled V
ncols = 16;
// need a different z-pull for a board using this screen
zpull_x = cx;
zpull_y = v.getHeight() /4;
zpull_y = height /4;
int yhi = cy/3;
int ylow = cy*5/3;
int ydist = ylow-yhi;
Expand All @@ -303,10 +311,10 @@ else if (levnum < FIRST_SPIKE_LEVEL*2)
break;

case 6: // jagged V
zpull_x = v.getWidth()/2;
zpull_y = v.getHeight() /5;
zpull_x = width/2;
zpull_y = height /5;
int total_cols = 15; // must be ODD
int xcolwidth = (int) Math.floor(v.getWidth()/(total_cols/2 + 1)); // should be enough
int xcolwidth = (int) Math.floor(width/(total_cols/2 + 1)); // should be enough
int ycolwidth = xcolwidth * 5/4;
int ystart;
x = oldx = cx - (int)(xcolwidth*3.5);
Expand Down Expand Up @@ -338,8 +346,8 @@ else if (levnum < FIRST_SPIKE_LEVEL*2)
radius *= .9;
rad_dist = (float) (Math.PI); // half circ
step = rad_dist/(ncols);
zpull_x = v.getWidth()/2;
zpull_y = v.getHeight()*17/28;
zpull_x = width/2;
zpull_y = height*17/28;
int xradius=0, orgy=0, straightstepdist=0;
for (double rads=0; rads < Math.PI+step/2; rads+=step)
{
Expand All @@ -366,10 +374,10 @@ else if (levnum < FIRST_SPIKE_LEVEL*2)
case 8: // straight line
ncols = 14;
// need a different z-pull for a board using this screen
zpull_x = v.getWidth()/2;
zpull_y = v.getHeight() /4;
y = v.getHeight() * 4/7;
for (x = v.getWidth() *1/(ncols+1); x < v.getWidth() * (1+ncols)/(ncols+2); x+= v.getWidth()/(ncols+2)){
zpull_x = width/2;
zpull_y = height /4;
y = height * 4/7;
for (x = width *1/(ncols+1); x < width * (1+ncols)/(ncols+2); x+= width/(ncols+2)){
if (firsttime){
firsttime = false;
}
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/com/bulsy/wbtempest/Column.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@ public int[] getFrontPoint1(){
public int[] getFrontPoint2(){
return point2;
}

public void setFrontPoint2(int[] point) {
point2 = point;
}
}
Loading

0 comments on commit e90c387

Please sign in to comment.