Core: Conditional compound to fix Msvc, better assert but printf based, Fix tests

This commit is contained in:
Krzosa Karol
2023-04-21 07:55:34 +02:00
parent fb3800a43a
commit e6bf6b680e
13 changed files with 71 additions and 59 deletions

View File

@@ -27,12 +27,12 @@ ZeroMemory :: (p: *void, size: SizeU)
// Unicode
//
QuestionMark16 :: 0x003f
String32 :: struct;; str: *U32; len: S64
String16 :: struct;; str: *U16; len: S64
String32 :: struct;; str: *U32; len: int
String16 :: struct;; str: *U16; len: int
Utf8ToUtf32 :: (c: *U8, max_advance: S64): U32, S64
Utf8ToUtf32 :: (c: *U8, max_advance: int): U32, int
out_str: U32
advance: S64
advance: int
if (c[0] & 0b10000000) == 0
if max_advance >= 1
c0 := c[0]->U32
@@ -62,7 +62,7 @@ Utf8ToUtf32 :: (c: *U8, max_advance: S64): U32, S64
return out_str, advance
Utf32ToUtf16 :: (codepoint: U32): [2]U16, S64
Utf32ToUtf16 :: (codepoint: U32): [2]U16, int
str: [2]U16
len := 0
if codepoint < 0x10000

View File

@@ -1,5 +1,5 @@
Vec2I :: struct;; x: S64; y: S64
Vec2I :: struct;; x: int; y: int
Vec2 :: struct;; x: F32; y: F32
"*" :: (a: Vec2, b: Vec2): Vec2 ;; return {a.x*b.x, a.y*b.y}
@@ -16,17 +16,17 @@ Vec2 :: struct;; x: F32; y: F32
"/" :: (a: F32, b: Vec2) : Vec2 ;; return {a/b.x, a/b.y}
"*" :: (a: Vec2I, b: Vec2I): Vec2I ;; return {a.x*b.x, a.y*b.y}
"*" :: (a: Vec2I, b: S64) : Vec2I ;; return {a.x*b, a.y*b}
"*" :: (a: S64, b: Vec2I) : Vec2I ;; return {a*b.x, a*b.y}
"*" :: (a: Vec2I, b: int) : Vec2I ;; return {a.x*b, a.y*b}
"*" :: (a: int, b: Vec2I) : Vec2I ;; return {a*b.x, a*b.y}
"-" :: (a: Vec2I, b: Vec2I): Vec2I ;; return {a.x-b.x, a.y-b.y}
"-" :: (a: Vec2I, b: S64) : Vec2I ;; return {a.x-b, a.y-b}
"-" :: (a: S64, b: Vec2I) : Vec2I ;; return {a-b.x, a-b.y}
"-" :: (a: Vec2I, b: int) : Vec2I ;; return {a.x-b, a.y-b}
"-" :: (a: int, b: Vec2I) : Vec2I ;; return {a-b.x, a-b.y}
"+" :: (a: Vec2I, b: Vec2I): Vec2I ;; return {a.x+b.x, a.y+b.y}
"+" :: (a: Vec2I, b: S64) : Vec2I ;; return {a.x+b, a.y+b}
"+" :: (a: S64, b: Vec2I) : Vec2I ;; return {a+b.x, a+b.y}
"+" :: (a: Vec2I, b: int) : Vec2I ;; return {a.x+b, a.y+b}
"+" :: (a: int, b: Vec2I) : Vec2I ;; return {a+b.x, a+b.y}
"/" :: (a: Vec2I, b: Vec2I): Vec2I ;; return {a.x/b.x, a.y/b.y}
"/" :: (a: Vec2I, b: S64) : Vec2I ;; return {a.x/b, a.y/b}
"/" :: (a: S64, b: Vec2I) : Vec2I ;; return {a/b.x, a/b.y}
"/" :: (a: Vec2I, b: int) : Vec2I ;; return {a.x/b, a.y/b}
"/" :: (a: int, b: Vec2I) : Vec2I ;; return {a/b.x, a/b.y}
FloorVec2ToVec2I :: (a: Vec2): Vec2I ;; return {floorf(a.x)->S64, floorf(a.y)->S64}
CastVec2ToVec2I :: (a: Vec2): Vec2I ;; return {a.x->S64, a.y->S64}
FloorVec2ToVec2I :: (a: Vec2): Vec2I ;; return {floorf(a.x)->int, floorf(a.y)->int}
CastVec2ToVec2I :: (a: Vec2): Vec2I ;; return {a.x->int, a.y->int}

View File

@@ -26,8 +26,8 @@ MU :: struct
os: Platform
MUWindow :: struct
x: S64
y: S64
x: int
y: int
sizef: Vec2
size: Vec2I
resizable: bool
@@ -55,7 +55,7 @@ Mouse :: struct
left: KeyState
right: KeyState
middle: KeyState
wheel: S64
wheel: int
#import "Base.core"
#import "MathF32.core"

View File

@@ -66,8 +66,8 @@ GetWindowSize :: (window: HWND): Vec2I
result: Vec2I
window_rect: RECT
GetClientRect(window, &window_rect)
result.x = (window_rect.right - window_rect.left)->S64
result.y = (window_rect.bottom - window_rect.top)->S64
result.x = (window_rect.right - window_rect.left)->int
result.y = (window_rect.bottom - window_rect.top)->int
return result
GetWindowPos :: (window: HWND): Vec2I
@@ -94,7 +94,7 @@ SetWindowPosition :: (window: HWND, style: DWORD, pos: Vec2I): void
SetWindowPos(window, 0, rect.left, rect.top, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE)
StartMultimedia :: (
x: S64 = 1280, y: S64 = 720,
x: int = 1280, y: int = 720,
title: String = "Hello people!",
window_resizable: bool = false,
target_ms: F64 = 0.0166666