1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
extern crate gl;
use self::gl::types::*;
use crate::actor::Actor;
pub struct Stage {
width: u32,
height: u32,
viewport_width: u32,
viewport_height: u32,
stage_actor: Actor,
}
impl Stage {
pub fn new(vw: u32, vh: u32) -> Self {
Stage {
width: 0,
height: 0,
viewport_width: vw,
viewport_height: vh,
stage_actor: Actor::new("stage_actor".to_string(), vw, vh),
}
}
pub fn initialize(&mut self) {
}
pub fn render(&mut self, shader_program: GLuint) {
self.stage_actor.animate();
self.stage_actor.render(shader_program, None);
}
pub fn add_actor(&mut self, mut actor: Actor) {
actor.init_gl(self.viewport_width, self.viewport_height);
self.stage_actor.sub_actor_list.push(actor);
}
}