-
Notifications
You must be signed in to change notification settings - Fork 94
Description
At least on my setup (x86_64-linux) the main loop is never entered.
After some inspection, I believe this is because WindowShouldClose()
returns a bool, which has a size of 1 byte on my system, but the temporary variable holding the result of the call is 8 bytes (I think), and so it may contain garbage in the upper 7 bytes that will mess with the while condition.
...
InitWindow(800, 600, "Hello, from B");
SetTargetFPS(60);
while (!WindowShouldClose()) { // <-- here
if (IsKeyPressed(32)) {
paused = !paused;
}
...
After discovering that your compiler supports bits operations, I tested this hypothesis with this change:
InitWindow(800, 600, "Hello, from B");
SetTargetFPS(60);
- while (!WindowShouldClose()) {
+ while (!(WindowShouldClose() & 1)) {
if (IsKeyPressed(32)) {
paused = !paused;
}
And it worked as intended.
I feel that making extrn
function declarations aware of the full function signature (with args and return types) is not aligned with the spirit of the project, and so manually handling non word sized external values seems the way to go. I can make a PR if necessary.
Very cool project by the way. The compiler's hack / test / debug cycle is top notch. And the btest
output is crazy good.