Expand description
Rust high level bindings to dos-like
,
the library/framework for writing applications that look
like MS-DOS programs from the 1990’s.
This API was designed to expose the original C API
while maintaining Rust’s idiomatic naming and safety guarantees.
Note however, that some functions in the framework
cannot be made completely memory safe
without introducing runtime overhead.
In any case, should you find it useful,
the low level unsafe bindings are available in dos_like_sys
.
§Using
This crate does not function as a regular library,
because it already defines a main
function by itself.
Attempting to create your own executable with its own main
function
will result in a linker error.
For the building process to work,
the main source file needs the no_main
attribute
and to define an extern C function dosmain
instead.
#![no_main]
#[no_mangle]
pub extern "C" fn dosmain() -> i32 {
// your code here
0
}
A utility macro is available as an alternative to declaring the function:
#![no_main]
dos_like::dos_main! {
// your code here
}
Moreover, since the initiator is based on routines in C, this also means that panic unwinding will not work, so it is best to configure your project to abort on panic. Add this to your Cargo.toml and any other custom profile:
[profile.dev]
panic = "abort"
[profile.release]
panic = "abort"
§Cargo features
disable-screen-frame
: when enabled, compilesdos-like
so that the CRT screen frame around the viewport does not appear. The other CRT screen effects will remain.
Re-exports§
pub use dos_like_sys;
pub use input::*;
pub use music::*;
pub use sound::*;
pub use video::*;
Modules§
- input
- Module for keyboard and mouse input functions.
- music
- Module for music related functions and constructs.
- sound
- Module for sound related functions and constructs.
- video
- Module for video related operations, including graphics and text output.
Macros§
- dos_
main - Declares and defines the main application function.
Enums§
- File
Error - General error type for file loading functions which can fail
Functions§
- shutting_
down - Checks whether the application should shut down.
- wait_
vbl - Calls
waitvbl
, which waits for a vertical blanking signal.