View Javadoc

1   package erland.game.tileadventure;
2   
3   /*
4    * Copyright (C) 2004 Erland Isaksson (erland_i@hotmail.com)
5    *
6    * This program is free software; you can redistribute it and/or
7    * modify it under the terms of the GNU General Public License
8    * as published by the Free Software Foundation; either version 2
9    * of the License, or (at your option) any later version.
10   *
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU General Public License for more details.
15   *
16   * You should have received a copy of the GNU General Public License
17   * along with this program; if not, write to the Free Software
18   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19   * 
20   */
21  
22  public abstract class BlockContainerData implements IrregularBlockContainerInterface {
23      /***
24       * Horizontal scrolling offset in pixels
25       */
26      private int scrollingOffsetX;
27      /***
28       * Vertical scrolling offset in pixels
29       */
30      private int scrollingOffsetY;
31      /***
32       * The X offset in pixels
33       */
34      protected int offsetX;
35      /***
36       * The Y offset in pixels
37       */
38      protected int offsetY;
39      /***
40       * Number of horizontal blocks
41       */
42      protected int sizeX;
43      /***
44       * Number of vertical blocks
45       */
46      protected int sizeY;
47      /***
48       * Number of height blocks
49       */
50      protected int sizeZ;
51      /***
52       * The horizontal size of a single block in pixels
53       */
54      protected int squareSizeX;
55      /***
56       * The vertical size of a single block in pixels
57       */
58      protected int squareSizeY;
59      /***
60       * The height of a single block in pixels
61       */
62      protected int squareSizeZ;
63      /***
64       * Number of visible horizontal blocks
65       */
66      protected int visibleSizeX;
67      /***
68       * Number of visible vertical blocks
69       */
70      protected int visibleSizeY;
71  
72      public BlockContainerData() {
73          scrollingOffsetX = 0;
74          scrollingOffsetY = 0;
75      }
76  
77      protected BlockContainerData(int offsetX, int offsetY, int sizeX, int sizeY,int sizeZ, int squareSizeX,int squareSizeY,int squareSizeZ, int visibleSizeX, int visibleSizeY) {
78          this.offsetX = offsetX;
79          this.offsetY = offsetY;
80          this.sizeX = sizeX;
81          this.sizeY = sizeY;
82          this.sizeZ = sizeZ;
83          this.squareSizeX = squareSizeX;
84          this.squareSizeY = squareSizeY;
85          this.squareSizeZ = squareSizeZ;
86          this.visibleSizeX = visibleSizeX;
87          this.visibleSizeY = visibleSizeY;
88      }
89      /***
90  	 * Sets the horizontal scrolling offset
91  	 * @param offsetX The new X scrolling offset
92  	 */
93  	public void setScrollingOffsetX(int offsetX)
94  	{
95  		this.scrollingOffsetX = offsetX;
96  	}
97  
98      /***
99  	 * Sets the horizontal scrolling offset
100 	 * @param offsetY The new Y scrolling offset
101 	 */
102 	public void setScrollingOffsetY(int offsetY)
103 	{
104 		this.scrollingOffsetY = offsetY;
105 	}
106 
107     /***
108      * Gets the horizontal scrolling offset
109      * @return The X scrolling offset
110      */
111     public int getScrollingOffsetX() {
112         return this.scrollingOffsetX;
113     }
114 
115     /***
116      * Gets the vertical scrolling offset
117      * @return The Y scrolling offset
118      */
119     public int getScrollingOffsetY() {
120         return this.scrollingOffsetY;
121     }
122 
123     public int getSizeX() {
124         return sizeX;
125     }
126 
127     public int getSizeY() {
128         return sizeY;
129     }
130     public int getSizeZ() {
131         return sizeZ;
132     }
133     public int getSquareSizeX() {
134         return squareSizeX;
135     }
136 
137     public int getSquareSizeY() {
138         return squareSizeY;
139     }
140 
141     public int getSquareSizeZ() {
142         return squareSizeZ;
143     }
144 
145     public int getOffsetX() {
146         return offsetX;
147     }
148 
149     public int getOffsetY() {
150         return offsetY;
151     }
152 
153     public int getDrawingSizeX()
154     {
155     	return visibleSizeX;
156     }
157 
158     public int getDrawingSizeY()
159     {
160     	return visibleSizeY;
161     }
162 }