Making a centered circle; Why does it do this?

Source Code:

#include “raylib.h”
int main() {
int iResX{500}, iResY{500};
InitWindow(iResX, iResY, “Project Window”);
while (!WindowShouldClose()) {
BeginDrawing();
ClearBackground(WHITE);
DrawCircle(iResX/2, iResY/2, 25, BLUE );
EndDrawing();
}
}

Question:
When I try to watch iResX and iResY, they appear as “not available” under the watch section of VSC. When I change the X and Y values, it properly resizes and centers but it won’t tell me what those stored values are.

The compiler will try to optimize a variable or line of code if it thinks it can do so (and usually, it can). While this typically means that your program will run more efficiently, this can end up making parts of our code unavailable to us when we try to watch a variable or step through code line-by-line.

At this point I wouldn’t worry about it too much.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms