rust_minifb/src/lib.rs

175 lines
3.3 KiB
Rust
Raw Normal View History

2015-11-23 04:55:38 +11:00
extern crate libc;
2015-11-24 06:21:11 +11:00
#[cfg(target_os = "macos")]
2015-12-09 04:49:03 +11:00
#[macro_use]
extern crate objc;
#[cfg(target_os = "macos")]
extern crate cgl;
#[cfg(target_os = "macos")]
extern crate cocoa;
#[cfg(target_os = "macos")]
extern crate core_foundation;
2015-11-23 04:55:38 +11:00
2015-12-09 04:49:03 +11:00
/// Scale will scale the frame buffer and the window that is being sent in when calling the update
/// function. This is useful if you for example want to display a 320 x 256 window on a screen with
/// much higher resolution which would result in that the window is very small.
#[derive(Clone, Copy)]
2015-12-09 04:49:03 +11:00
pub enum Scale {
/// This mode checks your current screen resolution and will caluclate the largest window size
/// that can be used within that limit and resize it. Useful if you have a small buffer to
/// display on a high resolution screen.
FitScreen,
/// 1X scale (which means leave the corrdinates sent into Window::new untouched)
X1,
/// 2X window scale (Example: 320 x 200 -> 640 x 400)
X2,
/// 4X window scale (Example: 320 x 200 -> 1280 x 800)
X4,
/// 8X window scale (Example: 320 x 200 -> 2560 x 1600)
X8,
/// 16X window scale (Example: 320 x 200 -> 5120 x 3200)
X16,
/// 32 window scale (Example: 320 x 200 -> 10240 x 6400)
X32,
2015-11-24 06:44:21 +11:00
}
2015-11-24 06:21:11 +11:00
2015-12-09 04:49:03 +11:00
/// Vsync will allow syncronized rendering with the screen refresh rate.
/// Currently Vsync isn't implemented so nothing will change regardless of given value right now
pub enum Vsync {
/// No vsync
No,
/// Require accurate vsync. Notice that if the library is unable to to setup an accurate
/// syncing the window creation will fail.
Accurate,
/// Setup a best guess syncing with the screen. This will always succesed but may not be
/// accurate. What this means is if the lib is unable to create a accurate syncing approach
/// a 'emulated' one will be used (for example using a timer to approximate syncing)
BestGuess,
2015-11-23 04:55:38 +11:00
}
2015-12-09 04:49:03 +11:00
pub enum Key {
Key0 = 0,
Key1 = 1,
Key2 = 2,
Key3 = 3,
Key4 = 4,
Key5 = 5,
Key6 = 6,
Key7 = 7,
Key8 = 8,
Key9 = 9,
A = 10,
B = 11,
C = 12,
D = 13,
E = 14,
F = 15,
G = 16,
H = 17,
I = 18,
J = 19,
K = 20,
L = 21,
M = 22,
N = 23,
O = 24,
P = 25,
Q = 26,
R = 27,
S = 28,
T = 29,
U = 30,
V = 31,
W = 32,
X = 33,
Y = 34,
Z = 35,
2015-12-09 04:49:03 +11:00
F1,
F2,
F3,
F4,
F5,
F6,
F7,
F8,
F9,
F10,
F11,
F12,
F13,
F14,
F15,
2015-11-23 04:55:38 +11:00
2015-12-09 04:49:03 +11:00
Down,
Left,
Right,
Up,
Apostrophe,
Backslash,
Comma,
Equal,
LeftBracket,
Minus,
Period,
RightBracket,
Semicolon,
Slash,
Backspace,
Delete,
End,
Enter,
Escape,
Home,
Insert,
Menu,
PageDown,
PageUp,
Pause,
Space,
Tab,
2015-12-17 22:27:46 +11:00
NumLock,
2015-12-09 04:49:03 +11:00
CapsLock,
2015-12-17 22:27:46 +11:00
ScrollLock,
2015-12-16 19:31:14 +11:00
LeftShift,
RightShift,
LeftCtrl,
RightCtrl,
2015-12-09 04:49:03 +11:00
2015-12-17 22:27:46 +11:00
NumPad0,
NumPad1,
NumPad2,
NumPad3,
NumPad4,
NumPad5,
NumPad6,
NumPad7,
NumPad8,
NumPad9,
NumPadDot,
NumPadSlash,
NumPadAsterisk,
NumPadMinus,
NumPadPlus,
NumPadEnter,
Count = 102,
2015-11-23 04:55:38 +11:00
}
2015-11-28 07:25:50 +11:00
2015-12-09 04:49:03 +11:00
#[cfg(target_os = "windows")]
pub mod windows;
#[cfg(target_os = "windows")]
pub use windows::*;
//#[cfg(target_os = "macos")]
//pub mod macos;
//#[cfg(target_os = "macos")]
//pub use macos::*;
2015-12-09 04:49:03 +11:00