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