diff options
| -rw-r--r-- | src/com/fourisland/frigidearth/MapViewGameState.java | 15 | ||||
| -rw-r--r-- | src/com/fourisland/frigidearth/Tile.java | 41 |
2 files changed, 40 insertions, 16 deletions
| diff --git a/src/com/fourisland/frigidearth/MapViewGameState.java b/src/com/fourisland/frigidearth/MapViewGameState.java index f378d5a..fe32fe2 100644 --- a/src/com/fourisland/frigidearth/MapViewGameState.java +++ b/src/com/fourisland/frigidearth/MapViewGameState.java | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | */ | 4 | */ |
| 5 | package com.fourisland.frigidearth; | 5 | package com.fourisland.frigidearth; |
| 6 | 6 | ||
| 7 | import java.awt.Color; | ||
| 7 | import java.awt.Graphics2D; | 8 | import java.awt.Graphics2D; |
| 8 | import java.awt.event.KeyEvent; | 9 | import java.awt.event.KeyEvent; |
| 9 | 10 | ||
| @@ -483,7 +484,19 @@ public class MapViewGameState implements GameState | |||
| 483 | { | 484 | { |
| 484 | for (int y=viewporty; y<viewporty+VIEWPORT_HEIGHT; y++) | 485 | for (int y=viewporty; y<viewporty+VIEWPORT_HEIGHT; y++) |
| 485 | { | 486 | { |
| 486 | g.drawImage(SystemFont.getCharacter(grid[x][y].getDisplayCharacter()), (x-viewportx)*TILE_WIDTH, (y-viewporty)*TILE_HEIGHT, TILE_WIDTH, TILE_HEIGHT, null); | 487 | char displayChar = grid[x][y].getDisplayCharacter(); |
| 488 | Color displayColor = grid[x][y].getBackgroundColor(); | ||
| 489 | |||
| 490 | if (!displayColor.equals(Color.BLACK)) | ||
| 491 | { | ||
| 492 | g.setColor(displayColor); | ||
| 493 | g.fillRect((x-viewportx)*TILE_WIDTH, (y-viewporty)*TILE_HEIGHT, TILE_WIDTH, TILE_HEIGHT); | ||
| 494 | } | ||
| 495 | |||
| 496 | if (displayChar != ' ') | ||
| 497 | { | ||
| 498 | g.drawImage(SystemFont.getCharacter(grid[x][y].getDisplayCharacter()), (x-viewportx)*TILE_WIDTH, (y-viewporty)*TILE_HEIGHT, TILE_WIDTH, TILE_HEIGHT, null); | ||
| 499 | } | ||
| 487 | } | 500 | } |
| 488 | } | 501 | } |
| 489 | 502 | ||
| diff --git a/src/com/fourisland/frigidearth/Tile.java b/src/com/fourisland/frigidearth/Tile.java index e25cedd..cc128a6 100644 --- a/src/com/fourisland/frigidearth/Tile.java +++ b/src/com/fourisland/frigidearth/Tile.java | |||
| @@ -4,6 +4,8 @@ | |||
| 4 | */ | 4 | */ |
| 5 | package com.fourisland.frigidearth; | 5 | package com.fourisland.frigidearth; |
| 6 | 6 | ||
| 7 | import java.awt.Color; | ||
| 8 | |||
| 7 | /** | 9 | /** |
| 8 | * | 10 | * |
| 9 | * @author hatkirby | 11 | * @author hatkirby |
| @@ -15,11 +17,6 @@ public enum Tile | |||
| 15 | { | 17 | { |
| 16 | return true; | 18 | return true; |
| 17 | } | 19 | } |
| 18 | |||
| 19 | public char getDisplayCharacter() | ||
| 20 | { | ||
| 21 | return 'X'; | ||
| 22 | } | ||
| 23 | }, | 20 | }, |
| 24 | DirtWall { | 21 | DirtWall { |
| 25 | public boolean isBlocked() | 22 | public boolean isBlocked() |
| @@ -27,9 +24,9 @@ public enum Tile | |||
| 27 | return true; | 24 | return true; |
| 28 | } | 25 | } |
| 29 | 26 | ||
| 30 | public char getDisplayCharacter() | 27 | public Color getBackgroundColor() |
| 31 | { | 28 | { |
| 32 | return '#'; | 29 | return new Color(96, 51, 17); |
| 33 | } | 30 | } |
| 34 | }, | 31 | }, |
| 35 | DirtFloor { | 32 | DirtFloor { |
| @@ -38,9 +35,9 @@ public enum Tile | |||
| 38 | return false; | 35 | return false; |
| 39 | } | 36 | } |
| 40 | 37 | ||
| 41 | public char getDisplayCharacter() | 38 | public Color getBackgroundColor() |
| 42 | { | 39 | { |
| 43 | return ' '; | 40 | return new Color(205, 127, 50); |
| 44 | } | 41 | } |
| 45 | }, | 42 | }, |
| 46 | StoneWall { | 43 | StoneWall { |
| @@ -48,11 +45,6 @@ public enum Tile | |||
| 48 | { | 45 | { |
| 49 | return true; | 46 | return true; |
| 50 | } | 47 | } |
| 51 | |||
| 52 | public char getDisplayCharacter() | ||
| 53 | { | ||
| 54 | return 'X'; | ||
| 55 | } | ||
| 56 | }, | 48 | }, |
| 57 | Corridor { | 49 | Corridor { |
| 58 | public boolean isBlocked() | 50 | public boolean isBlocked() |
| @@ -64,6 +56,11 @@ public enum Tile | |||
| 64 | { | 56 | { |
| 65 | return '.'; | 57 | return '.'; |
| 66 | } | 58 | } |
| 59 | |||
| 60 | public Color getBackgroundColor() | ||
| 61 | { | ||
| 62 | return new Color(182, 175, 169); | ||
| 63 | } | ||
| 67 | }, | 64 | }, |
| 68 | Door { | 65 | Door { |
| 69 | public boolean isBlocked() | 66 | public boolean isBlocked() |
| @@ -75,6 +72,11 @@ public enum Tile | |||
| 75 | { | 72 | { |
| 76 | return 'D'; | 73 | return 'D'; |
| 77 | } | 74 | } |
| 75 | |||
| 76 | public Color getBackgroundColor() | ||
| 77 | { | ||
| 78 | return new Color(96, 51, 17); | ||
| 79 | } | ||
| 78 | }, | 80 | }, |
| 79 | UpStairs { | 81 | UpStairs { |
| 80 | public boolean isBlocked() | 82 | public boolean isBlocked() |
| @@ -100,5 +102,14 @@ public enum Tile | |||
| 100 | }; | 102 | }; |
| 101 | 103 | ||
| 102 | public abstract boolean isBlocked(); | 104 | public abstract boolean isBlocked(); |
| 103 | public abstract char getDisplayCharacter(); | 105 | |
| 106 | public char getDisplayCharacter() | ||
| 107 | { | ||
| 108 | return ' '; | ||
| 109 | } | ||
| 110 | |||
| 111 | public Color getBackgroundColor() | ||
| 112 | { | ||
| 113 | return Color.BLACK; | ||
| 114 | } | ||
| 104 | } | 115 | } |
