Rework controls for 1000 and 10000 entity spawns
This commit is contained in:
parent
4bee083cc4
commit
6b8d1e1929
2 changed files with 4 additions and 6 deletions
|
|
@ -227,8 +227,7 @@ pub fn main() !void {
|
||||||
|
|
||||||
fn handleInput(entities: *sandbox.Entities, rng: *std.Random, paused: *bool) void {
|
fn handleInput(entities: *sandbox.Entities, rng: *std.Random, paused: *bool) void {
|
||||||
const shift = rl.isKeyDown(.left_shift) or rl.isKeyDown(.right_shift);
|
const shift = rl.isKeyDown(.left_shift) or rl.isKeyDown(.right_shift);
|
||||||
const ctrl = rl.isKeyDown(.left_control) or rl.isKeyDown(.right_control);
|
const add_count: usize = if (shift) 10000 else 1000;
|
||||||
const add_count: usize = if (ctrl and shift) 10000 else if (shift) 1000 else 100;
|
|
||||||
|
|
||||||
// add entities: = or +
|
// add entities: = or +
|
||||||
if (rl.isKeyPressed(.equal) or rl.isKeyPressed(.kp_add)) {
|
if (rl.isKeyPressed(.equal) or rl.isKeyPressed(.kp_add)) {
|
||||||
|
|
|
||||||
|
|
@ -67,16 +67,15 @@ pub fn drawMetrics(entities: *const sandbox.Entities, update_us: i64, render_us:
|
||||||
}
|
}
|
||||||
|
|
||||||
fn drawControls(font: rl.Font, metrics_height: i32) void {
|
fn drawControls(font: rl.Font, metrics_height: i32) void {
|
||||||
const ctrl_box_height: i32 = @intFromFloat(small_line_height * 5 + box_padding * 2);
|
const ctrl_box_height: i32 = @intFromFloat(small_line_height * 4 + box_padding * 2);
|
||||||
const ctrl_box_y: i32 = 5 + metrics_height + 5;
|
const ctrl_box_y: i32 = 5 + metrics_height + 5;
|
||||||
rl.drawRectangle(5, ctrl_box_y, 175, ctrl_box_height, box_bg);
|
rl.drawRectangle(5, ctrl_box_y, 175, ctrl_box_height, box_bg);
|
||||||
|
|
||||||
var y: f32 = @as(f32, @floatFromInt(ctrl_box_y)) + box_padding;
|
var y: f32 = @as(f32, @floatFromInt(ctrl_box_y)) + box_padding;
|
||||||
|
|
||||||
const controls = [_][]const u8{
|
const controls = [_][]const u8{
|
||||||
"+/-: add/remove 100",
|
"+/-: 1000 entities",
|
||||||
"shift +/-: 1000",
|
"shift +/-: 10000",
|
||||||
"ctrl+shift +/-: 10000",
|
|
||||||
"space: pause",
|
"space: pause",
|
||||||
"r: reset",
|
"r: reset",
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue