Core: match sizeof etc. syntax with C, Core RTS: Beautifying + animations

This commit is contained in:
Krzosa Karol
2023-04-19 12:50:58 +02:00
parent 891221441e
commit 87657a99a6
20 changed files with 131 additions and 56 deletions

View File

@@ -29,7 +29,7 @@ WinMain :: (hInstance: HINSTANCE, hPrevInstance: HINSTANCE, lpCmdLine: LPSTR, nS
ShowWindow(window, nShowCmd)
window_dc := GetDC(window)
header_size: U32 = SizeOf(BITMAPINFOHEADER)
header_size: U32 = sizeof(BITMAPINFOHEADER)
Assert(header_size == 40)
bminfo := BITMAPINFO{
BITMAPINFOHEADER{

View File

@@ -64,12 +64,12 @@ main :: (): int
b = 2,
}
size0 := SizeOf(Data)
size1 := SizeOf(data1)
align0 := AlignOf(Data)
align1 := AlignOf(data1)
type0 := TypeOf(Data)
type1 := TypeOf(data1)
size0 := sizeof(Data)
size1 := sizeof(data1)
align0 := alignof(Data)
align1 := alignof(data1)
type0 := typeof(Data)
type1 := typeof(data1)
Assert(s64val == 0 && s32val == 0 && s16val == 0 && s8val == 0 && intval == 0 && u64val == 0 && u32val == 0 && u16val == 0 && u8val == 0 && f64val == 0 && f32val == 0)
Assert(string_val[0] == 'S')
@@ -92,7 +92,7 @@ main :: (): int
Assert(size0 == size1)
Assert(align0 == align1)
Assert(type0 == type1)
Assert(TypeOf(data2) == Data)
Assert(typeof(data2) == Data)
return 0

View File

@@ -61,7 +61,7 @@ C :: #import "LibC.core"
Add :: (arr: *Array($T), val: T)
if arr.cap == 0
arr.cap = 16
arr.data = C.malloc(SizeOf(T)->U64 * arr.cap->U64)
arr.data = C.malloc(sizeof(T)->U64 * arr.cap->U64)
arr.data[arr.len++] = val
main :: (argc: int, argv: **char): int

View File

@@ -1,7 +1,7 @@
MA :: #import "Arena.core"
PushStruct :: (a: *MA.Arena, $K: Type, $T: Type): *T
size := SizeOf(T)
size := sizeof(T)
result := MA.PushSize(a, size->U64)
return result->*T
@@ -9,7 +9,7 @@ main :: (argc: int, argv: **char): int
arena: MA.Arena
a: *int = PushStruct(&arena, int, int)
b: *F32 = PushStruct(&arena, int, F32)
padding := SizeOf(int)
Assert(arena.len->S64 == (SizeOf(int) + SizeOf(F32) + padding))
padding := sizeof(int)
Assert(arena.len->S64 == (sizeof(int) + sizeof(F32) + padding))
return 0

View File

@@ -189,7 +189,7 @@ CreateBitmap :: (size: V2.Vec2I, bottom_up: bool = true): Windows_Bitmap
if bottom_up == false
result.size.y = -result.size.y
header_size: U32 = SizeOf(BITMAPINFOHEADER)
header_size: U32 = sizeof(BITMAPINFOHEADER)
Assert(header_size == 40)
bminfo := BITMAPINFO{
BITMAPINFOHEADER{

View File

@@ -14,10 +14,10 @@ main :: (): int
return 1
if type_info.type == S64
// We can use SizeOf and AlignOf operators
// We can use sizeof and alignof operators
// to figure out the type alignment and it's size
Assert(type_info.size == SizeOf(S64))
Assert(type_info.align == AlignOf(S64))
Assert(type_info.size == sizeof(S64))
Assert(type_info.align == alignof(S64))
else;; Assert(false, "We expected S64 here! What a boomer!")

View File

@@ -18,7 +18,7 @@ main :: (argc: int, argv: **char): int
t := U
ti := GetTypeInfo(t)
Assert(ti.size == SizeOf(U))
Assert(ti.size == sizeof(U))
for ti.struct_members
Assert(it.offset == 0)