rust/lib-hedgewars-engine/src/lib.rs
changeset 15921 5b3beb90e1a6
parent 15919 d52f5d8e75e6
child 15954 9502611bffc1
child 16045 4933920eba89
equal deleted inserted replaced
15920:b3295f94e5e9 15921:5b3beb90e1a6
   111         };
   111         };
   112     }
   112     }
   113 }
   113 }
   114 
   114 
   115 #[no_mangle]
   115 #[no_mangle]
   116 pub extern "C" fn dispose_preview(engine_state: &mut EngineInstance, preview: &mut PreviewInfo) {
   116 pub extern "C" fn dispose_preview(engine_state: &mut EngineInstance) {
   117     (*engine_state).world.dispose_preview();
   117     (*engine_state).world.dispose_preview();
   118 }
   118 }
   119 
   119 
   120 #[no_mangle]
   120 #[no_mangle]
   121 pub extern "C" fn send_ipc(engine_state: &mut EngineInstance, buf: *const u8, size: usize) {
   121 pub extern "C" fn send_ipc(engine_state: &mut EngineInstance, buf: *const u8, size: usize) {
   140 #[no_mangle]
   140 #[no_mangle]
   141 pub extern "C" fn setup_current_gl_context(
   141 pub extern "C" fn setup_current_gl_context(
   142     engine_state: &mut EngineInstance,
   142     engine_state: &mut EngineInstance,
   143     width: u16,
   143     width: u16,
   144     height: u16,
   144     height: u16,
   145     gl_loader: extern "C" fn(*const c_char) -> *const c_void,
   145     gl_loader: extern "C" fn(*const c_char) -> *mut c_void,
   146 ) {
   146 ) {
   147     gl::load_with(|name| {
   147     gl::load_with(|name| {
   148         let c_name = CString::new(name).unwrap();
   148         let c_name = CString::new(name).unwrap();
   149         gl_loader(c_name.as_ptr())
   149         gl_loader(c_name.as_ptr())
   150     });
   150     });
   173 }
   173 }
   174 
   174 
   175 #[no_mangle]
   175 #[no_mangle]
   176 pub extern "C" fn cleanup(engine_state: *mut EngineInstance) {
   176 pub extern "C" fn cleanup(engine_state: *mut EngineInstance) {
   177     unsafe {
   177     unsafe {
   178         Box::from_raw(engine_state);
   178         drop(Box::from_raw(engine_state));
   179     }
   179     }
   180 }
   180 }