forked from helloplz/MazeBuilder
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added simple renderers for board and players.
- Loading branch information
1 parent
ac38858
commit 227cace
Showing
10 changed files
with
98 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
Mazebuilder/src/com/mazebuilder/renderer/ChaserPlayerRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.mazebuilder.renderer; | ||
|
||
import org.newdawn.slick.Color; | ||
import org.newdawn.slick.Graphics; | ||
|
||
public final class ChaserPlayerRenderer implements PlayerRenderer { | ||
|
||
@Override | ||
public void drawPlayer(Graphics g, int x, int y, int tileWidth, int tileHeight) { | ||
g.setColor(Color.red); | ||
g.fillRoundRect(x, y, tileWidth, tileHeight, Math.min(tileHeight, tileWidth) / 2); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
Mazebuilder/src/com/mazebuilder/renderer/RunnerPlayerRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.mazebuilder.renderer; | ||
|
||
import org.newdawn.slick.Color; | ||
import org.newdawn.slick.Graphics; | ||
|
||
public final class RunnerPlayerRenderer implements PlayerRenderer { | ||
|
||
@Override | ||
public void drawPlayer(Graphics g, int x, int y, int tileWidth, int tileHeight) { | ||
g.setColor(Color.green); | ||
g.fillRoundRect(x, y, tileWidth, tileHeight, Math.min(tileHeight, tileWidth) / 2); | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
Mazebuilder/src/com/mazebuilder/renderer/SimpleBoardRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.mazebuilder.renderer; | ||
|
||
import org.newdawn.slick.Color; | ||
import org.newdawn.slick.Graphics; | ||
|
||
public final class SimpleBoardRenderer implements BoardRenderer { | ||
|
||
private static final int TILE_HEIGHT = 64; | ||
private static final int TILE_WIDTH = 64; | ||
private static final int WALL_SHORT_SIDE = 16; | ||
|
||
@Override | ||
public int tileHeight() { | ||
return TILE_HEIGHT; | ||
} | ||
|
||
@Override | ||
public int tileWidth() { | ||
return TILE_WIDTH; | ||
} | ||
|
||
@Override | ||
public int wallShortSideLength() { | ||
return WALL_SHORT_SIDE; | ||
} | ||
|
||
@Override | ||
public void drawTile(Graphics g, int x, int y) { | ||
g.setColor(Color.cyan); | ||
g.fillRect(x, y, TILE_WIDTH, TILE_HEIGHT); | ||
} | ||
|
||
@Override | ||
public void drawWall(Graphics g, int x, int y, boolean horizontal) { | ||
g.setColor(Color.red); | ||
if (horizontal) { | ||
g.fillRoundRect(x, y, TILE_WIDTH, WALL_SHORT_SIDE, 4); | ||
} else { | ||
g.fillRoundRect(x, y, WALL_SHORT_SIDE, TILE_HEIGHT, 4); | ||
} | ||
} | ||
|
||
@Override | ||
public void drawNoWall(Graphics g, int x, int y, boolean horizontal) { | ||
g.setColor(Color.lightGray); | ||
if (horizontal) { | ||
g.fillRoundRect(x, y, TILE_WIDTH, WALL_SHORT_SIDE, 4); | ||
} else { | ||
g.fillRoundRect(x, y, WALL_SHORT_SIDE, TILE_HEIGHT, 4); | ||
} | ||
} | ||
|
||
@Override | ||
public void drawCorner(Graphics g, int x, int y) { | ||
g.setColor(Color.green); | ||
g.fillRoundRect(x, y, WALL_SHORT_SIDE, WALL_SHORT_SIDE, 8); | ||
} | ||
|
||
} |