Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The (one) ball starts at the top-center of the screen #25

Open
1 task done
richelbilderbeek opened this issue Oct 26, 2023 · 2 comments
Open
1 task done

The (one) ball starts at the top-center of the screen #25

richelbilderbeek opened this issue Oct 26, 2023 · 2 comments
Labels
depends Depends on another Issue

Comments

@richelbilderbeek
Copy link
Member

richelbilderbeek commented Oct 26, 2023

Depends on:

The (one) ball starts at the top-center of the screen

richelbilderbeek pushed a commit that referenced this issue Oct 26, 2023
@richelbilderbeek
Copy link
Member Author

Test pseudocode:

// Create a game
// Get the ball position
// Get the (intended) screen width
// The ball center position must be at coordinat (width / 2, 0)

@richelbilderbeek
Copy link
Member Author

True test code:

const game g;
const auto screen_size{get_screen_size(g)};
const auto ball_coordinat{get_ball_center_coordinat(g)};
const auto screen_width{get_width(screen_size)};
const auto half_screen_width{screen_width / 2.0};
const auto ball_center_x{get_x(ball_coordinat)};
const auto ball_center_y{get_y(ball_coordinat)};

// Don't: never compare floating point values
// assert(ball_center_x == half_screen_width);
// assert(ball_center_y == 0.0);
// Do: add some room for rounding errors
assert(is_more_or_less_equal(ball_center_x, half_screen_width));
assert(is_more_or_less_equal(ball_center_y, 0.0));

richelbilderbeek pushed a commit that referenced this issue Oct 26, 2023
@richelbilderbeek richelbilderbeek added the depends Depends on another Issue label Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
depends Depends on another Issue
Projects
None yet
Development

No branches or pull requests

1 participant