~starkingdoms/starkingdoms

84005c5dd0e4cba7754388244668ee327ca89aa1 — TerraMaster85 2 years ago b16e992
regress to Shift 'n' Sketchâ„¢ rendering (hopefully last fix)
1 files changed, 4 insertions(+), 6 deletions(-)

M client/src/rendering/renderer.rs
M client/src/rendering/renderer.rs => client/src/rendering/renderer.rs +4 -6
@@ 67,6 67,8 @@ impl Renderer for WebRenderer {
            context.save();

            //context.translate(player.x, player.y).map_err(|e: JsValue| e.as_string().unwrap())?;
            //gaah fuck why noo i didnt want this. godforsaken canvas rotation
            context.translate(player.x - client.x, player.y - client.y).map_err(|e: JsValue| e.as_string().unwrap())?; // fwip

            context.set_text_align("center");
            context.set_font("30px Segoe UI");


@@ 77,18 79,14 @@ impl Renderer for WebRenderer {

            let texture_image = document.get_element_by_id("tex-hearty").unwrap().dyn_into::<HtmlImageElement>().unwrap();
            debug!("H {} {}", player.x - 25f64 - client.x, player.y - 25f64 - client.y);
            context.draw_image_with_html_image_element_and_dw_and_dh(&texture_image, player.x - 25f64 - client.x, player.y - 25f64 - client.y, 50f64, 50f64).map_err(|e: JsValue| e.as_string().unwrap())?; // sktch
            //context.draw_image_with_html_image_element_and_dw_and_dh(&texture_image, player.x - 25f64 - client.x, player.y - 25f64 - client.y, 50f64, 50f64).map_err(|e: JsValue| e.as_string().unwrap())?;
            context.draw_image_with_html_image_element_and_dw_and_dh(&texture_image, -25f64, -25f64, 50f64, 50f64).map_err(|e: JsValue| e.as_string().unwrap())?; // sktch

            //context.rotate(-player.rotation).map_err(|e: JsValue| e.as_string().unwrap())?; // fwoop

            context.restore();
        }

        context.scale(0.25f64, 0.25f64).map_err(|e: JsValue| e.as_string().unwrap())?;

        // do not remove
        // im making this smiley an easter egg soon
        // i just have to go fix the broken build system first
/*
        context.begin_path();