limit camera offset
This commit is contained in:
parent
ca29401911
commit
f94ae22214
@ -1332,11 +1332,16 @@ pub fn frame(self: *App, plt: Platform.Frame) !void {
|
|||||||
self.camera_pos = self.camera_pos.sub(plt.input.mouse_delta);
|
self.camera_pos = self.camera_pos.sub(plt.input.mouse_delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
Gfx.transformTranslate(plt.input.window_size.divideScalar(2));
|
self.camera_pos.x = std.math.clamp(self.camera_pos.x, -1000, 1000);
|
||||||
|
self.camera_pos.y = std.math.clamp(self.camera_pos.y, -600, 0);
|
||||||
|
|
||||||
|
const window_size = plt.input.window_size;
|
||||||
|
Gfx.transformTranslate(.init(window_size.x/2, window_size.y));
|
||||||
|
Gfx.transformTranslate(.init(0, -128));
|
||||||
Gfx.transformTranslate(self.camera_pos.multiplyScalar(-1));
|
Gfx.transformTranslate(self.camera_pos.multiplyScalar(-1));
|
||||||
|
|
||||||
Gfx.setClearColor(.rgb(40, 40, 40));
|
Gfx.setClearColor(.rgb(40, 40, 40));
|
||||||
Gfx.drawLine(.init(-800, 0), .init(800, 0), .white, 5);
|
Gfx.drawLine(.init(-4000, 0), .init(4000, 0), .white, 5);
|
||||||
|
|
||||||
{ // Spawn in or delete minions based on self.upgrades.minion_count
|
{ // Spawn in or delete minions based on self.upgrades.minion_count
|
||||||
var minion_count: u32 = 0;
|
var minion_count: u32 = 0;
|
||||||
|
|||||||
@ -403,6 +403,11 @@ fn PlatformType(App: type) type {
|
|||||||
.unfocused = {}
|
.unfocused = {}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
.RESIZED => {
|
||||||
|
self.pushEvent(.{
|
||||||
|
.window_resize = .initFromInt(i32, e.window_width, e.window_height)
|
||||||
|
});
|
||||||
|
},
|
||||||
else => {}
|
else => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user