core: Bump winit, glutin, glium versions
This commit is contained in:
parent
b05745da01
commit
97edbc98df
|
@ -8,8 +8,8 @@ default-run = "ruffle_desktop"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cpal = "0.10.0"
|
cpal = "0.10.0"
|
||||||
ruffle_core = { path = "../core" }
|
ruffle_core = { path = "../core" }
|
||||||
glium = "0.24"
|
glium = "0.26.0-alpha3"
|
||||||
glutin = "0.20"
|
glutin = "0.22.0-alpha3"
|
||||||
env_logger = "0.6.1"
|
env_logger = "0.6.1"
|
||||||
generational-arena = "0.2.2"
|
generational-arena = "0.2.2"
|
||||||
image = "0.21.1"
|
image = "0.21.1"
|
||||||
|
@ -18,6 +18,6 @@ log = "0.4"
|
||||||
lyon = "0.13.3"
|
lyon = "0.13.3"
|
||||||
sample = "0.10.0"
|
sample = "0.10.0"
|
||||||
structopt = "0.2.15"
|
structopt = "0.2.15"
|
||||||
winit = "0.19.1"
|
winit = "0.20.0-alpha4"
|
||||||
webbrowser = "0.5.2"
|
webbrowser = "0.5.2"
|
||||||
url = "2.1.0"
|
url = "2.1.0"
|
||||||
|
|
|
@ -5,7 +5,10 @@ mod render;
|
||||||
use crate::render::GliumRenderBackend;
|
use crate::render::GliumRenderBackend;
|
||||||
use glutin::{
|
use glutin::{
|
||||||
dpi::{LogicalSize, PhysicalPosition},
|
dpi::{LogicalSize, PhysicalPosition},
|
||||||
ContextBuilder, ElementState, EventsLoop, MouseButton, WindowBuilder, WindowEvent,
|
event::{ElementState, MouseButton, WindowEvent},
|
||||||
|
event_loop::{ControlFlow, EventLoop},
|
||||||
|
window::WindowBuilder,
|
||||||
|
ContextBuilder,
|
||||||
};
|
};
|
||||||
use ruffle_core::{backend::render::RenderBackend, Player};
|
use ruffle_core::{backend::render::RenderBackend, Player};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
@ -35,14 +38,14 @@ fn main() {
|
||||||
fn run_player(input_path: PathBuf) -> Result<(), Box<dyn std::error::Error>> {
|
fn run_player(input_path: PathBuf) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let swf_data = std::fs::read(input_path)?;
|
let swf_data = std::fs::read(input_path)?;
|
||||||
|
|
||||||
let mut events_loop = EventsLoop::new();
|
let event_loop = EventLoop::new();
|
||||||
let window_builder = WindowBuilder::new().with_title("Ruffle");
|
let window_builder = WindowBuilder::new().with_title("Ruffle");
|
||||||
let windowed_context = ContextBuilder::new()
|
let windowed_context = ContextBuilder::new()
|
||||||
.with_vsync(true)
|
.with_vsync(true)
|
||||||
.with_multisampling(4)
|
.with_multisampling(4)
|
||||||
.with_srgb(true)
|
.with_srgb(true)
|
||||||
.with_stencil_buffer(8)
|
.with_stencil_buffer(8)
|
||||||
.build_windowed(window_builder, &events_loop)?;
|
.build_windowed(window_builder, &event_loop)?;
|
||||||
let audio = audio::CpalAudioBackend::new()?;
|
let audio = audio::CpalAudioBackend::new()?;
|
||||||
let renderer = GliumRenderBackend::new(windowed_context)?;
|
let renderer = GliumRenderBackend::new(windowed_context)?;
|
||||||
let navigator = navigator::ExternalNavigatorBackend::new(); //TODO: actually implement this backend type
|
let navigator = navigator::ExternalNavigatorBackend::new(); //TODO: actually implement this backend type
|
||||||
|
@ -51,22 +54,21 @@ fn run_player(input_path: PathBuf) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
player.set_is_playing(true); // Desktop player will auto-play.
|
player.set_is_playing(true); // Desktop player will auto-play.
|
||||||
|
|
||||||
let logical_size: LogicalSize = (player.movie_width(), player.movie_height()).into();
|
let logical_size: LogicalSize = (player.movie_width(), player.movie_height()).into();
|
||||||
let hidpi_factor = display.gl_window().get_hidpi_factor();
|
let hidpi_factor = display.gl_window().window().hidpi_factor();
|
||||||
|
|
||||||
display
|
display
|
||||||
.gl_window()
|
.gl_window()
|
||||||
.resize(logical_size.to_physical(hidpi_factor));
|
.resize(logical_size.to_physical(hidpi_factor));
|
||||||
|
|
||||||
display.gl_window().set_inner_size(logical_size);
|
|
||||||
|
|
||||||
let mut mouse_pos = PhysicalPosition::new(0.0, 0.0);
|
let mut mouse_pos = PhysicalPosition::new(0.0, 0.0);
|
||||||
let mut time = Instant::now();
|
let mut time = Instant::now();
|
||||||
loop {
|
loop {
|
||||||
// Poll UI events
|
// Poll UI events
|
||||||
let mut request_close = false;
|
event_loop.run(move |event, _window_target, control_flow| {
|
||||||
events_loop.poll_events(|event| {
|
*control_flow = ControlFlow::Poll;
|
||||||
if let glutin::Event::WindowEvent { event, .. } = event {
|
|
||||||
match event {
|
match event {
|
||||||
|
glutin::event::Event::LoopDestroyed => return,
|
||||||
|
glutin::event::Event::WindowEvent { event, .. } => match event {
|
||||||
WindowEvent::Resized(logical_size) => {
|
WindowEvent::Resized(logical_size) => {
|
||||||
let size = logical_size.to_physical(hidpi_factor);
|
let size = logical_size.to_physical(hidpi_factor);
|
||||||
player.set_viewport_dimensions(
|
player.set_viewport_dimensions(
|
||||||
|
@ -108,14 +110,10 @@ fn run_player(input_path: PathBuf) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
WindowEvent::CursorLeft { .. } => {
|
WindowEvent::CursorLeft { .. } => {
|
||||||
player.handle_event(ruffle_core::PlayerEvent::MouseLeft)
|
player.handle_event(ruffle_core::PlayerEvent::MouseLeft)
|
||||||
}
|
}
|
||||||
WindowEvent::CloseRequested => request_close = true,
|
WindowEvent::CloseRequested => *control_flow = ControlFlow::Exit,
|
||||||
|
_ => (),
|
||||||
|
},
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if request_close {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let new_time = Instant::now();
|
let new_time = Instant::now();
|
||||||
|
@ -126,6 +124,6 @@ fn run_player(input_path: PathBuf) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::thread::sleep(player.time_til_next_frame());
|
std::thread::sleep(player.time_til_next_frame());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,9 @@ pub struct GliumRenderBackend {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GliumRenderBackend {
|
impl GliumRenderBackend {
|
||||||
pub fn new(windowed_context: WindowedContext) -> Result<GliumRenderBackend, Error> {
|
pub fn new<T: glutin::ContextCurrentState>(
|
||||||
|
windowed_context: WindowedContext<T>,
|
||||||
|
) -> Result<GliumRenderBackend, Error> {
|
||||||
let display = Display::from_gl_window(windowed_context)?;
|
let display = Display::from_gl_window(windowed_context)?;
|
||||||
|
|
||||||
use glium::program::ProgramCreationInput;
|
use glium::program::ProgramCreationInput;
|
||||||
|
|
Loading…
Reference in New Issue