Squiggly lines but code runs(C++ Fundamentals: Game Programming For Beginners)

When I declare(as per the current tutorial)
Rectangle nebRect{0.0, 0.0, nebula.width/8, nebula.height/8};

I get little squiggly lines under the two separators after the width and height. The code builds and runs but the compiler shows this warning.

narrowing conversion of '(nebula.Texture::width / 8)' from 'int' to 'float' [-Wnarrowing]

But when I add them separately(as per an older tutorial) like this:

nebRect.width = nebula.width/8;
    nebRect.height = nebula.height/8;
    nebRect.x = nebRect.y = 0;

there are no errors. Can someone explain how to get rid of this?

I asked this question in Code Project and got an answer in less than an hour. Here is the link to the answer.
link to code

1 Like

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

Privacy & Terms