summaryrefslogtreecommitdiff
path: root/source/presentation/ScreenPanel.cpp
blob: db2db694d2908e9bf0145885fd65deb6e63da40b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "ScreenPanel.h"

const ALLEGRO_COLOR ScreenPanel::BLANK = al_map_rgb(0,0,0);

ScreenPanel::ScreenPanel(ALLEGRO_BITMAP* back, ALLEGRO_BITMAP* front, int x, int y, int width, int height)
    :_width(width),
    _height(height)
{
    _back = al_create_sub_bitmap(back, x, y, _width, _height);
    _front = al_create_sub_bitmap(front, x, y, _width, _height);
}

ScreenPanel::~ScreenPanel()
{
    al_destroy_bitmap(_back);
    al_destroy_bitmap(_front);
}

void ScreenPanel::flip()
{
    ALLEGRO_BITMAP* temp = _back;
    _back = _front;
    _front = temp;
}