@@ -7,22 +7,19 @@ public class Screen {
77
88 private static final byte BIT_MIRROR_X = 0x01 ;
99 private static final byte BIT_MIRROR_Y = 0x02 ;
10-
10+ private final SpriteSheet sheet ;
1111 private int [] pixels ;
12-
1312 private int xOffset = 0 ;
1413 private int yOffset = 0 ;
15-
1614 private int width ;
1715 private int height ;
1816
19- private SpriteSheet sheet ;
20-
2117 /**
2218 * Constructs the draw area
23- * @param width width of the screen
19+ *
20+ * @param width width of the screen
2421 * @param height height of the screen
25- * @param sheet Sprite-sheet selector. Constructed Spritesheet needs to be here,
22+ * @param sheet Sprite-sheet selector. Constructed sprite sheet needs to be here,
2623 * Sprite-sheet cp requires path only.
2724 */
2825 public Screen (int width , int height , SpriteSheet sheet ) {
@@ -34,23 +31,24 @@ public Screen(int width, int height, SpriteSheet sheet) {
3431 setPixels (new int [width * height ]);
3532 }
3633
34+ @ SuppressWarnings ("unused" )
3735 public static int getMapWidthMask () {
3836 return MAP_WIDTH_MASK ;
3937 }
4038
4139
4240 /**
43- * Rendering sprites from Spritesheet onto the game world.
44- * Render contstucter requires
45- * @param xPos X Postion of subject
46- * @param yPos Y Postion of subject
47- * @param tile tile location. e.g 7 * 32 + 1 is the oblong bullet on the 7th row 2nd colomn
48- * @param colour Using established colouring nomanclature. i.e. use com.redomar.game.gfx.Colours
49- * @param mirrorDir flip Direction: 0x01 flip verticle, 0x02 flip horizontal.
50- * @param scale Scale
41+ * Rendering sprites from sprite sheet onto the game world.
42+ * Render constructor requires
43+ *
44+ * @param xPos X Position of subject
45+ * @param yPos Y Position of subject
46+ * @param tile tile location. e.g 7 * 32 + 1 is the oblong bullet on the 7th row 2nd column
47+ * @param colour Using established colouring nomenclature. i.e. use com.redomar.game.gfx.Colours
48+ * @param mirrorDir flip Direction: 0x01 flip vertical, 0x02 flip horizontal.
49+ * @param scale Scale
5150 */
52- public void render (int xPos , int yPos , int tile , int colour , int mirrorDir ,
53- int scale ) {
51+ public void render (int xPos , int yPos , int tile , int colour , int mirrorDir , int scale ) {
5452 xPos -= xOffset ;
5553 yPos -= yOffset ;
5654
@@ -80,26 +78,22 @@ public void render(int xPos, int yPos, int tile, int colour, int mirrorDir,
8078
8179 int xPixel = x + xPos + (x * scaleMap ) - ((scaleMap << 3 ) / 2 );
8280
83- int col = (colour >> (sheet .pixels [xSheet + ySheet
84- * sheet .getWidth () + tileOffset ] * 8 )) & 255 ;
81+ int col = (colour >> (sheet .pixels [xSheet + ySheet * sheet .getWidth () + tileOffset ] * 8 )) & 255 ;
8582 if (col < 255 ) {
8683
8784 for (int yScale = 0 ; yScale < scale ; yScale ++) {
8885
89- if (yPixel + yScale < 0
90- | yPixel + yScale >= getHeight ()) {
86+ if (yPixel + yScale < 0 | yPixel + yScale >= getHeight ()) {
9187 continue ;
9288 }
9389
9490 for (int xScale = 0 ; xScale < scale ; xScale ++) {
9591
96- if (xPixel + xScale < 0
97- | xPixel + xScale >= getWidth ()) {
92+ if (xPixel + xScale < 0 | xPixel + xScale >= getWidth ()) {
9893 continue ;
9994 }
10095
101- getPixels ()[(xPixel + xScale ) + (yPixel + yScale )
102- * getWidth ()] = col ;
96+ getPixels ()[(xPixel + xScale ) + (yPixel + yScale ) * getWidth ()] = col ;
10397 }
10498 }
10599
0 commit comments