orangeduck / Corange

Pure C Game Engine
http://www.youtube.com/watch?v=482GxqTWXtA
Other
1.78k stars 199 forks source link

Make macOS specific components buildable #44

Closed jdek closed 5 years ago

jdek commented 5 years ago

The -framework OpenGL should be preferred to -lGL on macOS right now.

Linux should also be able to make use of libunwind through LLVM's libunwind (distros should package it), but that means extra dependencies so just leave the libunwind based backtrace function to macOS only (libunwind is linked automatically).

The src/assets/config.c change is really dirty, but I'm not sure how to feel about the use of nested functions in the first place. They're just not supported on any other compiler other than gcc.

orangeduck commented 5 years ago

Thanks - what exactly is the config change for? I do remember using nested functions in previous versions of Corange but I thought I removed them all.

jdek commented 5 years ago

@orangeduck it's just to remove the void write_entry(void* x) nested function. It could probably be solved with a dict_iterate() function (not sure if you have something like that) where items can just be iterated in a loop.

I'm not really happy with how I 'fixed' it (but I assume it should work at least), so alternative suggestions are welcome.

orangeduck commented 5 years ago

Right I see. It is probably fine for now, but I should probably have let the interface of dict_map allow you to pass an additional argument to the callback for this kind of purpose - then you could have passed a pointer to a struct with the details about the file and config.