summaryrefslogtreecommitdiff
path: root/src/camera.rs
diff options
context:
space:
mode:
authorKai Stevenson <kai@kaistevenson.com>2026-08-15 14:17:28 -0700
committerKai Stevenson <kai@kaistevenson.com>2026-08-15 14:17:28 -0700
commitc94749cc88080ef7fef7b285f9072ea26d18e1eb (patch)
treeba20a6e1fe918934c94a4e5c3f7370d6c6ce97d8 /src/camera.rs
parentb510f5fcf5335c5e26d65ca96d7ec16c2f050f5d (diff)
wip, working with native resolution
Diffstat (limited to 'src/camera.rs')
-rw-r--r--src/camera.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/camera.rs b/src/camera.rs
index 3713b98..55a698c 100644
--- a/src/camera.rs
+++ b/src/camera.rs
@@ -8,7 +8,7 @@ pub struct Camera {
// centre coords
pub x: f64,
pub y: f64,
- // zoom scale factor, 1.0 = board <-> frame
+ // zoom scale factor, 1.0 = board <-> window
pub zoom: f64,
}
@@ -56,14 +56,14 @@ impl Camera {
pub fn write_frame_view(&self, frame: &mut [u8], world: &World) {
puffin::profile_function!();
- for i in 0..frame.len() / 4 {
- let idx = i * 4;
- frame[idx] = (i / 1000) as u8;
- frame[idx + 1] = 0x00;
- frame[idx + 2] = 0x00;
- frame[idx + 3] = 0xFF;
- }
- return;
+ // for i in 0..frame.len() / 4 {
+ // let idx = i * 4;
+ // frame[idx] = (i / 1000) as u8;
+ // frame[idx + 1] = 0x00;
+ // frame[idx + 2] = 0x00;
+ // frame[idx + 3] = 0xFF;
+ // }
+ // return;
const BG: [u8; 4] = [0x00, 0x00, 0x00, 0xFF];
for px in frame.chunks_exact_mut(4) {
@@ -74,7 +74,7 @@ impl Camera {
let (xl, yl) = self.screen_position_to_world(0.0, 0.0);
let (xu, yu) = self.screen_position_to_world(1600 as f64, 1200 as f64);
- let c = CHUNK_SIZE as i32;
+ let c = CHUNK_SIZE;
let cx0 = (xl.floor() as i32).div_euclid(c);
let cx1 = (xu.ceil() as i32).div_euclid(c);
let cy0 = (yl.floor() as i32).div_euclid(c);
@@ -102,7 +102,7 @@ impl Camera {
yl: f64,
scale: f64,
) {
- let c = CHUNK_SIZE as i32;
+ let c = CHUNK_SIZE;
let w = 1600 as i32;
let h = 1200 as i32;