Brainstorming the design.

This commit is contained in:
2019-08-07 23:36:52 -07:00
parent c5b3c29ad4
commit 2207c41956
2 changed files with 62 additions and 21 deletions

View File

@@ -10,7 +10,7 @@ pub struct Sprite {
color: (f32, f32, f32, f32),
textured: bool,
texture_id: i32,
texture_id: Option<String>,
}
@@ -39,11 +39,11 @@ impl Sprite {
size: size,
color: color,
textured: false,
texture_id: 0
texture_id: None
}
}
pub fn new_with_texture(position: (f32, f32), size: (u32, u32), texture_id: i32) -> Sprite {
pub fn new_with_texture(position: (f32, f32), size: (u32, u32), texture_id: String) -> Sprite {
let fsize = (size.0 as f32, size.1 as f32);
@@ -60,7 +60,7 @@ impl Sprite {
size,
color: (0.0, 0.0, 0.0, 0.0),
textured: false,
texture_id
texture_id: Some(texture_id)
}
}
@@ -77,10 +77,10 @@ impl Drawable for Sprite {
self.color.clone()
}
fn get_texture_id(&self) -> Option<i32> {
fn get_texture_id(&self) -> Option<String> {
match self.textured {
true => {
Some(self.texture_id.clone())
self.texture_id.clone()
},
false => None,
}