This commit is contained in:
gallant 2023-08-06 08:01:37 -05:00
parent 04cba69e43
commit f87213638b

View file

@ -94,6 +94,7 @@
pub mod math; pub mod math;
pub mod sprite; pub mod sprite;
use sdl2::VideoSubsystem;
use sdl2::sys::SDL_Window; use sdl2::sys::SDL_Window;
pub use sprite::physics::*; pub use sprite::physics::*;
pub use sprite::sprite::{Sprite, SpriteCollection}; pub use sprite::sprite::{Sprite, SpriteCollection};
@ -482,15 +483,15 @@ impl Game {
/// Runs the game from a raw pointer to a Window (blocks) /// Runs the game from a raw pointer to a Window (blocks)
pub unsafe fn run_from_ll<F: FnMut(&mut Context)>( pub unsafe fn run_from_ll<F: FnMut(&mut Context)>(
&self, &self,
win: *mut SDL_Window, sdl_context: sdl2::Sdl,
_video_subsystem: VideoSubsystem,
window: sdl2::video::Window,
mut func: F, mut func: F,
) -> Result<()> { ) -> Result<()> {
unsafe { unsafe {
let sdl_context = sdl2::init()?;
let video_subsystem = sdl_context.video()?;
let window = Window::from_ll(video_subsystem, win);
let canvas = window.into_canvas().build()?; let canvas = window.into_canvas().build()?;
let s = sdl2::ttf::init()?; let s = sdl2::ttf::init()?;