68 lines
1.5 KiB
Rust
68 lines
1.5 KiB
Rust
#![no_std]
|
|
|
|
use cursor::{Cursor, CursorStates};
|
|
|
|
#[macro_use]
|
|
extern crate alloc;
|
|
|
|
pub mod color;
|
|
pub mod cursor;
|
|
pub mod engine3d;
|
|
pub mod ptmode;
|
|
pub mod raw_pixel;
|
|
|
|
pub const VERSION: versioning::Version = versioning::Version {
|
|
major: 0,
|
|
minor: 1,
|
|
patch: 2,
|
|
};
|
|
|
|
#[derive(Clone, Copy, Debug)]
|
|
pub enum GraphicsMode {
|
|
// A simple single or double buffer
|
|
RawPixels,
|
|
// The 3D engine will be the ableOS equivelent of OpenGL or Vulkan
|
|
Engine3D,
|
|
// The PTMode is a simple tile graphics mode similar to the Nintendo Entertainment System or Super Nintendo Entertainment System
|
|
// as well as providing a freeform 'Limitless' (within reason) mode
|
|
PTMode,
|
|
}
|
|
|
|
pub struct GraphicsSettings {
|
|
mode: GraphicsMode,
|
|
cursor: Cursor,
|
|
}
|
|
|
|
impl GraphicsSettings {
|
|
/// Create a new instance of graphics settings to be used by the window state
|
|
fn new() -> Self {
|
|
Self {
|
|
mode: GraphicsMode::RawPixels,
|
|
cursor: Cursor {
|
|
cursor_state: CursorStates::Default,
|
|
},
|
|
}
|
|
}
|
|
pub fn get_mode(&self) -> GraphicsMode {
|
|
self.mode
|
|
}
|
|
|
|
pub fn set_cursor_state(&mut self, c_state: CursorStates) {
|
|
self.cursor.cursor_state = c_state;
|
|
}
|
|
}
|
|
|
|
pub struct Window {
|
|
x: i64,
|
|
y: i64,
|
|
graphics_settings: GraphicsSettings,
|
|
}
|
|
// Make a new window by calling the windowing manager
|
|
pub fn create_window(x: i64, y: i64) -> Window {
|
|
return Window {
|
|
x,
|
|
y,
|
|
graphics_settings: GraphicsSettings::new(),
|
|
};
|
|
}
|