1
Fork 0

moved world center away from dead-end

This commit is contained in:
Andy Killorin 2023-09-16 17:05:17 -05:00
parent e19c099eb8
commit d6b8e589fb
Signed by: ank
GPG key ID: B6241CA3B552BCA4
2 changed files with 4 additions and 3 deletions

View file

@ -65,6 +65,7 @@ fn main() {
#[cfg(feature = "gamepad")] #[cfg(feature = "gamepad")]
if let Some(gamepad) = gamepad_handle.map(|h| gilrs.gamepad(h)) { if let Some(gamepad) = gamepad_handle.map(|h| gilrs.gamepad(h)) {
// see [ref:input_handler] for mapping info
gamepad.axis_data(Axis::LeftStickX).map(|axis| { gamepad.axis_data(Axis::LeftStickX).map(|axis| {
analog_input(1, axis.value()); analog_input(1, axis.value());
}); });
@ -100,6 +101,7 @@ fn main() {
} }
} }
// see [ref:input_handler] for mapping info
window.get_keys().iter().for_each(|key| match key { window.get_keys().iter().for_each(|key| match key {
Key::A => keyboard_input(65), Key::A => keyboard_input(65),
Key::D => keyboard_input(68), Key::D => keyboard_input(68),

View file

@ -106,7 +106,7 @@ fn render_frame(buffer: &mut [u32; WIDTH*HEIGHT]) {
//camera[0] += 1.0; //camera[0] += 1.0;
while let Some(key) = INPUTS.lock().pop() { while let Some(key) = INPUTS.lock().pop() {
match key[0] { match key[0] { // [tag:input_handler]
38 => camera[1] -= 10.0*camera[2], // up 38 => camera[1] -= 10.0*camera[2], // up
40 => camera[1] += 10.0*camera[2], // down 40 => camera[1] += 10.0*camera[2], // down
37 => camera[0] -= 10.0*camera[2], // left 37 => camera[0] -= 10.0*camera[2], // left
@ -237,8 +237,7 @@ fn draw_tri(color: u32, buffer: &mut [u32; WIDTH*HEIGHT], p1: Vector2<f32>, p2:
} }
fn sample_world(point: Vector2<f32>, rand: PerlinBuf) -> f32 { fn sample_world(point: Vector2<f32>, rand: PerlinBuf) -> f32 {
let offset = Vector2::new(64480.0, 7870.0); let offset = Vector2::new(64492.0, 7892.0);
//240.0,240.0
let point = point + offset; let point = point + offset;
let mut n = 0.0; let mut n = 0.0;
n += (sampler::sample_map_inter(point / 64.0, &MAP)-0.5)* 0.6; n += (sampler::sample_map_inter(point / 64.0, &MAP)-0.5)* 0.6;