Skip to content

Implement SetConsoleCursorPosition #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/console.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ impl ScreenBuffer {
if res == 0 { return last_error() }
Ok(())
}
pub fn set_cursor_position(&self, pos: (i16, i16)) -> Result<()> {
let pos = w::COORD { X: pos.0, Y: pos.1 };
let res = unsafe { k32::SetConsoleCursorPosition(*self.0, pos) };
if res == 0 { return last_error() }
Ok(())
}
pub fn font_size(&self) -> Result<(i16, i16)> {
unsafe {
let mut font = zeroed();
Expand Down