Skip to content

Commit 06716fc

Browse files
committed
Add camera zoom tweening
1 parent 3d93ca2 commit 06716fc

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

Diff for: 2d/src/main/java/de/bitbrain/braingdx/graphics/VectorGameCamera.java

+5
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ public void update(float delta) {
138138
lastShake.set(shake);
139139
}
140140

141+
@Override
142+
public float getZoomModeValue() {
143+
return zoomModeValue;
144+
}
145+
141146
@Override
142147
public void setDistanceStoppingThreshold(float distanceThreshold) {
143148
this.distanceThreshold = distanceThreshold;

Diff for: CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Version 0.6.30
2+
3+
* add camera zoom tweening
4+
15
# Version 0.6.29
26

37
* add additional constructors to `AnimationSpritesheet`

Diff for: core/src/main/java/de/bitbrain/braingdx/graphics/GameCamera.java

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ enum ZoomMode {
3636
TO_HEIGHT;
3737
}
3838

39+
float getZoomModeValue();
40+
3941
/**
4042
* Sets a new threshold to where the camera should stop tracking.
4143
* The distance also takes camera zoom into account.

Diff for: core/src/main/java/de/bitbrain/braingdx/tweens/GameCameraTween.java

+13
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ public class GameCameraTween implements TweenAccessor<GameCamera> {
77

88
public static final int DEFAULT_ZOOM_FACTOR = 1;
99
public static final int TARGET_TRACKING_SPEED = 2;
10+
public static final int ZOOM_WIDTH = 3;
11+
public static final int ZOOM_HEIGHT = 4;
1012

1113
@Override
1214
public int getValues(GameCamera target, int tweenType, float[] returnValues) {
@@ -17,6 +19,11 @@ public int getValues(GameCamera target, int tweenType, float[] returnValues) {
1719
case TARGET_TRACKING_SPEED:
1820
returnValues[0] = target.getTargetTrackingSpeed();
1921
return 1;
22+
case ZOOM_WIDTH:
23+
case ZOOM_HEIGHT:
24+
returnValues[0] = target.getZoomModeValue();
25+
return 1;
26+
2027
}
2128
return 0;
2229
}
@@ -30,6 +37,12 @@ public void setValues(GameCamera target, int tweenType, float[] newValues) {
3037
case TARGET_TRACKING_SPEED:
3138
target.setTargetTrackingSpeed(newValues[0]);
3239
break;
40+
case ZOOM_WIDTH:
41+
target.setZoom(newValues[0], GameCamera.ZoomMode.TO_WIDTH);
42+
break;
43+
case ZOOM_HEIGHT:
44+
target.setZoom(newValues[0], GameCamera.ZoomMode.TO_HEIGHT);
45+
break;
3346
}
3447
}
3548
}

0 commit comments

Comments
 (0)