-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support HiDPI fractional scaling #19
Comments
How is this going? on Manjaro and i can't launch the engine because of this. |
Don't quite know how to test this myself as my computer does not support it.
In case you have the time to both help me test this and tell me about your desired outcome, I might be able to do something here. |
Hmm you could send me some examples and i can send you the results, or maybe add both these things but let the user pick one. |
The easiest way to test this would be clone this repo and remove these three lines: Lines 135 to 137 in 12af842
You should then be able to run Adding AA will be kind of a mess so I would first like to see if the first approach works. |
hmm, does look ok I guess. What's your DPI? I can replace the |
fractional HiDPI scaling is not yet supported: 1.5 <--- |
It is the worst case 😆 It doesn't seem like I have an example that requires the whole screen though. Will look into this more later 👍 |
IDK how github works, |
I have some data for the devs: Panic
cargo --version --verbose
My Code:use crow::{
glutin::{
event::{Event, WindowEvent},
event_loop::{ControlFlow, EventLoop},
window::WindowBuilder,
},
Context,
DrawConfig,
Texture,
NewTextureError,
image::{
self,
ImageFormat,
}
};
use std::path::Path;
use asefile::AsepriteFile;
trait FromAseprite{
fn from_ase(ctx: &mut Context, path: &Path) -> Result<Texture, NewTextureError>;
}
impl FromAseprite for Texture{
fn from_ase(ctx: &mut Context, path: &Path) -> Result<Texture, NewTextureError> {
let ase = AsepriteFile::read_file(path).unwrap();
let img = ase.frame(0).image();
Texture::from_image(ctx, img)
}
}
fn main() -> Result<(), crow::Error> {
let event_loop = EventLoop::new();
let mut ctx = Context::new(WindowBuilder::new(), &event_loop)?;
let texture = Texture::from_ase(&mut ctx, Path::new("./data/graphics/player.aseprite"))?;
event_loop.run(
move |event: Event<()>, _window_target: _, control_flow: &mut ControlFlow| match event {
Event::WindowEvent {
event: WindowEvent::CloseRequested,
..
} => *control_flow = ControlFlow::Exit,
Event::MainEventsCleared => ctx.window().request_redraw(),
Event::RedrawRequested(_) => {
let mut surface = ctx.surface();
ctx.clear_color(&mut surface, (0.4, 0.4, 0.8, 1.0));
ctx.draw(&mut surface, &texture, (100, 150), &DrawConfig::default());
ctx.present(surface).unwrap();
}
_ => (),
},
)
} |
forgot to actually publish a new version of this crate, published version |
extracted from #4,
We currently panic in case dpi is not a whole number.
The text was updated successfully, but these errors were encountered: