Gra w życie – Podejście drugie

Podejście drugie do projektu gry życie czyli tak naprawdę kontynuacja tego wpisu http://darkgl.pl/2015/05/21/gra-w-zycie/ Projekt nie dokończony Część kodu
#define WIN32_LEAN_AND_MEAN

#include 

#include 

#include 
#include 
#include 

#include "LifeScene.h"

#include 

int main(int argc, char** argv) {

LifeScene currentScene;

int intervalTime = 0;

int renderSizeX = 0 ,
renderSizeY;

bool randomInput = true;

std::cout << "Input interval ( ms ) : ";
	std::cin >> intervalTime;

std::cout << "Input render size x : ";
	std::cin >> renderSizeX;

std::cout << "Input render size y : ";
	std::cin >> renderSizeY;

std::cout << "Random input ? ";
	std::cin >> randomInput;

currentScene.setGridSize( renderSizeX , renderSizeY );
currentScene.setPosition( renderSizeX / 2 , renderSizeY / 2 );

if( randomInput ){
srand (time(NULL));

for( int positionX = ( renderSizeX / 2 ) - ( renderSizeX / 2 ) ; positionX <= renderSizeX ; positionX++ ){
			for( int positionY = ( renderSizeY / 2 ) - ( renderSizeY / 2 ) ; positionY <= renderSizeY ; positionY++ ){
				if( rand() % 2 ){
					currentScene.setAliveCell( positionX , positionY );
				}
			}
		}
	}
gameoflife Life Game.zip Download

Dodaj komentarz

Witryna wykorzystuje Akismet, aby ograniczyć spam. Dowiedz się więcej jak przetwarzane są dane komentarzy.