aboutsummaryrefslogtreecommitdiff
path: root/light-client/src/main.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-07-16 23:37:56 +0200
committermetamuffin <metamuffin@disroot.org>2024-07-16 23:37:56 +0200
commit3a358c6dd39aa78319549658adf1028cea61f643 (patch)
treef84f0a2a4c4c675c0fab77ad3aeadc81928fd17d /light-client/src/main.rs
parent695b1130bdf5c13d7857d8ddb10ee24d10fcf325 (diff)
downloadhurrycurry-3a358c6dd39aa78319549658adf1028cea61f643.tar
hurrycurry-3a358c6dd39aa78319549658adf1028cea61f643.tar.bz2
hurrycurry-3a358c6dd39aa78319549658adf1028cea61f643.tar.zst
defenitely pixels now.
Diffstat (limited to 'light-client/src/main.rs')
-rw-r--r--light-client/src/main.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/light-client/src/main.rs b/light-client/src/main.rs
index 7526b394..e3aaa5cc 100644
--- a/light-client/src/main.rs
+++ b/light-client/src/main.rs
@@ -16,6 +16,7 @@
*/
use game::Game;
+use hurrycurry_protocol::glam::Vec2;
use network::Network;
use render::SpriteRenderer;
use sdl2::{
@@ -26,6 +27,7 @@ use sdl2::{
use std::time::{Duration, Instant};
pub mod game;
+pub mod helper;
pub mod network;
pub mod render;
pub mod tilemap;
@@ -34,6 +36,7 @@ fn main() {
env_logger::init_from_env("LOG");
let sdl_context = sdl2::init().unwrap();
+
let video_subsystem = sdl_context.video().unwrap();
let window = video_subsystem
.window("Hurry Curry! Light Client", 1280, 720)
@@ -64,9 +67,14 @@ fn main() {
let mut last_tick = Instant::now();
+ canvas.set_logical_size(320, 240).unwrap();
+
'mainloop: loop {
net.poll();
+ let (width, height) = canvas.logical_size();
+ renderer.size = Vec2::new(width as f32, height as f32);
+
for packet in net.queue_in.drain(..) {
game.packet_in(packet, &mut renderer);
}