33import JavaGameEngine .Backend .GameWorld ;
44import JavaGameEngine .Backend .Input .Input ;
55import JavaGameEngine .Backend .UpdateThread ;
6+ import JavaGameEngine .msc .Debug ;
67import JavaGameEngine .msc .Vector2 ;
78
89import java .awt .*;
1112
1213public class Component {
1314
14- Vector2 position ; // world position
15+ Vector2 position = new Vector2 ( 200 , 200 ) ; // world position
1516 Vector2 localPosition =Vector2 .zero ; // local position this is that children to a parent should change to change position
1617 Vector2 cameraPosition = Vector2 .zero ; // camera offset
1718
18- Vector2 scale ; // scale with,height
19+ Vector2 scale = new Vector2 ( 100 , 100 ) ; // scale with,height
1920 Vector2 localScale =Vector2 .zero ; // local scale with,height
2021
2122 Vector2 rotation =Vector2 .zero ; // rotation
@@ -24,6 +25,8 @@ public class Component {
2425 Component parent = null ; // if component has parent it should update with some of the parents data
2526 LinkedList <Component > components = new LinkedList <>(); // children
2627
28+
29+
2730 int layer = 0 ;
2831
2932 public int getLayer () {
@@ -42,11 +45,12 @@ public void setLayer(int layer) {
4245
4346
4447 public Component () {
45- this .scale = new Vector2 (100 ,100 );
46- this .position = new Vector2 (200 ,200 );
4748 }
4849 public Component (Vector2 pos ) {
49- this .scale = new Vector2 (100 ,100 );
50+ this .position = pos ;
51+ }
52+ public Component (Vector2 pos ,Vector2 scale ) {
53+ this .scale = scale ;
5054 this .position = pos ;
5155 }
5256 public void setMouseInside (boolean mouseInside ) {
@@ -105,6 +109,10 @@ public Vector2 getSpritePosition(){
105109
106110 return new Vector2 (x ,y );
107111 }
112+ public Vector2 getSpriteScale (){
113+ //return getScale();
114+ return getScale ().subtract (UpdateThread .camera .getScale ());
115+ }
108116
109117 public Vector2 getLocalPosition () {
110118 return localPosition ;
0 commit comments