added hello-world example + modified vkproccessor to live inside specs
This commit is contained in:
@@ -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::{VertexType, ImageVertex3D};
|
||||
use crate::util::vertex::{VertexTypeContainer, ImageVertex3D};
|
||||
|
||||
pub struct CompuSprite {
|
||||
|
||||
pub verts: VertexType,
|
||||
pub verts: VertexTypeContainer,
|
||||
|
||||
position: (f32, f32),
|
||||
size: (f32, f32),
|
||||
@@ -44,7 +44,7 @@ impl CompuSprite {
|
||||
];
|
||||
|
||||
CompuSprite {
|
||||
verts: VertexType::ImageType(verts, image_handle.clone()),
|
||||
verts: VertexTypeContainer::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, window_size: (u32, u32)) -> Vec<VertexType> {
|
||||
fn get(&self, window_size: (u32, u32)) -> Vec<VertexTypeContainer> {
|
||||
vec![self.verts.clone()]
|
||||
}
|
||||
}
|
||||
@@ -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::{VertexType, TextureVertex3D, Vertex3D, ColorVertex3D};
|
||||
use crate::util::vertex::{VertexTypeContainer, TextureVertex3D, Vertex3D, ColorVertex3D};
|
||||
use crate::drawables::sprite::Sprite;
|
||||
|
||||
/// Convex multi verticy polygon
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Polygon {
|
||||
|
||||
pub verts: VertexType,
|
||||
pub verts: VertexTypeContainer,
|
||||
|
||||
position: (f32, f32),
|
||||
size: (f32, f32),
|
||||
@@ -54,14 +54,14 @@ impl Polygon {
|
||||
|
||||
|
||||
Polygon {
|
||||
verts: VertexType::ColorType(verts),
|
||||
verts: VertexTypeContainer::ColorType(verts),
|
||||
position: position,
|
||||
size: size,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl Drawable for Polygon {
|
||||
fn get(&self, window_size: (u32, u32)) -> Vec<VertexType> {
|
||||
fn get(&self, window_size: (u32, u32)) -> Vec<VertexTypeContainer> {
|
||||
vec![self.verts.clone()]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::canvas::canvas_frame::Drawable;
|
||||
use crate::util::vertex::{VertexType, ColorVertex3D};
|
||||
use crate::util::vertex::{VertexTypeContainer, ColorVertex3D};
|
||||
|
||||
///
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -73,9 +73,9 @@ impl Rect {
|
||||
}
|
||||
|
||||
impl Drawable for Rect {
|
||||
fn get(&self, window_size: (u32, u32)) -> Vec<VertexType> {
|
||||
fn get(&self, window_size: (u32, u32)) -> Vec<VertexTypeContainer> {
|
||||
vec![
|
||||
VertexType::ColorType(
|
||||
VertexTypeContainer::ColorType(
|
||||
Rect::generate_vertices(window_size, self.position, self.size, self.depth, self.color)
|
||||
)
|
||||
]
|
||||
|
||||
@@ -5,7 +5,7 @@ use winit::event::Event;
|
||||
use crate::canvas::canvas_frame::{Drawable, Eventable};
|
||||
use crate::drawables::rect::Rect;
|
||||
use crate::drawables::sprite::Sprite;
|
||||
use crate::util::vertex::VertexType;
|
||||
use crate::util::vertex::VertexTypeContainer;
|
||||
|
||||
pub struct Slider {
|
||||
handle: Rect,
|
||||
@@ -45,14 +45,14 @@ impl Slider {
|
||||
}
|
||||
|
||||
impl Drawable for Slider {
|
||||
fn get(&self, window_size: (u32, u32)) -> Vec<VertexType> {
|
||||
fn get(&self, window_size: (u32, u32)) -> Vec<VertexTypeContainer> {
|
||||
let mut vertices = self.handle.get(window_size).clone();
|
||||
|
||||
vertices.extend_from_slice(
|
||||
self.guide.iter()
|
||||
.map(|x| x.get(window_size))
|
||||
.flatten()
|
||||
.collect::<Vec<VertexType>>()
|
||||
.collect::<Vec<VertexTypeContainer>>()
|
||||
.as_slice()
|
||||
);
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ use std::sync::Arc;
|
||||
use crate::canvas::*;
|
||||
use crate::canvas::managed::handles::{CanvasFontHandle, CanvasImageHandle, CanvasTextureHandle, Handle};
|
||||
use crate::canvas::canvas_frame::{Drawable, Eventable, Updatable};
|
||||
use crate::util::vertex::{VertexType, TextureVertex3D, Vertex3D};
|
||||
use crate::util::vertex::{VertexTypeContainer, TextureVertex3D, Vertex3D};
|
||||
use winit::event::{DeviceEvent, MouseButton, ElementState, Event, WindowEvent};
|
||||
|
||||
///
|
||||
@@ -73,9 +73,9 @@ impl Sprite {
|
||||
}
|
||||
|
||||
impl Drawable for Sprite {
|
||||
fn get(&self, window_size: (u32, u32)) -> Vec<VertexType> {
|
||||
fn get(&self, window_size: (u32, u32)) -> Vec<VertexTypeContainer> {
|
||||
vec![
|
||||
VertexType::TextureType(
|
||||
VertexTypeContainer::TextureType(
|
||||
Sprite::generate_verts(window_size, self.position, self.size, self.depth),
|
||||
self.texture_handle.clone())
|
||||
]
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use crate::canvas::canvas_frame::Drawable;
|
||||
use crate::util::vertex::{VertexType, ColorVertex3D};
|
||||
use crate::util::vertex::{VertexTypeContainer, ColorVertex3D};
|
||||
|
||||
///
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Text {
|
||||
pub verts: VertexType,
|
||||
pub verts: VertexTypeContainer,
|
||||
|
||||
position: (f32, f32),
|
||||
size: (f32, f32),
|
||||
@@ -129,7 +129,7 @@ impl Text {
|
||||
};
|
||||
|
||||
Text {
|
||||
verts: VertexType::TextType(verts),
|
||||
verts: VertexTypeContainer::TextType(verts),
|
||||
position: position,
|
||||
size: size,
|
||||
}
|
||||
@@ -137,7 +137,7 @@ impl Text {
|
||||
}
|
||||
|
||||
impl Drawable for Text {
|
||||
fn get(&self, window_size: (u32, u32)) -> Vec<VertexType> {
|
||||
fn get(&self, window_size: (u32, u32)) -> Vec<VertexTypeContainer> {
|
||||
vec![self.verts.clone()]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user