Mercurial > hg > ristipolku
diff game/IDMWidget.java @ 170:b9bc493ae53c
Modularize and clean up code.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 02 Mar 2017 15:57:15 +0200 |
parents | e8eeac403e5f |
children | 5070e57ebbfc |
line wrap: on
line diff
--- a/game/IDMWidget.java Thu Mar 02 14:18:21 2017 +0200 +++ b/game/IDMWidget.java Thu Mar 02 15:57:15 2017 +0200 @@ -88,6 +88,26 @@ return (int) (pos.y * scale.y); } + public int getScaledX(float x) + { + return (int) (x * scale.x); + } + + public int getScaledY(float y) + { + return (int) (y * scale.y); + } + + public int getScaledRelX(float x) + { + return (int) ((pos.x + x) * scale.x); + } + + public int getScaledRelY(float y) + { + return (int) ((pos.y + y) * scale.y); + } + public int getScaledWidth() { return (int) (size.x * scale.x);