Skip to content

Conversation

Angluca
Copy link

@Angluca Angluca commented Oct 12, 2025

Using vectors(Vec3/4) and matrices(Mat4) to calculate the physical direction and dynamics can be of great help to writing games and microcontrollers

@Angluca Angluca force-pushed the master branch 2 times, most recently from 4bdf1eb to 95d23d1 Compare October 12, 2025 17:13
@bvdberg
Copy link
Member

bvdberg commented Oct 13, 2025

It looks like a nice float vector library to use if you have use for that. 2 remarks:

  • math is the c2 port of libc math, so this file would belong to it's own library that depends on math
  • The example use function should not be in the .c2i file, unless as comments

Since we have recently started with adding libraries, we will have to think of generic way of adding more, since putting them all in the same archive is not maintainable. One thing that would be ok is to extend the C2_LIBDIR environment variable to support lists like $PATH. That way users can just add their own libraries seperately. In addition we could extract the current 'extra' libs like SDL, mbedtls and put them in a separate c2-extra-libs archive. The current libdir in c2c would then only include the 'core' libs that c2c itself needs (libc/math/pthreads).

Ideally there can also be a higher level tool that fetches libs based on some config file. Like the rust crate system.

@chqrlie
Copy link
Contributor

chqrlie commented Oct 13, 2025

It looks like a nice float vector library to use if you have use for that. 2 remarks:

  • math is the c2 port of libc math, so this file would belong to it's own library that depends on math

This library would be more efficient as a source library. We need a simple way to support this concept

  • The example use function should not be in the .c2i file, unless as comments

Or possibly in an #ifdef TESTING block...

Since we have recently started with adding libraries, we will have to think of generic way of adding more, since putting them all in the same archive is not maintainable. One thing that would be ok is to extend the C2_LIBDIR environment variable to support lists like $PATH. That way users can just add their own libraries seperately. In addition we could extract the current 'extra' libs like SDL, mbedtls and put them in a separate c2-extra-libs archive. The current libdir in c2c would then only include the 'core' libs that c2c itself needs (libc/math/pthreads).

I would favor both removing C2_LIBDIR and make it automatic, and adding C2_LIBPATH with the above semantics.

Ideally there can also be a higher level tool that fetches libs based on some config file. Like the rust crate system.

Yes, it seems a good approach to get more traction on the language too.

@Angluca
Copy link
Author

Angluca commented Oct 14, 2025

Look forward to it

I don't know use c2 struct constructs, Haven't example, haven't self pointer and only run once when more this var, Maybe this attribute is not what I thought, I thought it was cpp.class.construction

fn void MyData.init() @(constructor) {
    printf("MyData.init() ---\n");
}
fn void MyData.deinit() @(destructor) {
    printf("MyData.deinit() ---\n");
}

@Angluca Angluca closed this Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants