mirror of
https://github.com/italicsjenga/rust_minifb.git
synced 2024-12-23 11:21:30 +11:00
Moved codebase to edition 2018 (#127)
* Moved to Rust edition 2018 * Changed redox code as well * Undo typo * Another correction
This commit is contained in:
parent
5cf1708938
commit
51bdfcc5ca
|
@ -9,6 +9,7 @@ categories = ["rendering"]
|
|||
repository = "https://github.com/emoon/rust_minifb"
|
||||
documentation = "https://docs.rs/minifb/0.15/minifb"
|
||||
build = "build.rs"
|
||||
edition = "2018"
|
||||
readme = "README.md"
|
||||
|
||||
exclude = [
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use error::Error;
|
||||
use Result;
|
||||
use crate::error::Error;
|
||||
use crate::Result;
|
||||
|
||||
pub fn check_buffer_size(
|
||||
buffer_width: usize,
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
extern crate time;
|
||||
|
||||
use std::mem;
|
||||
use {InputCallback, Key, KeyRepeat};
|
||||
use crate::{InputCallback, Key, KeyRepeat};
|
||||
|
||||
pub struct KeyHandler {
|
||||
pub key_callback: Option<Box<dyn InputCallback>>,
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
//!
|
||||
#![deny(missing_debug_implementations)]
|
||||
|
||||
extern crate raw_window_handle;
|
||||
|
||||
use std::fmt;
|
||||
use std::os::raw;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use MouseMode;
|
||||
use crate::MouseMode;
|
||||
|
||||
fn clamp(v: f32, lb: f32, ub: f32) -> f32 {
|
||||
f32::min(f32::max(v, lb), ub)
|
||||
|
|
|
@ -1,18 +1,16 @@
|
|||
#![cfg(target_os = "macos")]
|
||||
|
||||
extern crate raw_window_handle;
|
||||
|
||||
use error::Error;
|
||||
use key_handler::KeyHandler;
|
||||
use rate::UpdateRate;
|
||||
use Result;
|
||||
use {Key, KeyRepeat, MouseButton, MouseMode, Scale, WindowOptions};
|
||||
use crate::error::Error;
|
||||
use crate::key_handler::KeyHandler;
|
||||
use crate::rate::UpdateRate;
|
||||
use crate::Result;
|
||||
use crate::{Key, KeyRepeat, MouseButton, MouseMode, Scale, WindowOptions};
|
||||
// use MenuItem;
|
||||
use buffer_helper;
|
||||
use mouse_handler;
|
||||
use window_flags;
|
||||
use InputCallback;
|
||||
use {CursorStyle, MenuHandle, MenuItem, MenuItemHandle};
|
||||
use crate::buffer_helper;
|
||||
use crate::mouse_handler;
|
||||
use crate::window_flags;
|
||||
use crate::InputCallback;
|
||||
use crate::{CursorStyle, MenuHandle, MenuItem, MenuItemHandle};
|
||||
// use menu::Menu;
|
||||
|
||||
use std::ffi::CString;
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
#![cfg(target_os = "redox")]
|
||||
|
||||
extern crate orbclient;
|
||||
use os::redox::orbclient::Renderer;
|
||||
use crate::os::redox::orbclient::Renderer;
|
||||
|
||||
use buffer_helper;
|
||||
use error::Error;
|
||||
use key_handler::KeyHandler;
|
||||
use mouse_handler;
|
||||
use InputCallback;
|
||||
use Result;
|
||||
use {CursorStyle, MouseButton, MouseMode};
|
||||
use {Key, KeyRepeat};
|
||||
use {MenuHandle, MenuItem, MenuItemHandle, UnixMenu, UnixMenuItem};
|
||||
use {Scale, WindowOptions};
|
||||
use crate::buffer_helper;
|
||||
use crate::error::Error;
|
||||
use crate::key_handler::KeyHandler;
|
||||
use crate::mouse_handler;
|
||||
use crate::InputCallback;
|
||||
use crate::Result;
|
||||
use crate::{CursorStyle, MouseButton, MouseMode};
|
||||
use crate::{Key, KeyRepeat};
|
||||
use crate::{MenuHandle, MenuItem, MenuItemHandle, UnixMenu, UnixMenuItem};
|
||||
use crate::{Scale, WindowOptions};
|
||||
|
||||
use std::cmp;
|
||||
use std::os::raw;
|
||||
|
|
|
@ -8,20 +8,16 @@
|
|||
// turn off a gazillion warnings about X keysym names
|
||||
#![allow(non_upper_case_globals)]
|
||||
|
||||
extern crate cast;
|
||||
extern crate raw_window_handle;
|
||||
extern crate x11_dl;
|
||||
use x11_dl::keysym::*;
|
||||
use x11_dl::xcursor;
|
||||
use x11_dl::xlib;
|
||||
use crate::key_handler::KeyHandler;
|
||||
use crate::rate::UpdateRate;
|
||||
use crate::{InputCallback, Key, KeyRepeat, MouseButton, MouseMode, Scale, ScaleMode, WindowOptions};
|
||||
|
||||
use self::x11_dl::keysym::*;
|
||||
use self::x11_dl::xcursor;
|
||||
use self::x11_dl::xlib;
|
||||
use key_handler::KeyHandler;
|
||||
use rate::UpdateRate;
|
||||
use {InputCallback, Key, KeyRepeat, MouseButton, MouseMode, Scale, ScaleMode, WindowOptions};
|
||||
|
||||
use error::Error;
|
||||
use Result;
|
||||
use {CursorStyle, MenuHandle, MenuItem, MenuItemHandle, UnixMenu, UnixMenuItem};
|
||||
use crate::error::Error;
|
||||
use crate::Result;
|
||||
use crate::{CursorStyle, MenuHandle, MenuItem, MenuItemHandle, UnixMenu, UnixMenuItem};
|
||||
|
||||
use std::ffi::CString;
|
||||
use std::mem;
|
||||
|
@ -29,8 +25,8 @@ use std::os::raw;
|
|||
use std::os::raw::{c_char, c_uint};
|
||||
use std::ptr;
|
||||
|
||||
use buffer_helper;
|
||||
use mouse_handler;
|
||||
use crate::buffer_helper;
|
||||
use crate::mouse_handler;
|
||||
|
||||
// NOTE: the x11-dl crate does not define Button6 or Button7
|
||||
const Button6: c_uint = xlib::Button5 + 1;
|
||||
|
|
|
@ -1,35 +1,31 @@
|
|||
#![cfg(target_os = "windows")]
|
||||
|
||||
extern crate raw_window_handle;
|
||||
extern crate time;
|
||||
extern crate winapi;
|
||||
|
||||
const INVALID_ACCEL: usize = 0xffffffff;
|
||||
|
||||
use error::Error;
|
||||
use key_handler::KeyHandler;
|
||||
use rate::UpdateRate;
|
||||
use Result;
|
||||
use {CursorStyle, MenuHandle, MenuItem, MenuItemHandle};
|
||||
use {InputCallback, Key, KeyRepeat, MouseButton, MouseMode, Scale, ScaleMode, WindowOptions};
|
||||
use {MENU_KEY_ALT, MENU_KEY_CTRL, MENU_KEY_SHIFT, MENU_KEY_WIN};
|
||||
use crate::error::Error;
|
||||
use crate::key_handler::KeyHandler;
|
||||
use crate::rate::UpdateRate;
|
||||
use crate::Result;
|
||||
use crate::{CursorStyle, MenuHandle, MenuItem, MenuItemHandle};
|
||||
use crate::{InputCallback, Key, KeyRepeat, MouseButton, MouseMode, Scale, ScaleMode, WindowOptions};
|
||||
use crate::{MENU_KEY_ALT, MENU_KEY_CTRL, MENU_KEY_SHIFT, MENU_KEY_WIN};
|
||||
|
||||
use buffer_helper;
|
||||
use mouse_handler;
|
||||
use crate::buffer_helper;
|
||||
use crate::mouse_handler;
|
||||
use std::ffi::OsStr;
|
||||
use std::mem;
|
||||
use std::os::raw;
|
||||
use std::os::windows::ffi::OsStrExt;
|
||||
use std::ptr;
|
||||
|
||||
use self::winapi::shared::basetsd;
|
||||
use self::winapi::shared::minwindef;
|
||||
use self::winapi::shared::ntdef;
|
||||
use self::winapi::shared::windef;
|
||||
use self::winapi::um::errhandlingapi;
|
||||
use self::winapi::um::libloaderapi;
|
||||
use self::winapi::um::wingdi;
|
||||
use self::winapi::um::winuser;
|
||||
use winapi::shared::basetsd;
|
||||
use winapi::shared::minwindef;
|
||||
use winapi::shared::ntdef;
|
||||
use winapi::shared::windef;
|
||||
use winapi::um::errhandlingapi;
|
||||
use winapi::um::libloaderapi;
|
||||
use winapi::um::wingdi;
|
||||
use winapi::um::winuser;
|
||||
|
||||
// Wrap this so we can have a proper numbef of bmiColors to write in
|
||||
#[repr(C)]
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
extern crate time;
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
pub struct UpdateRate {
|
||||
|
|
|
@ -5,7 +5,7 @@ const WINDOW_RESIZE: u32 = 1 << 2;
|
|||
#[allow(dead_code)]
|
||||
const WINDOW_TITLE: u32 = 1 << 3;
|
||||
|
||||
use WindowOptions;
|
||||
use crate::WindowOptions;
|
||||
|
||||
//
|
||||
// Construct a bitmask of flags (sent to backends) from WindowOpts
|
||||
|
|
Loading…
Reference in a new issue