mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 16:21:33 +11:00
Actually make a library and start sketching out the interface
This commit is contained in:
parent
58d6876e17
commit
c8d0f82c34
41
agb-image-converter/src/lib.rs
Normal file
41
agb-image-converter/src/lib.rs
Normal file
|
@ -0,0 +1,41 @@
|
|||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct Colour {
|
||||
r: u8,
|
||||
g: u8,
|
||||
b: u8,
|
||||
}
|
||||
|
||||
impl Colour {
|
||||
pub fn from_rgb(r: u8, g: u8, b: u8) -> Self {
|
||||
Colour { r, g, b }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum TileSize {
|
||||
Tile8,
|
||||
Tile16,
|
||||
}
|
||||
|
||||
pub struct ImageConverter {}
|
||||
|
||||
pub struct ImageConverterConfigBuilder {
|
||||
transparent_colour: Option<Colour>,
|
||||
tile_size: TileSize,
|
||||
}
|
||||
|
||||
impl ImageConverterConfigBuilder {
|
||||
pub fn new_with_tile_size(tile_size: TileSize) -> Self {
|
||||
ImageConverterConfigBuilder {
|
||||
tile_size,
|
||||
transparent_colour: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_transparent_colour(&self, transparent_colour: Colour) -> Self {
|
||||
ImageConverterConfigBuilder {
|
||||
transparent_colour: Some(transparent_colour),
|
||||
..*self
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
Loading…
Reference in a new issue