home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-08-14 | 1.0 KB | 41 lines |
- // Scaler.java
- // 28.03.96
- //
- // handles scaling, used to make 2 versions of cybcerone, big and small
-
- package cybcerone.utils;
-
- import java.awt.Rectangle;
-
- /**
- * Controls all the scaling to make the small version of Cybcerone.
- */
- public class Scaler {
- private static float scale = (float) 1.0;
-
- /** Take this number and scale it */
- public static final int scale (int num) {
- return Math.round (num * scale);
- }
-
- /** Make a rectangle from these numbers and scale it */
- public static final Rectangle scale (int x, int y, int width, int height) {
- return new Rectangle (scale (x), scale (y), scale (width), scale (height));
- }
-
- /** Scale this rectangle */
- public static final Rectangle scale (Rectangle rec) {
- return new Rectangle (scale (rec.x), scale (rec.y),
- scale (rec.width), scale (rec.height));
- }
-
- /** Set the scaling */
- public static void setScale (float newScale) {
- scale = newScale;
- }
-
- /** Get the scaling factor */
- public static float getScale () { return scale; }
-
- }
-