Add windowsSize attribute

This commit is contained in:
manzerbredes 2015-05-03 17:34:47 +02:00
parent fb7fb90b85
commit 1bf3038477
2 changed files with 5 additions and 2 deletions

View file

@ -13,6 +13,8 @@ MainWindow::MainWindow(int width, int height, std::string title):
m_spaceBetweenCell(10)
{
m_windowSize=RenderWindow::getSize();
//Define original skin:
m_skin.push_back(sf::Color(250,248,239)); //Background MainWindow
m_skin.push_back(sf::Color(205,192,180)); //Background cells
@ -53,8 +55,8 @@ void MainWindow::clearBG(){
void MainWindow::drawCells(){
int centerOffset=(800-(3*m_spaceBetweenCell+4*m_sizeCell))/2;
int distanceBetweenTopAndGrid=200;
int centerOffset=(m_windowSize.x-(3*m_spaceBetweenCell+4*m_sizeCell))/2;
int distanceBetweenTopAndGrid=180;
int bgsize=3*m_spaceBetweenCell + 4*m_sizeCell + 2*m_spaceBetweenCell;
sf::RectangleShape gridBG(sf::Vector2f(bgsize, bgsize));
gridBG.setFillColor(m_skin.at(2));

View file

@ -14,6 +14,7 @@ class MainWindow : public sf::RenderWindow{
int m_windowMargin;
int m_sizeCell;
int m_spaceBetweenCell;
sf::Vector2u m_windowSize;
public:
MainWindow(int width, int height, std::string title);
~MainWindow();