1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 23:27:44 +00:00

Libraries: Change enums to enum classes in LibCards

This commit is contained in:
Lenny Maiorani 2022-03-17 15:01:03 -06:00 committed by Andreas Kling
parent d3893a73fb
commit 56046d3f9b
6 changed files with 43 additions and 43 deletions

View file

@ -90,7 +90,7 @@ void Game::timer_event(Core::TimerEvent&)
void Game::create_new_animation_card()
{
auto card = Card::construct(static_cast<Card::Type>(get_random_uniform(Card::Type::__Count)), get_random_uniform(Card::card_count));
auto card = Card::construct(static_cast<Card::Type>(get_random_uniform(to_underlying(Card::Type::__Count))), get_random_uniform(Card::card_count));
card->set_position({ get_random_uniform(Game::width - Card::width), get_random_uniform(Game::height / 8) });
int x_sgn = card->position().x() > (Game::width / 2) ? -1 : 1;

View file

@ -260,7 +260,7 @@ void Game::mousedown_event(GUI::MouseEvent& event)
update(top_card.rect());
}
} else if (m_focused_cards.is_empty()) {
to_check.add_all_grabbed_cards(click_location, m_focused_cards, Cards::CardStack::Same);
to_check.add_all_grabbed_cards(click_location, m_focused_cards, Cards::CardStack::MovementRule::Same);
m_mouse_down_location = click_location;
if (m_focused_stack)
m_focused_stack->set_focused(false);
@ -310,7 +310,7 @@ void Game::mouseup_event(GUI::MouseEvent& event)
if (stack.is_focused())
continue;
if (stack.is_allowed_to_push(m_focused_cards.at(0), m_focused_cards.size(), Cards::CardStack::Any) && !stack.is_empty()) {
if (stack.is_allowed_to_push(m_focused_cards.at(0), m_focused_cards.size(), Cards::CardStack::MovementRule::Any) && !stack.is_empty()) {
move_focused_cards(stack);
rebound = false;
@ -324,7 +324,7 @@ void Game::mouseup_event(GUI::MouseEvent& event)
for (auto& focused_card : m_focused_cards) {
if (stack.bounding_box().intersects(focused_card.rect())) {
if (stack.is_allowed_to_push(m_focused_cards.at(0), m_focused_cards.size(), Cards::CardStack::Any)) {
if (stack.is_allowed_to_push(m_focused_cards.at(0), m_focused_cards.size(), Cards::CardStack::MovementRule::Any)) {
move_focused_cards(stack);
rebound = false;