Removed warnings
This commit is contained in:
parent
d3bc7ecc7f
commit
be968adb89
@ -12,6 +12,7 @@ bitflags! {
|
||||
}
|
||||
|
||||
//--Scroll struct-----------------------------------------------------------------------------------
|
||||
#[allow(dead_code)]
|
||||
pub struct Scroll {
|
||||
x: f32,
|
||||
y: f32,
|
||||
|
||||
@ -15,9 +15,10 @@ mod renderer;
|
||||
|
||||
use utils::Size;
|
||||
|
||||
pub fn run_canvas<S: 'static + Sized, A: 'static + Application<S>>(title: &'static str,
|
||||
size: Size, mut app: A)
|
||||
-> !
|
||||
pub fn run_canvas<S, A>(title: &'static str, size: Size, _: A) -> !
|
||||
where
|
||||
S: 'static + Sized,
|
||||
A: 'static + Application<S>,
|
||||
{
|
||||
use winit::{
|
||||
event_loop::EventLoop,
|
||||
@ -61,7 +62,7 @@ pub fn run_canvas<S: 'static + Sized, A: 'static + Application<S>>(title: &'stat
|
||||
WindowEvent::Resized (size) => {
|
||||
canvas.set_size(size.into());
|
||||
},
|
||||
WindowEvent::ScaleFactorChanged {new_inner_size, ..} => {
|
||||
WindowEvent::ScaleFactorChanged {/*new_inner_size, */..} => {
|
||||
// new_inner_size is &&mut so we have to dereference it twice
|
||||
// canvas does not support resize, do nothing
|
||||
//canvas.set_size((*new_inner_size).into());
|
||||
|
||||
@ -10,8 +10,6 @@ use canvas::{
|
||||
};
|
||||
|
||||
use std::{
|
||||
rc::Rc,
|
||||
cell::RefCell,
|
||||
time::Instant,
|
||||
};
|
||||
|
||||
@ -57,8 +55,7 @@ impl Application<ExampleState> for ExampleApp {
|
||||
|
||||
fn init(canvas: &mut Canvas) -> Result<ExampleState, &'static str> {
|
||||
use canvas::{
|
||||
utils::{Position, Size},
|
||||
sprite::Sprite,
|
||||
utils::{Size},
|
||||
};
|
||||
|
||||
//// 20 x 20 sprite of a picture
|
||||
@ -88,10 +85,7 @@ impl Application<ExampleState> for ExampleApp {
|
||||
|
||||
fn tick(state: &mut ExampleState, canvas: &mut Canvas) -> Result<(), &'static str> {
|
||||
use canvas::{
|
||||
io::Key,
|
||||
sprite::Sprite,
|
||||
utils::{Position, Size, Color, Pixel},
|
||||
shape::{Shape, Rectangle},
|
||||
};
|
||||
|
||||
let now = Instant::now();
|
||||
|
||||
@ -3,11 +3,9 @@ use log::{debug, error, info, trace, warn};
|
||||
|
||||
use raw_window_handle::HasRawWindowHandle;
|
||||
use wgpu;
|
||||
use wgpu_hal;
|
||||
use cgmath::Matrix3;
|
||||
|
||||
use crate::{
|
||||
sprite::{Sprite, ModelMatrix, MATRIX_SIZE},
|
||||
sprite::{Sprite, MATRIX_SIZE},
|
||||
texture::{GpuTexture},
|
||||
utils::{Pixel, Size},
|
||||
};
|
||||
@ -32,7 +30,9 @@ pub struct WgpuRenderer {
|
||||
texture_bind_group_layout: wgpu::BindGroupLayout,
|
||||
texture_render_pipeline: wgpu::RenderPipeline,
|
||||
|
||||
#[allow(dead_code)]
|
||||
shape_render_pipeline: wgpu::RenderPipeline,
|
||||
#[allow(dead_code)]
|
||||
quad_mesh: GpuMesh<ColorVertex, 4, 6>, //TODO temporary, to be moved to shapes.rs
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ use crate::{
|
||||
renderer::{Mesh, GpuMesh, RenderData, TextureVertex, GpuUniform},
|
||||
shape::Shape,
|
||||
texture::Texture,
|
||||
utils::{Pixel, Position, Size, NormalizedSize},
|
||||
utils::{Pixel, Position, Size},
|
||||
};
|
||||
|
||||
use cgmath::{
|
||||
@ -15,12 +15,6 @@ use cgmath::{
|
||||
Matrix4,
|
||||
};
|
||||
|
||||
use std::{
|
||||
rc::Rc,
|
||||
cell::RefCell,
|
||||
slice::{Iter, IterMut},
|
||||
};
|
||||
|
||||
//--Sprite trait------------------------------------------------------------------------------------
|
||||
pub trait Sprite {
|
||||
|
||||
@ -49,7 +43,6 @@ impl ModelMatrix {
|
||||
uniform: GpuUniform<MATRIX_SIZE>)
|
||||
-> Self
|
||||
{
|
||||
use cgmath::SquareMatrix;
|
||||
|
||||
Self {
|
||||
position: pos,
|
||||
@ -81,7 +74,7 @@ impl ModelMatrix {
|
||||
}
|
||||
|
||||
pub fn get_uniform(&mut self) -> &mut GpuUniform<MATRIX_SIZE> {
|
||||
use cgmath::{Basis3, Rotation3, SquareMatrix};
|
||||
use cgmath::{Basis3, Rotation3};
|
||||
|
||||
if self.is_synced == false {
|
||||
|
||||
@ -238,6 +231,7 @@ impl Sprite for TextureSprite {
|
||||
}
|
||||
|
||||
//--TextSprite struct-------------------------------------------------------------------------------
|
||||
#[allow(dead_code)]
|
||||
pub struct TextSprite {
|
||||
matrix: Matrix4<f32>,
|
||||
size: Size,
|
||||
@ -279,6 +273,7 @@ impl Sprite for TextSprite {
|
||||
}
|
||||
|
||||
//--ShapeSprite struct-------------------------------------------------------------------------------
|
||||
#[allow(dead_code)]
|
||||
pub struct ShapeSprite {
|
||||
matrix: Matrix4<f32>,
|
||||
size: Size,
|
||||
|
||||
@ -4,7 +4,6 @@ use log::{debug, error, info, trace, warn};
|
||||
use crate::utils::{Pixel, Position, Size};
|
||||
|
||||
use std::{
|
||||
slice::{Iter, IterMut},
|
||||
rc::Rc,
|
||||
cell::RefCell,
|
||||
};
|
||||
|
||||
18
src/utils.rs
18
src/utils.rs
@ -79,24 +79,6 @@ impl From<winit::dpi::PhysicalSize<u32>> for Size {
|
||||
}
|
||||
}
|
||||
|
||||
//--NormalizedSize struct---------------------------------------------------------------------------
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct NormalizedSize {
|
||||
pub w: f32,
|
||||
pub h: f32,
|
||||
}
|
||||
|
||||
impl NormalizedSize {
|
||||
|
||||
pub fn from_size(size: Size, surface_size: Size) -> Self {
|
||||
|
||||
Self {
|
||||
w: size.w as f32 / surface_size.w as f32,
|
||||
h: size.h as f32 / surface_size.h as f32,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--Pixel struct------------------------------------------------------------------------------------
|
||||
#[derive(Copy, Clone, bytemuck::Pod, bytemuck::Zeroable)]
|
||||
#[repr(C)]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user