Add windowsSize attribute
This commit is contained in:
parent
fb7fb90b85
commit
1bf3038477
2 changed files with 5 additions and 2 deletions
|
@ -13,6 +13,8 @@ MainWindow::MainWindow(int width, int height, std::string title):
|
||||||
m_spaceBetweenCell(10)
|
m_spaceBetweenCell(10)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
m_windowSize=RenderWindow::getSize();
|
||||||
|
|
||||||
//Define original skin:
|
//Define original skin:
|
||||||
m_skin.push_back(sf::Color(250,248,239)); //Background MainWindow
|
m_skin.push_back(sf::Color(250,248,239)); //Background MainWindow
|
||||||
m_skin.push_back(sf::Color(205,192,180)); //Background cells
|
m_skin.push_back(sf::Color(205,192,180)); //Background cells
|
||||||
|
@ -53,8 +55,8 @@ void MainWindow::clearBG(){
|
||||||
|
|
||||||
void MainWindow::drawCells(){
|
void MainWindow::drawCells(){
|
||||||
|
|
||||||
int centerOffset=(800-(3*m_spaceBetweenCell+4*m_sizeCell))/2;
|
int centerOffset=(m_windowSize.x-(3*m_spaceBetweenCell+4*m_sizeCell))/2;
|
||||||
int distanceBetweenTopAndGrid=200;
|
int distanceBetweenTopAndGrid=180;
|
||||||
int bgsize=3*m_spaceBetweenCell + 4*m_sizeCell + 2*m_spaceBetweenCell;
|
int bgsize=3*m_spaceBetweenCell + 4*m_sizeCell + 2*m_spaceBetweenCell;
|
||||||
sf::RectangleShape gridBG(sf::Vector2f(bgsize, bgsize));
|
sf::RectangleShape gridBG(sf::Vector2f(bgsize, bgsize));
|
||||||
gridBG.setFillColor(m_skin.at(2));
|
gridBG.setFillColor(m_skin.at(2));
|
||||||
|
|
|
@ -14,6 +14,7 @@ class MainWindow : public sf::RenderWindow{
|
||||||
int m_windowMargin;
|
int m_windowMargin;
|
||||||
int m_sizeCell;
|
int m_sizeCell;
|
||||||
int m_spaceBetweenCell;
|
int m_spaceBetweenCell;
|
||||||
|
sf::Vector2u m_windowSize;
|
||||||
public:
|
public:
|
||||||
MainWindow(int width, int height, std::string title);
|
MainWindow(int width, int height, std::string title);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
Loading…
Add table
Reference in a new issue