Skip to content

Commit c82ebf1

Browse files
committed
fixed fps
1 parent ac149a9 commit c82ebf1

File tree

5 files changed

+7
-4
lines changed

5 files changed

+7
-4
lines changed
-136 Bytes
Binary file not shown.

src/JavaGameEngine/Backend/GameWorld.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public int compare(Component o1, Component o2) {
108108

109109
for(Component c : list){
110110
(c).draw(g);
111-
g.drawString(fps,0,10);
111+
g.drawString(fps,10,20);
112112
}
113113
}
114114
}

src/JavaGameEngine/Backend/UpdateThread.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ private LinkedList<Component> UpdateObjects()
2828
{
2929
for (Component component : ComponentHandler.getObjects()) {
3030
if(component.isEnabled()){
31-
//component.setCameraPosition(UpdateThread.camera.getPosition());
31+
component.setCameraPosition(UpdateThread.camera.getPosition());
3232
component.update();
3333
}
3434
}

src/JavaGameEngine/Components/Sprite/Sprite.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ public BufferedImage getAnimation(){
113113
@Override
114114
public void draw(Graphics g) {
115115
super.draw(g);
116+
//SAVE ROTATION WHEN SETTING ANGLE AND THEN RETURN IT
117+
/*
116118
// The required drawing location
117119
int drawLocationX = (int) (getSpritePosition().getX()+getScale().getX()/2);
118120
int drawLocationY = (int) (getSpritePosition().getY()+getScale().getY()/2);
@@ -127,7 +129,8 @@ public void draw(Graphics g) {
127129
AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BICUBIC);
128130
129131
g.drawImage(op.filter(image, null), drawLocationX, drawLocationY, (int) getScale().getX(), (int) getScale().getY(),null);
130-
132+
*/
133+
g.drawImage((Image) getAnimation(), (int) ((int) getSpritePosition().getX()+getScale().getX()/2), (int) ((int) getSpritePosition().getY()+getScale().getY()/2), (int) getScale().getX(), (int) getScale().getY(),null);
131134
}
132135

133136
public static BufferedImage resize(BufferedImage img, Vector2 scale) {

src/Testing/Player.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@ public void update() {
6363

6464
physicsBody.addForce(Vector2.up,60);
6565
}
66-
//UpdateThread.camera = this.getPosition();
66+
UpdateThread.camera.setPosition(getPosition().subtract(new Vector2(200,200)));
6767
}
6868
}

0 commit comments

Comments
 (0)