mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-04-30 08:21:47 -04:00
Zooming works!
Just type - or = (i.e. f11 or f12)
This commit is contained in:
parent
67869a5a48
commit
86aa6ef65c
1 changed files with 27 additions and 4 deletions
31
src/main.zig
31
src/main.zig
|
@ -1,9 +1,8 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const rl = @import("raylib");
|
const rl = @import("raylib");
|
||||||
const world = @import("world.zig");
|
const world = @import("world.zig");
|
||||||
const core = @cImport({
|
|
||||||
@cInclude("./core.h");
|
const dbg = std.debug;
|
||||||
});
|
|
||||||
|
|
||||||
const GameScreen = enum {
|
const GameScreen = enum {
|
||||||
login,
|
login,
|
||||||
|
@ -23,6 +22,8 @@ pub fn main() anyerror!void {
|
||||||
var current_screen: GameScreen = .login;
|
var current_screen: GameScreen = .login;
|
||||||
var frame_counter: i32 = 0;
|
var frame_counter: i32 = 0;
|
||||||
|
|
||||||
|
// var zoom: f32 = 10;
|
||||||
|
|
||||||
var camera = rl.Camera3D{
|
var camera = rl.Camera3D{
|
||||||
.position = rl.Vector3.init(0.0, 20.0, 90.0),
|
.position = rl.Vector3.init(0.0, 20.0, 90.0),
|
||||||
.target = rl.Vector3.init(0, 0.0, 0),
|
.target = rl.Vector3.init(0, 0.0, 0),
|
||||||
|
@ -68,6 +69,28 @@ pub fn main() anyerror!void {
|
||||||
.cas => {},
|
.cas => {},
|
||||||
.map => {},
|
.map => {},
|
||||||
.lot => {
|
.lot => {
|
||||||
|
const zoom_increment = 5;
|
||||||
|
|
||||||
|
if (rl.isKeyPressed(rl.KeyboardKey.key_equal)) {
|
||||||
|
if (camera.fovy <= 10 or camera.fovy >= 20) {
|
||||||
|
camera.fovy += zoom_increment;
|
||||||
|
}
|
||||||
|
|
||||||
|
dbg.print("Zoom level: {any}\n", .{
|
||||||
|
camera.fovy,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rl.isKeyPressed(rl.KeyboardKey.key_minus)) {
|
||||||
|
if (camera.fovy <= 10 or camera.fovy >= 2.0) {
|
||||||
|
camera.fovy -= zoom_increment;
|
||||||
|
}
|
||||||
|
|
||||||
|
dbg.print("Zoom level: {any}\n", .{
|
||||||
|
camera.fovy,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// camera.update(rl.CameraMode.camera_custom);
|
// camera.update(rl.CameraMode.camera_custom);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -90,7 +113,7 @@ pub fn main() anyerror!void {
|
||||||
// Skip this for now
|
// Skip this for now
|
||||||
.cas => {},
|
.cas => {},
|
||||||
.map => {},
|
.map => {},
|
||||||
// "World" (i.e. lot view)
|
// Low view (i.e. world)
|
||||||
.lot => {
|
.lot => {
|
||||||
rl.clearBackground(rl.Color.sky_blue);
|
rl.clearBackground(rl.Color.sky_blue);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue