##Bug
Bug
##Bug
Bug
Block grid[GRID_WIDTH][GRID_HEIGHT];
Use standard library containers. Prefer std::array
when you know the size at compile time to C style arrays. Standard containers are better for several reasons:
- Iterator support
algorithm
support- Access violation exception support
srand(static_cast<unsigned int>(time(0)));
youYou define and initialize these to false only to make them true before they can be used properly. Just initialize them to true to begin with. Also prefer brace initialization is more idiomatic.
Don't declare multiple variable on single lines. preferUse 1:1 lines to variables. Especially when some are assigned and some are not. This can get confusing to read. is frame_time
assigned 0? I know the answer but its not obvious just by looking at it.
Block grid[GRID_WIDTH][GRID_HEIGHT];
Use standard library containers. Prefer std::array
when you know the size at compile time to C style arrays. Standard containers are better for several reasons:
- Iterator support
algorithm
support- Access violation exception support
srand(static_cast<unsigned int>(time(0)));
you define and initialize these to false only to make them true before they can be used properly. Just initialize them to true to begin with. Also prefer brace initialization.
Don't declare multiple variable on single lines. prefer 1:1 lines to variables. Especially when some are assigned and some are not. This can get confusing to read. is frame_time
assigned 0? I know the answer but its not obvious just by looking at it.
srand(static_cast<unsigned int>(time(0)));
You define and initialize these to false only to make them true before they can be used properly. Just initialize them to true to begin with. Also brace initialization is more idiomatic.
Don't declare multiple variable on single lines. Use 1:1 lines to variables. Especially when some are assigned and some are not. This can get confusing to read. is frame_time
assigned 0? I know the answer but its not obvious just by looking at it.
Game().Run()
calls the Game
constructor and creates a second instance of Game
and thethen calls Run()
on that instance. Your postgame stats likely aren't working correctly. No?
struct Position
{
float x;
float y;
};
struct BlockPoint
{
int x;
int y;
};
BlockPoint PositionToBlockPositionToPoint(Position const& position)
{
BlockPoint blockpoint{ static_cast<int>(position.x), static_cast<int>(position.y) };
return block;point;
}
Position pos{ grid_width / 2, grid_height / 2 };
Game().Run()
calls the Game
constructor and creates a second instance of Game
and the calls Run()
on that instance. Your postgame stats likely aren't working correctly. No?
struct Position
{
float x;
float y;
};
struct Block
{
int x;
int y;
};
Block PositionToBlock(Position const& position)
{
Block block{ static_cast<int>(position.x), static_cast<int>(position.y) };
return block;
}
Position pos{ grid_width / 2, grid_height / 2 };
Game().Run()
calls the Game
constructor and creates a second instance of Game
and then calls Run()
on that instance. Your postgame stats likely aren't working correctly. No?
struct Position
{
float x;
float y;
};
struct Point
{
int x;
int y;
};
Point PositionToPoint(Position const& position)
{
Point point{ static_cast<int>(position.x), static_cast<int>(position.y) };
return point;
}
Position pos{ grid_width / 2, grid_height / 2 };
- 2.4k
- 2
- 16
- 31