summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/bmp.rs4
-rw-r--r--src/texture.rs14
2 files changed, 9 insertions, 9 deletions
diff --git a/examples/bmp.rs b/examples/bmp.rs
index b8e4011..af425ff 100644
--- a/examples/bmp.rs
+++ b/examples/bmp.rs
@@ -12,8 +12,8 @@ fn main() {
instance_capacity: 2,
default_width: NonZeroU32::new(1280).unwrap(),
default_height: NonZeroU32::new(720).unwrap(),
- //mode: alligator_render::config::WindowMode::BorderlessFullscreen,
- //vsync: false,
+ mode: alligator_render::config::WindowMode::BorderlessFullscreen,
+ vsync: false,
..Default::default()
};
diff --git a/src/texture.rs b/src/texture.rs
index 060a029..da69c77 100644
--- a/src/texture.rs
+++ b/src/texture.rs
@@ -82,11 +82,11 @@ pub struct TextureAtlas {
}
macro_rules! texture_info {
- ($name: ident, $prop: ident) => {
+ ($name: ident, $prop: ident, $divisor: ident) => {
pub fn $name(&self, id: TextureId) -> Option<f32> {
let frame = self.texture_frame(id)?;
let property = frame.frame.$prop;
- let value = property as f32;
+ let value = property as f32 / self.$divisor as f32;
Some(value)
}
};
@@ -198,10 +198,10 @@ impl TextureAtlas {
self.packer.get_frame(&id)
}
- texture_info!(texture_width, w);
- texture_info!(texture_height, h);
- texture_info!(texture_x, x);
- texture_info!(texture_y, y);
+ texture_info!(texture_width, w, width);
+ texture_info!(texture_height, h, height);
+ texture_info!(texture_x, x, width);
+ texture_info!(texture_y, y, height);
fn fill_image(&mut self) -> ExportResult<()> {
let atlas = {
@@ -215,7 +215,7 @@ impl TextureAtlas {
Ok(())
}
- fn clear(&mut self) {
+ pub fn clear(&mut self) {
self.packer = TexturePacker::new_skyline(TexturePackerConfig {
max_width: self.width,
max_height: self.height,