This commit is contained in:
agra
2026-02-22 17:24:04 +02:00
parent 775dcb44cc
commit d3e574eae5
38 changed files with 16135 additions and 33 deletions

View File

@@ -194,7 +194,7 @@ main :: () {
glBindVertexArray(vao);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, 1152, xx vertices, GL_STATIC_DRAW);
glBufferData(GL_ARRAY_BUFFER, 1152, @vertices, GL_STATIC_DRAW);
// Position attribute (location 0): 3 floats, stride 32 bytes, offset 0
glVertexAttribPointer(0, 3, GL_FLOAT, 0, 32, xx 0);

14
examples/33-c-import.sx Normal file
View File

@@ -0,0 +1,14 @@
#import "modules/std.sx";
#import c {
#include "vendors/test_c/test.h";
#source "vendors/test_c/test.c";
};
main :: () -> s32 {
a := add_numbers(10, 20);
b := multiply(5, 6);
print("add_numbers(10, 20) = {}\n", a);
print("multiply(5, 6) = {}\n", b);
0;
}

16
examples/33-stb-image.sx Normal file
View File

@@ -0,0 +1,16 @@
#import "modules/std.sx";
stb :: #import "modules/stb.sx";
main :: () -> s32 {
w: s32 = 0;
h: s32 = 0;
ch: s32 = 0;
img := stb.stbi_load("test.png", @w, @h, @ch, 4);
if xx img != 0 {
print("loaded {}x{} ({} channels)\n", w, h, ch);
stb.stbi_image_free(xx img);
} else {
print("no image (expected in test)\n");
}
0;
}

View File

@@ -0,0 +1,10 @@
#import "modules/std.sx";
tc :: #import "modules/test_c.sx";
main :: () -> s32 {
a := tc.add_numbers(10, 20);
b := tc.multiply(5, 6);
print("tc.add_numbers(10, 20) = {}\n", a);
print("tc.multiply(5, 6) = {}\n", b);
0;
}

4
examples/modules/stb.sx Normal file
View File

@@ -0,0 +1,4 @@
#import c {
#include "vendors/stb_image/stb_image.h";
#source "vendors/stb_image/stb_image_impl.c";
};

View File

@@ -0,0 +1,4 @@
#import c {
#include "vendors/test_c/test.h";
#source "vendors/test_c/test.c";
};