CGAssignment
/home/shubham/Desktop/CG/driver3.cpp File Reference
#include "GLFW/glfw3.h"
#include "bits/stdc++.h"
#include "DrawUtil.h"
Include dependency graph for driver3.cpp:

Classes

struct  Point
 
class  Tree
 

Macros

#define OPENBRACKET   '['
 
#define CLOSEDBRACKET   ']'
 
#define COLORCHANGE   'C'
 
#define TURNLEFT   '+'
 
#define TURNRIGHT   '-'
 
#define DRAW   'F'
 
#define CIRCLE   'c'
 
#define WIDTH   'W'
 

Functions

int main ()
 

Variables

const double DECAY_RATE = 1
 
const double INITIAL_LENGTH = 5
 
const double MAX_GENERATIONS = 9
 
const double ROTATE_ANGLE = 20
 
const double INITIAL_ANGLE = 90
 
DrawUtilDU
 
map< char, string > Rule
 

Macro Definition Documentation

#define CIRCLE   'c'
#define CLOSEDBRACKET   ']'
#define COLORCHANGE   'C'
#define DRAW   'F'
#define OPENBRACKET   '['
#define TURNLEFT   '+'
#define TURNRIGHT   '-'
#define WIDTH   'W'

Function Documentation

int main ( )
131  {
132 
133  DU = new DrawUtil();
134  DU->initializeColors();
135 
136  int H = 1080, W = 1920;
137  GLFWwindow* window = DU->StartWindow(H, W);
138 
139  DU->drawNightSky(W, H);
140  DU->drawStars(W, H, 600);
141  DU->drawGrass(W);
142  DU->setColor(1,1,1);
143  DU->fillCircle(0.15*W, 0.85*H, 50);
144 
145  freopen("in", "r", stdin);
146  string s;
147  cin >> s;
148  string _tmp; char _ch;
149  while (cin >> _ch >> _tmp){
150  Rule[_ch] = _tmp;
151  }
152 
153  Tree tree2(s, Point(W*0.2,0), INITIAL_LENGTH, INITIAL_ANGLE, 1, 0, 2);
154  tree2.Process();
155 
156  DU->Stayawake(window);
157 }
void drawStars(int W, int H, int count)
Definition: DrawUtil.cpp:233
void Stayawake(GLFWwindow *window)
Definition: DrawUtil.cpp:306
Definition: DrawUtil.cpp:6
Definition: driver3.cpp:24
void setColor(double r, double g, double b)
Definition: DrawUtil.cpp:317
DrawUtil * DU
Definition: driver3.cpp:23
void fillCircle(int x, int y, int r)
Definition: DrawUtil.cpp:284
map< char, string > Rule
Definition: driver3.cpp:32
void drawGrass(int W)
Definition: DrawUtil.cpp:248
Definition: driver3.cpp:33
void initializeColors()
Definition: DrawUtil.cpp:17
const double INITIAL_LENGTH
Definition: driver3.cpp:7
void drawNightSky(int W, int H)
Definition: DrawUtil.cpp:273
const double INITIAL_ANGLE
Definition: driver3.cpp:10
GLFWwindow * StartWindow(int _h, int _w)
Definition: DrawUtil.cpp:326

Variable Documentation

const double DECAY_RATE = 1
DrawUtil* DU
const double INITIAL_ANGLE = 90
const double INITIAL_LENGTH = 5
const double MAX_GENERATIONS = 9
const double ROTATE_ANGLE = 20
map<char, string> Rule