Skip to content

Commit

Permalink
publishing.
Browse files Browse the repository at this point in the history
  • Loading branch information
asalga committed Aug 22, 2013
1 parent fe4bacf commit 349daf1
Showing 1 changed file with 68 additions and 49 deletions.
117 changes: 68 additions & 49 deletions Horadrix-min.pde
Original file line number Diff line number Diff line change
Expand Up @@ -540,26 +540,37 @@ public class ScreenGameplay implements IScreen, Subject{
/*
*/
public void draw(){
background(0);


if(Keyboard.isKeyDown(KEY_P)){
return;
}

background(0);
pushMatrix();

translate(START_X, START_Y);
//translate(TOKEN_SIZE/2, TOKEN_SIZE/2);
// Offset the image slighly so that it lines up with the grid of tokens.

// Draw the board background image
pushStyle();
imageMode(CORNER);
// Offset the image slighly so that it lines up with the grid of tokens.
image(bk, -13, -16);
popStyle();

// Draw the debug board with gridlines
//pushMatrix();
//translate(0, 300);
fill(33,66,99,100);
strokeWeight(1);
//fill(33,66,99,100);
//strokeWeight(1);
//rect(START_X, START_Y, BOARD_W_IN_PX, BOARD_H_IN_PX);
rect(0, 0, BOARD_W_IN_PX, BOARD_H_IN_PX);
// popMatrix();
//rect(0, 0, BOARD_W_IN_PX, BOARD_H_IN_PX);
//popMatrix();

// The dying tokens shrink and the falling tokens get rendered on top of them.
for(int i = 0; i < dyingTokens.size(); i++){
dyingTokens.get(i).draw();
}

for(int i = 0; i < floatingTokens.size(); i++){
floatingTokens.get(i).draw();
Expand All @@ -580,16 +591,11 @@ public class ScreenGameplay implements IScreen, Subject{
popStyle();
}

drawBoard();




// Draw the Dying tokens above the board as if they are coming out of it.
// So when the tokens above fall down, those falling tokens render BEHIND these ones.
for(int i = 0; i < dyingTokens.size(); i++){
dyingTokens.get(i).draw();
}


drawBoard();


// In some cases it is necessary to see the non-visible tokens
// above the visible board. Other cases, I want that part covered.
Expand All @@ -601,9 +607,9 @@ public class ScreenGameplay implements IScreen, Subject{
popStyle();

// Draw a box around the grid, just for debugging.
noFill();
stroke(255);
strokeWeight(1);
//noFill();
//stroke(255);
//strokeWeight(1);
//rect(0, 350, TOKEN_SIZE, 320);

popMatrix();
Expand All @@ -620,6 +626,8 @@ public class ScreenGameplay implements IScreen, Subject{
}
}



debug.draw();
}

Expand Down Expand Up @@ -1905,7 +1913,7 @@ public class RetroLabel extends RetroPanel{
}
}

public PImage getGlyph(char ch){
private PImage getGlyph(char ch){
if(horizontalTrimming == true){
return font.getTrimmedGlyph(ch );
}
Expand Down Expand Up @@ -2932,7 +2940,10 @@ public class Token{
*
*/
public void draw(){

if(Keyboard.isKeyDown(KEY_P)){
return;
}

pushStyle();

if( type != TokenType.NULL){
Expand Down Expand Up @@ -2970,15 +2981,15 @@ public class Token{
resetMatrix();
imageMode(CENTER);

scaleSize += animTicker.getDeltaSec() * 1.0f;
scaleSize -= animTicker.getDeltaSec() * 1.0f;

translate(START_X, START_Y);
translate(x, y);

if(scaleSize <= 0){
scaleSize = 0;
}
scale(scaleSize * 1.0f);

// TODO: fix me
tint(255, 255 - ((scaleSize - 1.0f) * 255));
}
else{
pushMatrix();
Expand All @@ -2991,11 +3002,11 @@ public class Token{
}

// Debugging
pushStyle();
noFill();
stroke(0,100,50);
//pushStyle();
//noFill();
//stroke(0, 100, 50);
//rect(0, 0, TOKEN_SIZE, TOKEN_SIZE);
popStyle();
//popStyle();

// We need to somehow distinguish tokens that have gems.
if(hasGem()){
Expand Down Expand Up @@ -3422,26 +3433,37 @@ public class ScreenGameplay implements IScreen, Subject{
/*
*/
public void draw(){
background(0);


if(Keyboard.isKeyDown(KEY_P)){
return;
}

background(0);
pushMatrix();

translate(START_X, START_Y);
//translate(TOKEN_SIZE/2, TOKEN_SIZE/2);
// Offset the image slighly so that it lines up with the grid of tokens.

// Draw the board background image
pushStyle();
imageMode(CORNER);
// Offset the image slighly so that it lines up with the grid of tokens.
image(bk, -13, -16);
popStyle();

// Draw the debug board with gridlines
//pushMatrix();
//translate(0, 300);
fill(33,66,99,100);
strokeWeight(1);
//fill(33,66,99,100);
//strokeWeight(1);
//rect(START_X, START_Y, BOARD_W_IN_PX, BOARD_H_IN_PX);
rect(0, 0, BOARD_W_IN_PX, BOARD_H_IN_PX);
// popMatrix();
//rect(0, 0, BOARD_W_IN_PX, BOARD_H_IN_PX);
//popMatrix();

// The dying tokens shrink and the falling tokens get rendered on top of them.
for(int i = 0; i < dyingTokens.size(); i++){
dyingTokens.get(i).draw();
}

for(int i = 0; i < floatingTokens.size(); i++){
floatingTokens.get(i).draw();
Expand All @@ -3462,16 +3484,11 @@ public class ScreenGameplay implements IScreen, Subject{
popStyle();
}

drawBoard();




// Draw the Dying tokens above the board as if they are coming out of it.
// So when the tokens above fall down, those falling tokens render BEHIND these ones.
for(int i = 0; i < dyingTokens.size(); i++){
dyingTokens.get(i).draw();
}


drawBoard();


// In some cases it is necessary to see the non-visible tokens
// above the visible board. Other cases, I want that part covered.
Expand All @@ -3483,9 +3500,9 @@ public class ScreenGameplay implements IScreen, Subject{
popStyle();

// Draw a box around the grid, just for debugging.
noFill();
stroke(255);
strokeWeight(1);
//noFill();
//stroke(255);
//strokeWeight(1);
//rect(0, 350, TOKEN_SIZE, 320);

popMatrix();
Expand All @@ -3502,6 +3519,8 @@ public class ScreenGameplay implements IScreen, Subject{
}
}



debug.draw();
}

Expand Down

0 comments on commit 349daf1

Please sign in to comment.