107 pub fn get_pixel(&self, x: usize, y: usize) -> u32 { |
108 pub fn get_pixel(&self, x: usize, y: usize) -> u32 { |
108 self.pixels[get_tiled_index(x, y, self.tile_width_shift)] |
109 self.pixels[get_tiled_index(x, y, self.tile_width_shift)] |
109 } |
110 } |
110 } |
111 } |
111 |
112 |
|
113 #[derive(Default)] |
|
114 struct Color(u8, u8, u8, u8); |
|
115 |
|
116 pub struct LandObjectOverlay { |
|
117 texture: ThemeSprite, |
|
118 offset: Point, |
|
119 } |
|
120 |
|
121 pub struct LandObject { |
|
122 texture: ThemeSprite, |
|
123 inland_rects: Vec<Rect>, |
|
124 outland_rects: Vec<Rect>, |
|
125 anchors: Vec<Rect>, |
|
126 overlays: Vec<LandObjectOverlay>, |
|
127 } |
|
128 |
|
129 pub struct LandSpray { |
|
130 texture: ThemeSprite, |
|
131 count: u16, |
|
132 } |
|
133 |
|
134 #[derive(Default)] |
|
135 pub struct ThemeColors { |
|
136 border: Color, |
|
137 } |
|
138 |
|
139 pub struct Flakes { |
|
140 texture: ThemeSprite, |
|
141 frames_count: u16, |
|
142 frame_ticks: u16, |
|
143 velocity: u16, |
|
144 fall_speed: u16, |
|
145 } |
|
146 |
|
147 #[derive(Default)] |
|
148 pub struct Water { |
|
149 top_color: Color, |
|
150 bottom_color: Color, |
|
151 opacity: u8, |
|
152 } |
|
153 |
|
154 #[derive(Default)] |
|
155 pub struct ThemeParts { |
|
156 water: Water, |
|
157 flakes: Option<Flakes>, |
|
158 music: String, |
|
159 sky: Color, |
|
160 tint: Color, |
|
161 } |
|
162 |
|
163 #[derive(Default)] |
112 pub struct Theme { |
164 pub struct Theme { |
|
165 border_color: Color, |
|
166 clouds_count: u16, |
|
167 flatten_flakes: bool, |
113 land_texture: Option<ThemeSprite>, |
168 land_texture: Option<ThemeSprite>, |
114 border_texture: Option<ThemeSprite>, |
169 border_texture: Option<ThemeSprite>, |
|
170 land_objects: Vec<LandObject>, |
|
171 spays: Vec<LandSpray>, |
|
172 use_ice: bool, |
|
173 use_snow: bool, |
|
174 music: String, |
|
175 normal_parts: ThemeParts, |
|
176 sd_parts: ThemeParts, |
115 } |
177 } |
116 |
178 |
117 impl Theme { |
179 impl Theme { |
118 pub fn land_texture(&self) -> Option<&ThemeSprite> { |
180 pub fn land_texture(&self) -> Option<&ThemeSprite> { |
119 self.land_texture.as_ref() |
181 self.land_texture.as_ref() |