2015-05-03 14:19:30 +02:00
|
|
|
#include "MainWindow.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MainWindow::MainWindow(int width, int height, std::string title):
|
2015-05-03 15:12:46 +02:00
|
|
|
RenderWindow(sf::VideoMode(width,height), title,sf::Style::Titlebar | sf::Style::Close),
|
|
|
|
m_skin(),
|
|
|
|
m_windowMargin(10),
|
|
|
|
m_sizeCell(120),
|
|
|
|
m_spaceBetweenCell(10)
|
2015-05-03 14:19:30 +02:00
|
|
|
{
|
2015-05-03 15:12:46 +02:00
|
|
|
|
2015-05-03 14:19:30 +02:00
|
|
|
//Define skin:
|
2015-05-03 15:12:46 +02:00
|
|
|
m_skin.push_back(sf::Color(250,248,239)); //Background MainWindow
|
|
|
|
m_skin.push_back(sf::Color(205,192,180)); //Background cells
|
2015-05-03 14:19:30 +02:00
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MainWindow::~MainWindow(){
|
|
|
|
}
|
|
|
|
|
2015-05-03 15:12:46 +02:00
|
|
|
void MainWindow::clearBG(){
|
|
|
|
RenderWindow::clear(m_skin.at(0));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::drawCells(){
|
|
|
|
|
|
|
|
for(int i=0;i<4;i++){
|
|
|
|
|
|
|
|
for(int j=0;j<4;j++){
|
|
|
|
sf::RectangleShape cell(sf::Vector2f(m_sizeCell, m_sizeCell));
|
|
|
|
cell.setFillColor(m_skin.at(1));
|
|
|
|
int centerOffset=(800-(3*m_spaceBetweenCell+4*m_sizeCell))/2;
|
|
|
|
int distanceBetweenTopAndGrid=200;
|
|
|
|
cell.setPosition(centerOffset+j*(m_sizeCell+m_spaceBetweenCell),distanceBetweenTopAndGrid+i*(m_sizeCell+m_spaceBetweenCell));
|
|
|
|
RenderWindow::draw(cell);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2015-05-03 14:19:30 +02:00
|
|
|
}
|