Skip to content

Commit

Permalink
Use :: for global calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
przemek83 committed Sep 13, 2024
1 parent 4d91688 commit 94541db
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/Screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void Screen::init()
if (!al_init())
{
std::cerr << "failed to initialize allegro!\n";
abort();
::abort();
}

const int screenWidth{
Expand All @@ -35,24 +35,24 @@ void Screen::init()
if (::al_create_display(screenWidth, screenHeight) == nullptr)
{
std::cerr << "failed to create display!\n";
abort();
::abort();
}

::al_clear_to_color(al_map_rgb(0, 0, 0));
::al_clear_to_color(::al_map_rgb(0, 0, 0));
::al_flip_display();

::al_init_image_addon();
::al_init_font_addon();
::al_init_primitives_addon();

::al_set_window_title(al_get_current_display(), "TankBle");
::al_set_window_title(::al_get_current_display(), "TankBle");
}

void Screen::drawText(unsigned int x, unsigned y, const std::string& text) const
{
const ALLEGRO_COLOR white{al_map_rgb(255, 255, 255)};
al_draw_text(font_, white, static_cast<float>(x), static_cast<float>(y),
ALLEGRO_ALIGN_CENTER, text.c_str());
const ALLEGRO_COLOR white{::al_map_rgb(255, 255, 255)};
::al_draw_text(font_, white, static_cast<float>(x), static_cast<float>(y),
ALLEGRO_ALIGN_CENTER, text.c_str());
}

void Screen::drawTextWithBackground(unsigned int x, unsigned int y,
Expand Down Expand Up @@ -131,9 +131,9 @@ void Screen::clearScreenWithBlack()
void Screen::updateSize()
{
width_ = static_cast<unsigned int>(
::al_get_display_width(al_get_current_display()));
::al_get_display_width(::al_get_current_display()));
height_ = static_cast<unsigned int>(
::al_get_display_height(al_get_current_display()));
::al_get_display_height(::al_get_current_display()));

Config::getInstance().screenSizeChanged(getWidth(), getHeight());
}
Expand All @@ -160,13 +160,13 @@ unsigned int Screen::getBitmapHeight(ResourceType resourceType) const

void Screen::refresh() { ::al_flip_display(); }

void Screen::showMouse() { ::al_show_mouse_cursor(al_get_current_display()); }
void Screen::showMouse() { ::al_show_mouse_cursor(::al_get_current_display()); }

void Screen::hideMouse() { ::al_hide_mouse_cursor(al_get_current_display()); }
void Screen::hideMouse() { ::al_hide_mouse_cursor(::al_get_current_display()); }

void Screen::useFullScreenMode()
{
::al_set_display_flag(al_get_current_display(), ALLEGRO_FULLSCREEN_WINDOW,
::al_set_display_flag(::al_get_current_display(), ALLEGRO_FULLSCREEN_WINDOW,
true);
updateSize();
}
Expand Down

0 comments on commit 94541db

Please sign in to comment.