/* GameOfLife - Conway's Game of Life in 3D * * Copyright (c) 2008 by Sebastian Lohff, seba@seba-geek.de * http://www.seba-geek.de * * This file is part of GameOfLife. * * GameOfLife is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * GameOfLife is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GameOfLife. If not, see . */ #ifndef __GAMEOFLIFE_H #define __GAMEOFLIFE_H #include #include #include #include #include #include #include "emath.h" #include "punkt2d.h" typedef enum { dead=0, alife, dies, born } State; class GameOfLife { private: State **feld; int x, y; bool torus; bool fullcelluse; unsigned long generation; GLUquadricObj *quad; // Brett float thickness; float cellwidth; // Cylinder float radius; float height; int parts; float *sinval; float *cosval; //render bool view3d; float sectobuild; float b_secdone; float secpertick; float t_secdone; // Edit segl::Punkt2D setpos; bool editmode; void init(); void allocate(); void cleanup(); void renderBrett(); void renderStein(State s); void translateTo(int _x, int _y); void lockStates(); public: GameOfLife(int _x, int _y); GameOfLife(int _x, int _y, int r_life, int r_dead); GameOfLife(std::string file); ~GameOfLife(); void set3D(bool on); bool load(std::string file); bool save(std::string file); void fillRandom(int _x, int _y, int r_life, int r_dead); // void toggle(int _x, int _y); void setEditMode(bool e); void move(int up, int right); void toggle(); float getTickSec(); float getBuildSec(); void setTickSec(float s); void setBuildSec(float s); void setTorus(bool t); unsigned long getGeneration(); // const bool** getFeld(); void tick(); void render(float sec); void clear(); }; #endif