Jakt toolchain for TempleOS development
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
unholy-jakt/window.jakt

38 lines
1.3 KiB

import dc { DC }
import extern c "window.h" {
extern function window_create() -> usize
extern function window_dc_alias(anon task: usize) -> usize
extern function window_destroy(anon task: usize)
extern function window_is_focused(anon task: usize) -> bool
extern function window_set_context(anon task: usize, dc: usize)
extern function window_set_coordinates(anon task: usize, top: i64, left: i64, bottom: i64, right: i64)
extern function window_set_title(anon task: usize, title: raw c_char)
}
class Window {
public function create_new() throws -> Window {
mut window = Window(task: 0)
window.task = window_create()
return window
}
public function dc_alias(this) -> usize {
return window_dc_alias(.task)
}
public function destroy(this) {
window_destroy(.task)
}
public function is_focused(this) -> bool {
return window_is_focused(.task)
}
public function set_context(this, anon dc: DC) {
window_set_context(.task, dc: dc.context)
}
public function set_coordinates(this, top: i64, left: i64, bottom: i64, right: i64) {
window_set_coordinates(.task, top, left, bottom, right)
}
public function set_title(this, anon title: String) {
window_set_title(.task, title: title.c_string())
}
task: usize
}