diff options
author | BigBrotherNii <nicochr1004@gmail.com> | 2024-07-15 18:49:35 +0200 |
---|---|---|
committer | BigBrotherNii <nicochr1004@gmail.com> | 2024-07-15 18:49:35 +0200 |
commit | ecca708f6900a3959c25c348ffcb7df646c6c227 (patch) | |
tree | bb3155e9ef8b9318e2c0c9474129bc0a186b3829 | |
parent | 53fe9f2d78aafcd62a7890ad4a81a2b5da63977b (diff) | |
parent | 1aa4f358bc22bda63c062683fd0749541e9fad61 (diff) | |
download | hurrycurry-ecca708f6900a3959c25c348ffcb7df646c6c227.tar hurrycurry-ecca708f6900a3959c25c348ffcb7df646c6c227.tar.bz2 hurrycurry-ecca708f6900a3959c25c348ffcb7df646c6c227.tar.zst |
improved tree colouring
-rw-r--r-- | light-client/src/atlas.rs | 19 | ||||
-rw-r--r-- | light-client/src/game.rs | 17 | ||||
-rw-r--r-- | light-client/src/main.rs | 6 | ||||
-rw-r--r-- | light-client/src/network.rs | 43 | ||||
-rw-r--r-- | light-client/textures/makefile | 1 | ||||
-rw-r--r-- | light-client/tools/src/bin/tex_export.rs | 17 | ||||
-rw-r--r-- | light-client/tools/src/bin/tex_import.rs | 17 | ||||
-rw-r--r-- | light-client/tools/src/bin/tex_pack.rs | 17 |
8 files changed, 121 insertions, 16 deletions
diff --git a/light-client/src/atlas.rs b/light-client/src/atlas.rs index 94114176..4a39b649 100644 --- a/light-client/src/atlas.rs +++ b/light-client/src/atlas.rs @@ -1,3 +1,20 @@ +/* + Hurry Curry! - a game about cooking + Copyright 2024 metamuffin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, version 3 of the License only. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. + +*/ use hurrycurry_protocol::{ glam::{IVec2, Vec2}, ClientGamedata, ItemIndex, TileIndex, @@ -80,7 +97,7 @@ impl<'a> SpriteRenderer<'a> { tiles: vec![], sprites: vec![], view_offset: Vec2::ZERO, - view_scale: Vec2::new(1., 0.75) * 2., + view_scale: Vec2::splat(4.), } } diff --git a/light-client/src/game.rs b/light-client/src/game.rs index e432c517..c9b20e56 100644 --- a/light-client/src/game.rs +++ b/light-client/src/game.rs @@ -1,3 +1,20 @@ +/* + Hurry Curry! - a game about cooking + Copyright 2024 metamuffin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, version 3 of the License only. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. + +*/ use crate::atlas::SpriteRenderer; use hurrycurry_protocol::{glam::IVec2, PacketC, TileIndex}; use std::collections::HashMap; diff --git a/light-client/src/main.rs b/light-client/src/main.rs index 2145e9b6..fa1a38ba 100644 --- a/light-client/src/main.rs +++ b/light-client/src/main.rs @@ -1,6 +1,3 @@ -use atlas::SpriteRenderer; -use game::Game; -use hurrycurry_protocol::PacketC; /* Hurry Curry! - a game about cooking Copyright 2024 metamuffin @@ -18,6 +15,9 @@ use hurrycurry_protocol::PacketC; along with this program. If not, see <https://www.gnu.org/licenses/>. */ +use atlas::SpriteRenderer; +use game::Game; +use hurrycurry_protocol::PacketC; use network::Network; use sdl2::{event::Event, keyboard::Keycode, pixels::Color}; diff --git a/light-client/src/network.rs b/light-client/src/network.rs index e3cd1eb5..997a3344 100644 --- a/light-client/src/network.rs +++ b/light-client/src/network.rs @@ -1,3 +1,20 @@ +/* + Hurry Curry! - a game about cooking + Copyright 2024 metamuffin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, version 3 of the License only. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. + +*/ use anyhow::Result; use hurrycurry_protocol::{PacketC, PacketS, BINCODE_CONFIG}; use log::warn; @@ -19,32 +36,36 @@ pub struct Network { impl Network { pub fn connect(addr: &str) -> Result<Self> { let (parts, _) = addr.into_client_request().unwrap().into_parts(); - let uri = parts.uri.clone(); - let mut builder = Request::builder() - .uri(uri.clone()) + .uri(parts.uri.clone().clone()) .method(parts.method.clone()) .version(parts.version); *builder.headers_mut().unwrap() = parts.headers.clone(); let request = builder.body(()).unwrap(); - let uri = request.uri(); - let mode = uri_mode(uri)?; let host = request.uri().host().unwrap(); let host = if host.starts_with('[') { &host[1..host.len() - 1] } else { host }; - let port = uri.port_u16().unwrap_or(match mode { - Mode::Plain => 27032, - Mode::Tls => 443, - }); + let port = request + .uri() + .port_u16() + .unwrap_or(match uri_mode(request.uri())? { + Mode::Plain => 27032, + Mode::Tls => 443, + }); let stream = TcpStream::connect((host, port))?; stream.set_nodelay(true).unwrap(); - // stream.set_nonblocking(true).unwrap(); - let (sock, _) = client_tls_with_config(request, stream, None, None).unwrap(); + let (mut sock, _) = client_tls_with_config(request, stream, None, None).unwrap(); + + match sock.get_mut() { + MaybeTlsStream::Plain(s) => s.set_nonblocking(true).unwrap(), + MaybeTlsStream::Rustls(s) => s.sock.set_nonblocking(true).unwrap(), + _ => todo!(), + }; Ok(Self { sock, diff --git a/light-client/textures/makefile b/light-client/textures/makefile index 9b3c1097..ce416a76 100644 --- a/light-client/textures/makefile +++ b/light-client/textures/makefile @@ -1,5 +1,4 @@ - ALL_TA = $(patsubst %.png,%.ta,$(shell find tiles -name '*.png')) ALL_PNG = $(patsubst %.ta,%.png,$(shell find tiles -name '*.ta')) diff --git a/light-client/tools/src/bin/tex_export.rs b/light-client/tools/src/bin/tex_export.rs index 97d4f07a..d325d912 100644 --- a/light-client/tools/src/bin/tex_export.rs +++ b/light-client/tools/src/bin/tex_export.rs @@ -1,3 +1,20 @@ +/* + Hurry Curry! - a game about cooking + Copyright 2024 metamuffin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, version 3 of the License only. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. + +*/ use clap::Parser; use image::Rgba; use std::{ diff --git a/light-client/tools/src/bin/tex_import.rs b/light-client/tools/src/bin/tex_import.rs index 89cbc8c9..21d1403e 100644 --- a/light-client/tools/src/bin/tex_import.rs +++ b/light-client/tools/src/bin/tex_import.rs @@ -1,3 +1,20 @@ +/* + Hurry Curry! - a game about cooking + Copyright 2024 metamuffin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, version 3 of the License only. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. + +*/ use clap::Parser; use std::{ collections::HashMap, diff --git a/light-client/tools/src/bin/tex_pack.rs b/light-client/tools/src/bin/tex_pack.rs index 60c409ff..aadd9e16 100644 --- a/light-client/tools/src/bin/tex_pack.rs +++ b/light-client/tools/src/bin/tex_pack.rs @@ -1,3 +1,20 @@ +/* + Hurry Curry! - a game about cooking + Copyright 2024 metamuffin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, version 3 of the License only. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. + +*/ use clap::Parser; use std::{ fs::File, |