清理了 t.CVoid

This commit is contained in:
TermiNexus committed 2026-09-16 16:07:04 +08:00
1 parent 6a54373c26
commit 2a54e2bafb
19 files changed
+199 -200

No files matched your search

+2 -2
View File
@@ -1,12 +1,12 @@
import vpsdk.syscall as syscall
import t, c
def log_info(msg: t.CConst | t.CChar | t.CPtr) -> t.CVoid | t.CExport:
export def log_info(msg: t.CConst | str):
syscall._syscall1(uint64(syscall.SERIAL_PUTS), uint64("[SerialLogger] "))
syscall._syscall1(uint64(syscall.SERIAL_PUTS), uint64(msg))
syscall._syscall1(uint64(syscall.SERIAL_PUTS), uint64("\n"))
def log_warn(msg: t.CConst | t.CChar | t.CPtr) -> t.CVoid | t.CExport:
export def log_warn(msg: t.CConst | str):
syscall._syscall1(uint64(syscall.SERIAL_PUTS), uint64("[SerialLogger:WARN] "))
syscall._syscall1(uint64(syscall.SERIAL_PUTS), uint64(msg))
syscall._syscall1(uint64(syscall.SERIAL_PUTS), uint64("\n"))
+7 -7
View File
@@ -7,16 +7,16 @@ def color_rgb(r: uint8, g: uint8, b: uint8) -> uint32:
return uint32(r) | (uint32(g) << 8) | (uint32(b) << 16)
def get_winbuf(win_id: int) -> UINT32PTR:
return t.CVoid(syscall._syscall2(uint64(syscall.GET_WINBUF), uint64(win_id), 0), t.CPtr)
return syscall._syscall2(uint64(syscall.GET_WINBUF), uint64(win_id), 0)
def win_flush(win_id: int) -> t.CVoid:
def win_flush(win_id: int):
syscall._syscall2(uint64(syscall.WIN_FLUSH), uint64(win_id), 0)
def draw_pixel(buf: UINT32PTR, bw: int, x: int, y: int, color: uint32) -> t.CVoid | t.CExport:
export def draw_pixel(buf: UINT32PTR, bw: int, x: int, y: int, color: uint32):
if x < 0 or y < 0: return
buf[y * bw + x] = color
def draw_line(buf: UINT32PTR, bw: int, x0: int, y0: int, x1: int, y1: int, color: uint32) -> t.CVoid | t.CExport:
export def draw_line(buf: UINT32PTR, bw: int, x0: int, y0: int, x1: int, y1: int, color: uint32):
dx: int = x1 - x0
dy: int = y1 - y0
sx: int = 1
@@ -41,13 +41,13 @@ def draw_line(buf: UINT32PTR, bw: int, x0: int, y0: int, x1: int, y1: int, color
err += dx
y0 += sy
def draw_rect(buf: UINT32PTR, bw: int, rx: int, ry: int, rw: int, rh: int, color: uint32) -> t.CVoid | t.CExport:
export def draw_rect(buf: UINT32PTR, bw: int, rx: int, ry: int, rw: int, rh: int, color: uint32):
draw_line(buf, bw, rx, ry, rx + rw - 1, ry, color)
draw_line(buf, bw, rx + rw - 1, ry, rx + rw - 1, ry + rh - 1, color)
draw_line(buf, bw, rx + rw - 1, ry + rh - 1, rx, ry + rh - 1, color)
draw_line(buf, bw, rx, ry + rh - 1, rx, ry, color)
def fill_rect(buf: UINT32PTR, bw: int, rx: int, ry: int, rw: int, rh: int, color: uint32) -> t.CVoid | t.CExport:
export def fill_rect(buf: UINT32PTR, bw: int, rx: int, ry: int, rw: int, rh: int, color: uint32):
if rx < 0: rw += rx; rx = 0
if ry < 0: rh += ry; ry = 0
if rw <= 0 or rh <= 0: return
@@ -59,7 +59,7 @@ def fill_rect(buf: UINT32PTR, bw: int, rx: int, ry: int, rw: int, rh: int, color
px += 1
py += 1
def draw_circle(buf: UINT32PTR, bw: int, cx: int, cy: int, r: int, color: uint32) -> t.CVoid | t.CExport:
export def draw_circle(buf: UINT32PTR, bw: int, cx: int, cy: int, r: int, color: uint32):
x: int = r
y: int = 0
d: int = 1 - r