Add MorphShape stub

This commit is contained in:
Mike Welsh 2019-05-03 14:25:54 -07:00
parent 34f31a37f0
commit 1f6aa4e4e1
1 changed files with 49 additions and 0 deletions

49
core/src/morph_shape.rs Normal file
View File

@ -0,0 +1,49 @@
use crate::backend::render::ShapeHandle;
use crate::color_transform::ColorTransform;
use crate::display_object::{DisplayObjectBase, DisplayObjectImpl, DisplayObjectUpdate};
use crate::matrix::Matrix;
use crate::player::{RenderContext, UpdateContext};
use bacon_rajan_cc::{Trace, Tracer};
use swf::DefineMorphShape;
pub struct MorphShape {
base: DisplayObjectBase,
shape_handle: ShapeHandle,
x_min: f32,
y_min: f32,
}
impl MorphShape {
pub fn new(swf_tag: &DefineMorphShape) -> MorphShape {
Graphic {
base: Default::default(),
shape_handle,
x_min,
y_min,
}
}
}
impl_display_object!(MorphShape, base);
impl DisplayObjectUpdate for MorphShape {
fn run_frame(&mut self, _context: &mut UpdateContext) {
// Noop
}
fn render(&self, context: &mut RenderContext) {
context.transform_stack.push(self.transform());
context
.renderer
.render_shape(self.shape_handle, context.transform_stack.transform());
context.transform_stack.pop();
}
}
impl Trace for MorphShape {
fn trace(&mut self, _tracer: &mut Tracer) {
// Noop
}
}