Quickly draw basic grid (no reliable code)
This commit is contained in:
parent
ce3f721e16
commit
7f0edabb5d
3 changed files with 35 additions and 9 deletions
|
@ -6,12 +6,16 @@
|
|||
|
||||
|
||||
MainWindow::MainWindow(int width, int height, std::string title):
|
||||
RenderWindow(sf::VideoMode(width,height), title),
|
||||
skin()
|
||||
RenderWindow(sf::VideoMode(width,height), title,sf::Style::Titlebar | sf::Style::Close),
|
||||
m_skin(),
|
||||
m_windowMargin(10),
|
||||
m_sizeCell(120),
|
||||
m_spaceBetweenCell(10)
|
||||
{
|
||||
|
||||
|
||||
//Define skin:
|
||||
skin.push_back(sf::Color(250,248,239));
|
||||
m_skin.push_back(sf::Color(250,248,239)); //Background MainWindow
|
||||
m_skin.push_back(sf::Color(205,192,180)); //Background cells
|
||||
|
||||
|
||||
}
|
||||
|
@ -20,6 +24,23 @@ MainWindow::MainWindow(int width, int height, std::string title):
|
|||
MainWindow::~MainWindow(){
|
||||
}
|
||||
|
||||
void MainWindow::clearMW(){
|
||||
RenderWindow::clear(skin.at(0));
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue