added slider thing, broke rendering somehow though

This commit is contained in:
2020-08-01 20:06:53 -07:00
parent 8da810f23a
commit f3a3be1d99
12 changed files with 78 additions and 52 deletions

View File

@@ -1,11 +1,11 @@
use std::sync::Arc;
use crate::canvas::managed::handles::{CanvasImageHandle, CanvasTextureHandle};
use crate::canvas::canvas_frame::Drawable;
use crate::util::vertex::{VertexTypes, ImageVertex3D};
use crate::util::vertex::{VertexType, ImageVertex3D};
pub struct CompuSprite {
pub verts: VertexTypes,
pub verts: VertexType,
position: (f32, f32),
size: (f32, f32),
@@ -44,7 +44,7 @@ impl CompuSprite {
];
CompuSprite {
verts: VertexTypes::ImageType(verts, image_handle.clone()),
verts: VertexType::ImageType(verts, image_handle.clone()),
position: position,
size: size,
color: (0.0, 0.0, 0.0, 0.0),
@@ -53,7 +53,7 @@ impl CompuSprite {
}
impl Drawable for CompuSprite {
fn get(&self) -> Vec<VertexTypes> {
fn get(&self) -> Vec<VertexType> {
vec![self.verts.clone()]
}
}

View File

@@ -2,14 +2,14 @@ use std::sync::Arc;
use crate::canvas::*;
use crate::canvas::managed::handles::{CanvasFontHandle, CanvasImageHandle, CanvasTextureHandle, Handle};
use crate::canvas::canvas_frame::{Drawable};
use crate::util::vertex::{VertexTypes, TextureVertex3D, Vertex3D, ColorVertex3D};
use crate::util::vertex::{VertexType, TextureVertex3D, Vertex3D, ColorVertex3D};
use crate::drawables::sprite::Sprite;
/// Convex multi verticy polygon
#[derive(Debug, Clone)]
pub struct Polygon {
pub verts: VertexTypes,
pub verts: VertexType,
position: (f32, f32),
size: (f32, f32),
@@ -54,14 +54,14 @@ impl Polygon {
Polygon {
verts: VertexTypes::ColorType(verts),
verts: VertexType::ColorType(verts),
position: position,
size: size,
}
}
}
impl Drawable for Polygon {
fn get(&self) -> Vec<VertexTypes> {
fn get(&self) -> Vec<VertexType> {
vec![self.verts.clone()]
}

View File

@@ -1,11 +1,11 @@
use crate::canvas::canvas_frame::Drawable;
use crate::util::vertex::{VertexTypes, ColorVertex3D};
use crate::util::vertex::{VertexType, ColorVertex3D};
///
#[derive(Debug, Clone)]
pub struct Rect {
pub verts: VertexTypes,
pub verts: VertexType,
position: (f32, f32),
size: (f32, f32),
@@ -43,14 +43,14 @@ impl Rect {
];
Rect {
verts: VertexTypes::ColorType(verts),
verts: VertexType::ColorType(verts),
position: position,
size: size,
}
}
}
impl Drawable for Rect {
fn get(&self) -> Vec<VertexTypes> {
fn get(&self) -> Vec<VertexType> {
vec![self.verts.clone()]
}

View File

@@ -2,13 +2,13 @@ use std::sync::Arc;
use crate::canvas::*;
use crate::canvas::managed::handles::{CanvasFontHandle, CanvasImageHandle, CanvasTextureHandle, Handle};
use crate::canvas::canvas_frame::{Drawable, Eventable};
use crate::util::vertex::{VertexTypes, TextureVertex3D, Vertex3D};
use crate::util::vertex::{VertexType, TextureVertex3D, Vertex3D};
use winit::event::{DeviceEvent, MouseButton, ElementState, Event, WindowEvent};
///
#[derive(Debug, Clone)]
pub struct Sprite {
verts: VertexTypes,
verts: VertexType,
position: (f32, f32),
size: (f32, f32),
@@ -55,7 +55,7 @@ impl Sprite {
let normalized_depth = (depth as f32 / 255.0);
Sprite {
verts: VertexTypes::TextureType(Sprite::generate_verts(position, size, normalized_depth), texture_handle.clone()),
verts: VertexType::TextureType(Sprite::generate_verts(position, size, normalized_depth), texture_handle.clone()),
position: position,
size: size,
depth: normalized_depth,
@@ -65,9 +65,9 @@ impl Sprite {
}
impl Drawable for Sprite {
fn get(&self) -> Vec<VertexTypes> {
fn get(&self) -> Vec<VertexType> {
vec![
VertexTypes::TextureType(
VertexType::TextureType(
Sprite::generate_verts(self.position, self.size, self.depth),
self.texture_handle.clone())
]

View File

@@ -1,10 +1,10 @@
use crate::canvas::canvas_frame::Drawable;
use crate::util::vertex::{VertexTypes, ColorVertex3D};
use crate::util::vertex::{VertexType, ColorVertex3D};
///
#[derive(Debug, Clone)]
pub struct Text {
pub verts: VertexTypes,
pub verts: VertexType,
position: (f32, f32),
size: (f32, f32),
@@ -129,7 +129,7 @@ impl Text {
};
Text {
verts: VertexTypes::TextType(verts),
verts: VertexType::TextType(verts),
position: position,
size: size,
}
@@ -137,7 +137,7 @@ impl Text {
}
impl Drawable for Text {
fn get(&self) -> Vec<VertexTypes> {
fn get(&self) -> Vec<VertexType> {
vec![self.verts.clone()]
}
}