Exemplo n.º 1
0
void MapStorage::renderGrid(void)
{
    int wc, hc;
    wc = (int)(xMax/cellSz);
    hc = (int)(yMax/cellSz);
    assert(wc > 0);
    assert(hc > 0);
    map->info.width = wc;
    map->info.height = hc;
    assert(wc*hc < 100000000);
    map->data.resize(wc*hc);
    *distMap = *map;
    *inflMap = *map;

    if(cr!=nullptr)
        cairo_destroy(cr);
    if(surface!=nullptr)
        cairo_surface_destroy(surface);
    
    surface = cairo_image_surface_create (CAIRO_FORMAT_A8, wc, hc);
    cr = cairo_create (surface);
    
    for(int i = 0; i<wallSt.size(); i++)
        drawWall(wallSt[i].x0, wallSt[i].y0, wallSt[i].x1, wallSt[i].y1, wallSt[i].thickness);
    for(int i = 0; i<lineSt.size(); i++)
        drawWall(lineSt[i].x0, lineSt[i].y0, lineSt[i].x1, lineSt[i].y1, lineSt[i].thickness);
    for(int i = 0; i<ellipseSt.size(); i++)
        drawEllipse(ellipseSt[i].x, ellipseSt[i].y, ellipseSt[i].a, ellipseSt[i].b, ellipseSt[i].th);
    
    unsigned char *data = cairo_image_surface_get_data (surface);
    map->data.assign(data, data+(wc*hc));
    renderDistMap();
    renderInflMap();
}
Exemplo n.º 2
0
void TestAppBlockBuilder::draw   (){
    glClearColor( 0.5f, 0.5f, 0.5f, 1.0f );
	glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
	glEnable(GL_DEPTH_TEST);

    //glEnable     ( GL_LIGHTING         );

    printf( " ==== frame %i \n", frameCount );
    //printf( " perspective %i first_person %i \n", perspective, first_person );
    //printf( " rot %3.3f %3.3f %3.3f \n", camMat.a.x, camMat.a.y, camMat.a.z );
    //printf( " rot %3.3f %3.3f %3.3f \n", camMat.b.x, camMat.b.y, camMat.b.z );
    //printf( " rot %3.3f %3.3f %3.3f \n", camMat.c.x, camMat.c.y, camMat.c.z );
    //printf( " %i %i %i   side %i type %i shape %i \n", ix,iy,iz, cursorSide, cursorWallType, world.wallTypes[ cursorWallType ].shape );


    Vec3d pos;
	world.index2pos( {ix, iy, iz}, pos );
    drawWall( pos, cursorSide, world.wallTypes[ cursorWallType ].shape  );

    if( world.truss.points != NULL ){
        world.truss.dt   = 0.005;
        world.truss.damp = 1.0 - 0.01;
        for( int i=0; i<10; i++ ){
             world.truss.step( );
        }
    }

    //printf( "nBlocks %i nMaxBlocks %i \n", world.nBlocks, world.nMaxBlocks );
    for( int i=0; i<world.nBlocks; i++ ){
        if( !world.blocks[i].isEmpty() ){
            drawBlock( world.blocks[i] );
        }
    }

    glDisable ( GL_LIGHTING );

    glColor3f(0.5f,0.0f,0.0f); Draw3D::drawScale( {   0.0,   0.0,0.0}, {ix-127,0.0   ,   0.0}, {0.0,1.0,0.0}, 1.0, 0.1, 0.1 );
    glColor3f(0.0f,0.5f,0.0f); Draw3D::drawScale( {ix-127,   0.0,0.0}, {ix-127,iy-127,   0.0}, {1.0,0.0,0.0}, 1.0, 0.1, 0.1 );
    glColor3f(0.0f,0.0f,0.5f); Draw3D::drawScale( {ix-127,iy-127,0.0}, {ix-127,iy-127,iz-127}, {1.0,0.0,0.0}, 1.0, 0.1, 0.1 );
	Draw3D::drawAxis ( 3.0f );

	glDisable(GL_DEPTH_TEST);

	glColor3f(0.0f,0.0f,1.0f); drawTruss(       false );
	glColor3f(1.0f,0.0f,0.0f); drawForces( 1.0, false );

	drawWall( pos, cursorSide, cursorShape );

};
void Dodecahedron::draw()
{
	gl::color( edgesColor );
	
	glPushMatrix();
	
	glRotated( modelRotation.y , 1.0, 0.0, 0.0 );
	glRotated( modelRotation.z , 0.0, 1.0, 0.0 );
	glRotated( modelRotation.x , 0.0, 0.0, 1.0 );
	
	glRotated( get("framesCount")/10.0f , 0, 1.0f, 0);
	
	glRotated( get("framesCount")/10.0f , 0, 1.0f, 0);
	
	/*
	 * @see: http://www.cs.umbc.edu/~squire/reference/polyhedra.shtml#dodecahedron
	 */
	for( int wall = 0 ; wall < WALL_COUNT ; wall++ ){
		drawWall( wall );
		__drawWallCenter( wall );
		__drawWallCoordinateSystem( wall );
		drawSonicCones( wall );
	}

	glPopMatrix();
}
Exemplo n.º 4
0
void drawHouse(double xLoc,
               double yLoc,
               double zLoc,
               double xSize,
               double ySize,
               double zSize)
{
  //printf("j");fflush(stdout);
	glPushMatrix();
  glTranslated(xLoc, yLoc, zLoc); // For house
	
	coordinates house;
	house.x = 5.0;
	house.y = 4.0;
	house.z = 4.0;
	
	//glTranslated(-house.x/2.0, house.y/2.0, 0);
	
	int logNum = 8;
	double logOverlap= .1;
	
  //printf("k");fflush(stdout);
	// Wall Zero
	glPushMatrix();
	glTranslated(0,-house.y*logOverlap, 0);
	glRotated(0, 0, 0, 0);
	drawWallWithOpening(house.z, house.x, logNum, house.x*.37, 0, house.x*.63, house.z*.75);
	glPopMatrix();
	//printf("l");fflush(stdout);
	// Wall 1
	glPushMatrix();
	glTranslated(house.x*logOverlap, 0, 0);
	glRotated(-90, 0, 0, 1);
	drawWallWithOpening(house.z, house.y, logNum, house.y*.4, house.z*.4, house.y*.75, house.z*.75);
	glPopMatrix();
	//printf("m");fflush(stdout);
	// Wall 2
	glPushMatrix();
	glTranslated(0, house.y*(logOverlap - 1), 0);
	glRotated(00, 0, 0, 0);
	drawWall(house.z, house.x, logNum);
	glPopMatrix();
  //printf("n");fflush(stdout);
	// Wall 3
	glPushMatrix();
	glTranslated(house.x*(1 - logOverlap), 0, 0);
	glRotated(-90, 0, 0, 1);
	drawWallWithOpening(house.z, house.y, logNum, house.y*.25, house.z*.4, house.y*.6, house.z*.75);
	glPopMatrix();
	//printf("o");fflush(stdout);
	drawRoof(2.0, house);
  //printf("y");fflush(stdout);
	drawFloor(house, logOverlap);
	glPopMatrix();
}
Exemplo n.º 5
0
Arquivo: main.cpp Projeto: Pinkii-/IDI
void refresh(void) {
    glClearColor(r,g,b,a);
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    if (sferaVisible) {
    glPushMatrix();
        glColor3f(0,0,0);
        glTranslated(s.centro.x,s.centro.y,s.centro.z);
        glutWireSphere(s.radio,30,30);
    glPopMatrix(); }
    glPushMatrix();
        glColor3f(0.1,0.9,0.9);
        drawGround(Vector3f(0,0,0), Vector3f(1,0,1), 10);
    glPopMatrix();
    ejes();
    if (wallVisible) {drawWall(Vector3f(0,0,-4.9),Vector3f(10,1.5,0.2));
                      drawWall(Vector3f(1.5,0,2.5),Vector3f(0.2,1.5,4));}
    drawMonigotes();
    glPushMatrix(); //patricio serialKiller
        glTranslated(patricio1.posFinal.x,patricio1.posFinal.y,patricio1.posFinal.z);
        glRotated(direccionPatricio,0,1,0);
        daModelIsReal(patricio1);
    glPopMatrix();
    glPushMatrix(); //patricio 2
        glTranslated(patricio2.posFinal.x,patricio2.posFinal.y,patricio2.posFinal.z);
        daModelIsReal(patricio2);
    glPopMatrix();
    for (uint i = 0; i < balas.size();++i) {
        glPushMatrix();
        glTranslated(balas[i].pos.x,balas[i].pos.y,balas[i].pos.z);
        glRotated(balas[i].dir,0,1,0);
        glTranslated(0.25,0.2,0.32);
        balas[i].draw();
        glPopMatrix();
    }
    glPushMatrix();
        writeOnWindow();
    glPopMatrix();
    glutPostRedisplay();
    glutSwapBuffers();
}
Exemplo n.º 6
0
static void drawBox(float l, float w, float h, vert pos)
{
	// New Position Vertex
	vert v;
	replaceVert(&v, pos.x, pos.y, pos.z + l / 2);

	glColor3f(0, 1, 1);
	drawWall(0, w, h, v);
	
	replaceVert(&v, pos.x, pos.y, pos.z-l/2);
	drawWall(1, w, h, v);

	glColor3f(1, 0, 0);

	replaceVert(&v, pos.x - w / 2, pos.y, pos.z);
	drawWall(3, l, h, v);

	glColor3f(0, 0, 1);
	
	replaceVert(&v, pos.x + w / 2, pos.y, pos.z);
	drawWall(2, l, h, v);

	glColor3f(0, 1, 0);

	replaceVert(&v, pos.x, pos.y - h / 2, pos.z);
	drawWall(4, w, l, v);

	replaceVert(&v, pos.x, pos.y + h / 2, pos.z);
	drawWall(5, w, l, v);


}
Exemplo n.º 7
0
void drawHouse()
{
  ErrCheck("Before drawHouse"); 
	glPushMatrix();
	
	coordinates house; 
	house.x = 5.0;
	house.y = 3.0; 
	house.z = 4.0; 
	
	glTranslated(-house.x/2.0, 0, house.z/2.0); 
	
	int logNum = 8;
	double logOverlap= .1; 
	
	 
	// Wall Zero
	glPushMatrix();
	glTranslated(0, 0, -house.z*logOverlap); 
	glRotated(0, 0, 0, 0); 
	drawWallWithOpening(house.y, house.x, logNum, house.x*.4, 0, house.x*.6, house.y*.75); 
	
	//drawWall(house.y, house.x, logNum); 
	glPopMatrix(); 
	
	// Wall 1
	glPushMatrix();
	glTranslated(house.x*logOverlap, 0, 0); 
	glRotated(90, 0, 1, 0); 
	drawWallWithOpening(house.y, house.z, logNum, house.z*.4, house.y*.4, house.z*.75, house.y*.75); 
	glPopMatrix(); 
	
	// Wall 2
	glPushMatrix();
	glTranslated(0, 0, house.z*(logOverlap - 1)); 
	glRotated(00, 0, 0, 0); 
	drawWall(house.y, house.x, logNum); 
	glPopMatrix();
		
	// Wall 3 
	glPushMatrix();
	glTranslated(house.x*(1 - logOverlap), 0, 0); 
	glRotated(90, 0, 1, 0); 
	drawWallWithOpening(house.y, house.z, logNum, house.z*.4, house.y*.4, house.z*.75, house.y*.75); 
	//drawWall(house.y, house.z, logNum); 
	glPopMatrix(); 
	
	drawRoof(2.0, house);
	drawFloor(house, logOverlap); 
	glPopMatrix(); 
	ErrCheck("After drawFloor"); 
}
Exemplo n.º 8
0
	void drawBlock( const Block& block ){
	    Vec3d pos;
	    world.index2pos( {block.ix,block.iy,block.iz}, pos );
	    //printf( "block %i %i %i (%3.3f,%3.3f,%3.3f)", block.ix,block.iy,block.iz, pos.x, pos.y, pos.z );
		for(int iSide=0; iSide<6; iSide++){
            int type = block.sides[iSide];
            if(type<world.nMaxTypes){
                int shape = world.wallTypes[ type ].shape; // this seems to be a bit long dereferencing
                //printf( " side %i type %i shape %i \n", iSide, block.sides[iSide], shape );
                drawWall( pos, iSide, shape );
            }
		}
	}
Exemplo n.º 9
0
void drawWallWithOpening(double height
                       , double width
                       , int logCount
                       , double startX
                       , double startY
                       , double endX
                       , double endY)
{	
  ErrCheck("Before drawWallWithOpening");
	double openingHeight = endY - startY; 
	int openLogs = int((openingHeight/height)*logCount+.5); 
	int beforeOpeningLogs = int((startY/height)*logCount+.5);
	int afterOpeningLogs = logCount - openLogs - beforeOpeningLogs; 
	
	//printf("before logs %d\n", beforeOpeningLogs); 
	
	//Wall below window
	drawWall(startY,  width, beforeOpeningLogs); 
	
	// Left of Opening
	glPushMatrix();
	glTranslated(0,startY,0); 
	drawWall(openingHeight, startX, openLogs); 
	glPopMatrix(); 
	
	// Right of Opening
	glPushMatrix();
	glTranslated(endX,startY,0); 
	drawWall(openingHeight, width - endX, openLogs);  
	glPopMatrix(); 
	
	// Above Opening
	glPushMatrix();
	glTranslated(0,endY,0); 
	drawWall(height - endY, width, afterOpeningLogs); 
	glPopMatrix(); 
	ErrCheck("After drawWallWithOpening");
}
Exemplo n.º 10
0
static void drawRoom() 
{

	vert pos;
	replaceVert(&pos, 0, -2.5, 0);

	glColor3f(0.3, 0.3, 0.3); // Floor/Ceiling
	drawWall(5, 5,5, pos);

	replaceVert(&pos, 0, 2.5, 0);
	drawWall(4, 5,5, pos);
	
	glColor3f(1, 1, 1); // Far Wall
	replaceVert(&pos, 0, 0, -2.5);
	drawWall(0, 5,5, pos);
	
	glColor3f(0.6, 0.6, 0.6);// Side Walls
	replaceVert(&pos, -2.5, 0, 0);
	drawWall(2, 5,5, pos);
	replaceVert(&pos, 2.5, 0, 0);
	drawWall(3, 5,5, pos);

}
Exemplo n.º 11
0
		void PlayGround::drawMapElement(models::scene::PlayGround::MapBlockType typeElement){
			switch(typeElement){
			case models::scene::PlayGround::POINT:
				drawPoint();
				break;
			case models::scene::PlayGround::SPECIAL:
				drawSpecial();
				break;
			case models::scene::PlayGround::WALL:
				drawWall();
				break;
			default:
				break;
			}
		}
Exemplo n.º 12
0
void Helper::paint(QPainter *painter, QPaintEvent *event, int elapsed, bool timerStopped)
{

    painter->fillRect(event->rect(), background);

    for (int i = 0; i < b->lights.length(); i++) {
        glm::vec2 position = b->lights.at(i)->getPosition();
        drawLight(painter, position.x, position.y, b->lights.at(i)->radius);
        drawTrail(painter, b->lights.at(i)->trail, b->lights.at(i)->trailColor);
    }

    for (int j = 0; j < b->mosquitoes.length(); j++) {
        if (!b->mosquitoes.at(j)->isEaten) {
            drawMosquito(painter, b->mosquitoes.at(j)->position.x, b->mosquitoes.at(j)->position.y);
        }
    }

    for (int k = 0; k < b->walls.length(); k++) {
        drawWall(painter, b->walls.at(k)->point1.x, b->walls.at(k)->point1.y, b->walls.at(k)->point2.x, b->walls.at(k)->point2.y);
    }

    drawFrog(painter, b->frog->position.x, b->frog->position.y, b->frog->radius);
}
Exemplo n.º 13
0
void Maze::createMaze() {
	glNewList(mazeDisplayList, GL_COMPILE);
    glColor3f(0.0, 0.0, 0.8);

    int mazeHeight = getHeight();
    int mazeWidth = getWidth(); 
    
    for (int x = 0; x < mazeWidth; x++) {
        for (int y = 0; y < mazeHeight; y++) {  
                       
            float * color = getPixel(x,y);
            
            point center;
            center.x = (float)x - (width / 2 - 0.5);
            center.y = (float)y - (height / 2 - 0.5);
            center.z = -19.5;
            tiles[x][y].setCenter(center);
            
            pos position;
            position.x = x;
            position.y = y;
            tiles[x][y].setPosition(position);
            
            float colorSum = color[0] + color[1] + color[2];
            
            if (color[0] == 1.0 && colorSum == 1.0) {
                tiles[x][y].setEnergizer();                
            }
            else if (color[0] == 1.0 && color[1] == 1.0 && color[2] == 0.0) {
                // Dot
            }
            else if (colorSum == 3.0) {
                tiles[x][y].setVisited();            
            }
            else {
                tiles[x][y].setVisited();
                if (colorSum > 0.0) {
                    drawWall(x, y, color);
                }
                else {
                    //drawCeiling(x, y);
                }
            }
        }
    }
    
    // Configure exits
    for (int x = 1; x < mazeWidth; x++) {
        for (int y = 1; y < mazeHeight; y++) { 
            if (!isWall(x,y)) {
                if (!isWall(x,y-1)) {     
                    tiles[x][y].setExit(down, &tiles[x][y-1]);
                    tiles[x][y-1].setExit(up, &tiles[x][y]);
                }
                if (!isWall(x-1,y)) {
                    tiles[x][y].setExit(left, &tiles[x-1][y]);
                    tiles[x-1][y].setExit(right, &tiles[x][y]);                    
                }
            }
        }
    }  
    
    for (int x = 0; x < mazeWidth; x++) {
        if (!isWall(x,0) && !isWall(x, mazeHeight-1)) {
            tiles[x][0].setExit(up, &tiles[x][mazeHeight-1]);
            tiles[x][mazeHeight-1].setExit(down, &tiles[x][0]);   
        }
    }
    
    for (int y = 1; y < mazeHeight; y++) { 
        if (!isWall(0,y) && !isWall(mazeWidth - 1, y)) {
            tiles[0][y].setExit(left, &tiles[mazeWidth - 1][y]);
            tiles[mazeWidth - 1][y].setExit(right, &tiles[0][y]);   
        }
    }
    
	glEndList();
}
Exemplo n.º 14
0
int main(int argc,char *argv[]) {




char green[] ="#00FF00";
char red[] ="#ff0000";
char white[]="#FFFFFF";
char black[]="#000000";

int xres=1920;
int yres=1080;
int pixsize=10;
//if wallstrue equals zero then there will be no walls, else there will be walls
int wallstrue=1;
char * name="maze.png";

//if (argc>1)
//xres=std::stoi(argv[1]);
//if (argc>2)
//yres=std::stoi(argv[2]);
//if (argc>3)
//pixsize=std::stoi(argv[3]);
//if (argc>4)
//wallstrue=std::stoi(argv[4]);
//if (argc>5)
//name=argv[5];


for (int i=1;i<argc;i++)
{
    std::string flag=argv[i];
if (flag=="-w"||flag=="--width")
xres=std::stoi(argv[i+1]);
if (flag=="-h"||flag=="--height")
yres=std::stoi(argv[i+1]);
if (flag=="-p"||flag=="--pixel-size")
pixsize=std::stoi(argv[i+1]);
if (flag=="-b"||flag=="--walls")
wallstrue=std::stoi(argv[i+1]);
if (flag=="-n"||flag=="--file-name")
name=argv[i+1];


}


Draw xwin(pixsize,xres,yres);

int xblocks=xwin.screenwidth/xwin.pixwidth-1;
int yblocks=xwin.screenheight/xwin.pixwidth-1;

Maze maze(xblocks,yblocks);

//1 means it loops
maze.startCreation(1);


maze.nextStep();


if (wallstrue!=0)
{
	//horizontal
	drawWall(maze.wall.horwalls,maze.wall.width,maze.wall.height,&xwin,black,1.0,1.0/2.0,0);
	//verticle
	drawWall(maze.wall.vertwalls,maze.wall.width+1,maze.wall.height-1,&xwin,black,1.0/2.0,1.0,1);

}

//	drawBlock(maze.xpos,maze.ypos,&xwin,&maze,red_gc);


	int colors[6];

	for (int i=0;i<6;i++)
	{
	colors[i]=rand()%256;
	}

	double distance =sqrt(  pow((colors[0]-colors[3]),2) + pow((colors[1]-colors[4]),2) + pow((colors[3]-colors[5]),2));

	while (distance<200|distance>300)
	{
	for (int i=0;i<6;i++)
	colors[i]=rand()%256;
	distance =sqrt(  pow((colors[0]-colors[3]),2) + pow((colors[1]-colors[4]),2) + pow((colors[3]-colors[5]),2));
	}


maze.drawValues(&xwin,colors[0],colors[1],colors[2],colors[3],colors[4],colors[5]);

//	maze.drawValues(&xwin,255,255,255,0,0,0);



xwin.writePng(name);



//	xwin.printPoints();
//	xwin.drawScene();



xwin.clearStack();

return 0;
}
Exemplo n.º 15
0
void drawScene(void)
{
	mvstack.push(model_view);
	drawHcube();
	drawLoveHeart();
	model_view = mvstack.pop();
	// Draw Ground
	mvstack.push(model_view);
		set_colour(0.5,1,0.5);
		model_view *= Translate(0.0f, -4.75f, 0.0f);
		model_view *= Scale(100.0f, 1.0f, 100.0f);
		drawCube();
	model_view = mvstack.pop();
	//Draw Tree
	mvstack.push(model_view);
	model_view *= Translate(5.0f, -4.75f, -5.0f);
	drawPineTree();
	model_view = mvstack.pop();
	// Draw Grass
	mvstack.push(model_view);
		model_view *= Translate(10.0f, -4.0f, 0.0f);
		drawGrass();
	model_view = mvstack.pop();
	mvstack.push(model_view);
		model_view *= Translate(12.0f, -4.0f, 3.0f);
		drawGrass();
	model_view = mvstack.pop();
	mvstack.push(model_view);
		model_view *= Translate(-11.0f, -4.0f, 4.0f);
		drawGrass();
	model_view = mvstack.pop();
	mvstack.push(model_view);
		model_view *= Translate(-9.0f, -4.0f, -2.0f);
		drawGrass();
	model_view = mvstack.pop();
	mvstack.push(model_view);
		model_view *= Translate(-4.0f, -4.0f, 5.0f);
		drawGrass();
	model_view = mvstack.pop();
	mvstack.push(model_view);
		model_view *= Translate(-3.0f, -4.0f, 9.0f);
		drawGrass();
	model_view = mvstack.pop();
	mvstack.push(model_view);
		model_view *= Translate(-5.0f, -4.0f, -15.0f);
		drawGrass();
	model_view = mvstack.pop();
	mvstack.push(model_view);
		model_view *= Translate(6.0f, -4.0f, -14.0f);
		drawGrass();
	model_view = mvstack.pop();
	mvstack.push(model_view);
		model_view *= Translate(7.0f, -4.0f, -25.0f);
		drawGrass();
	model_view = mvstack.pop();
	mvstack.push(model_view);
		model_view *= Translate(-8.0f, -4.0f, -18.0f);
		drawGrass();
	model_view = mvstack.pop();
	
	// Draw Walls
	mvstack.push(model_view);

		set_colour(0.9,0.9,1);

		mvstack.push(model_view);
			model_view *= RotateX(90);
			model_view *= RotateY(90);
			model_view *= Translate(20.0f, -50.0f, 0.0f);
			model_view *= Scale(50.0f, 1.0f, 100.0f);
			drawWall();
			model_view *= Translate(0.0f, 100.0f, 0.0f);
			drawWall();
		model_view = mvstack.pop();

		mvstack.push(model_view);
			model_view *= Translate(50.0f, 20.0f, 0.0f);
			model_view *= Scale(1.0f, 50.0f, 100.0f);
			drawWall();
			model_view *= Translate(-100.0f, 0.0f, 0.0f);
			drawWall();
		model_view = mvstack.pop();

	model_view = mvstack.pop();

    // Draw Bench
	mvstack.push(model_view);
		model_view *= Translate(0.0f, -2.0f, 0.0f);
		drawBench();
	model_view = mvstack.pop();
}
Exemplo n.º 16
0
int game(int seed)
{
	REG_DISPCTL = MODE3 | BG2_ENABLE;
	int live = 5;
	char buffer[41];
	int speed = 1;

	int num = 100;
	int objx = 70;
	int objy = 50;

	drawPicture(black);
	
	WALL wall0;
	wall0.i = 80;
	wall0.gate = 90;
	wall0.gateSize = 10;
	wall0.color = WHITE;
	
	WALL wall1;
	wall1.i = 100;
	wall1.gate = 90;
	wall1.gateSize = 10;
	wall1.color = MAGENTA;

	WALL wall2;
	wall2.i = 120;
	wall2.gate = 30;
	wall2.gateSize = 30;
	wall2.color = RED;
	
	WALL wall3;
	wall3.i = 140;
	wall3.gate = 150;
	wall3.gateSize = 30;
	wall3.color = BLUE;

	WALL wall4;
	wall4.i = 160;
	wall4.gate = 0;
	wall4.gateSize = 20;
	wall4.color = GREEN;

	WALL wall5;
	wall5.i = 180;
	wall5.gate = 130;
	wall5.gateSize = 20;
	wall5.color = BLUE;
	
	WALL wall6;
	wall6.i = 200;
	wall6.gate = 130;
	wall6.gateSize = 15;
	wall6.color = CYAN;
	

	// Game Loop
	while(1)
	{
		
		int oldx = objx;
		int oldy = objy;
		
		drawRect(oldx,oldy,1,1, BLACK);


		if(KEY_DOWN_NOW(BUTTON_SELECT))
		{	
			
		 	objx = 70;
			objy = 50;
			live = 5;
			drawRect(150,0,60,30,BLACK);
			drawString(150, 0, "Score: 0", YELLOW);

		}
		
				
		if(KEY_DOWN_NOW(BUTTON_UP))
		{
			objx-=speed;
			if(objx < 0)
			{
				objx = 0;
			}
			
		}
		if(KEY_DOWN_NOW(BUTTON_DOWN))
		{
			objx+=speed;
			if(objx > 159)
			{
				objx = 159;
			}
		
		}
		
		if(KEY_DOWN_NOW(BUTTON_A))
		{
			speed = 2;
		
		}
		if(KEY_DOWN_NOW(BUTTON_B))
		{
			speed = 1;
			
		}
		if(KEY_DOWN_NOW(BUTTON_RIGHT))
		{
			objy++;
	
		}
		if(KEY_DOWN_NOW(BUTTON_LEFT))
		{
			objy--;
			if(objy <= 0)
			{
				objy= 0;
			}
	
		}
	
		drawRect(objx,objy,1,1, RED);
		
		drawWall(wall0.i, wall0.gate, wall0.gateSize, wall0.color);
		
		if(num < 50) 
		{
			if(num <= 0)
			{
				num = 100;
			}
			
			drawWall(wall1.i, wall1.gate++, wall1.gateSize, wall1.color);
			drawWall(wall2.i, wall2.gate-=2, wall2.gateSize, wall2.color);
			drawWall(wall3.i, wall3.gate+=3, wall3.gateSize, wall3.color);
			drawWall(wall4.i, wall4.gate-=3, wall4.gateSize, wall4.color);
			drawWall(wall5.i, wall5.gate+=3, wall5.gateSize, wall5.color);
			drawWall(wall6.i, wall6.gate+=3, wall6.gateSize, wall6.color);
		}
		else 
		{
			drawWall(wall1.i, wall1.gate--, wall1.gateSize, wall1.color);
			drawWall(wall2.i, wall2.gate+=2, wall2.gateSize, wall2.color);
			drawWall(wall3.i, wall3.gate-=3, wall3.gateSize, wall3.color);
			drawWall(wall4.i, wall4.gate+=3, wall4.gateSize, wall4.color);
			drawWall(wall5.i, wall5.gate-=3, wall5.gateSize, wall5.color);
			drawWall(wall6.i, wall6.gate-=3, wall6.gateSize, wall6.color);
		}
		num--;
		
		if(objy < wall0.i)
		{
			drawString(150, 0, "Score: 0", YELLOW);
		}

		if(objy == wall0.i)
		{
			if(objx < wall0.gate || objx > wall0.gate + wall0.gateSize)
			{
				live--;
				objy-=10;
				drawRect(objx,objy ,1,1, RED);

				if (live == 0)
				{
					return LOSE;
				}
			}
			drawRect(150,0,60,30,BLACK);
			
			drawString(150, 0, "Score: 1", YELLOW);
		}
		if(objy == wall1.i)
		{
			if(objx < wall1.gate || objx > wall1.gate + wall1.gateSize)
			{
				live--;
				objy-=10;
				drawRect(objx,objy ,1,1, RED);
				if (live == 0)
				{
					return LOSE;
				}
			}
			drawRect(150,0,60,30,BLACK);
			drawString(150, 0, "Score: 2", YELLOW);
		}
		if(objy == wall2.i)
		{
			if(objx < wall2.gate || objx > wall2.gate + wall2.gateSize)
			{
				live--;
				objy-=10;
				drawRect(objx,objy ,1,1, RED);
				if (live == 0)
				{
					return LOSE;
				}
			}
			drawRect(150,0,60,30,BLACK);
			drawString(150, 0, "Score: 3", YELLOW);
		}
		if(objy == wall3.i)
		{
			if(objx < wall3.gate || objx > wall3.gate + wall3.gateSize)
			{
				live--;
				objy-=10;
				drawRect(objx,objy ,1,1, RED);
				if (live == 0)
				{
					return LOSE;
				}
			}
			drawRect(150,0,60,30,BLACK);
			drawString(150, 0, "Score: 4", YELLOW);
		}
		if(objy == wall4.i)
		{
			if(objx < wall4.gate || objx > wall4.gate + wall4.gateSize)
			{
				live--;
				objy-=10;
				drawRect(objx,objy ,1,1, RED);
				if (live == 0)
				{
					return LOSE;
				}
			}
			drawRect(150,0,60,30,BLACK);
			drawString(150, 0, "Score: 5", YELLOW);
		}
		if(objy == wall5.i)
		{
			if(objx < wall5.gate || objx > wall5.gate + wall5.gateSize)
			{
				live--;
				objy-=10;
				drawRect(objx,objy ,1,1, RED);
				if (live == 0)
				{
					return LOSE;
				}
			}
			drawRect(150,0,60,30,BLACK);
			drawString(150, 0, "Score: 6", YELLOW);
		}
		if(objy == wall6.i)
		{
			if(objx < wall6.gate || objx > wall6.gate + wall6.gateSize)
			{
				live--;
				objy-=10;
				drawRect(objx,objy ,1,1, RED);
				if (live == 0)
				{
					return LOSE;
				}
			}
			drawRect(150,0,60,30,BLACK);
			drawString(150, 0, "Score: 7", YELLOW);
		}
		
		if(objy > wall6.i +5)
		{
			return WIN;
		}
		drawRect(5,5,60,30,BLACK);
		waitForVblank();
		drawImage3(0,0,30,30,heart);
		sprintf(buffer, " %d", live);
		drawString(10, 30, buffer, YELLOW);
		drawString(80,210, "EXIT", YELLOW);
	
		
	}

		
}
Exemplo n.º 17
0
void PEC(void)
{
  drawRact(rectD);
  drawWall();
}
Exemplo n.º 18
0
void GridElement::draw() {
	// draw background if visited
	//if (visited) {
	//	ofSetColor(145, 187, 255);
	//	ofFill();
	//	//ofDrawRectangle((x * GRID_ELEMENT_WIDTH), (y * GRID_ELEMENT_HEIGHT), GRID_ELEMENT_WIDTH / 2, GRID_ELEMENT_HEIGHT / 2);
	//	ofDrawBox((x + 0.5)*GRID_ELEMENT_HEIGHT, (y + 0.1)*GRID_ELEMENT_HEIGHT, -(z + 0.5)*GRID_ELEMENT_HEIGHT, (GRID_ELEMENT_HEIGHT*0.01));
	//}

	if (bfs) {
		ofSetColor(255, 152, 0); //orange
		ofFill();
		//ofDrawRectangle((x * GRID_ELEMENT_WIDTH), (y * GRID_ELEMENT_HEIGHT), GRID_ELEMENT_WIDTH / 2, GRID_ELEMENT_HEIGHT / 2);
		ofDrawBox((x + 0.5)*GRID_ELEMENT_HEIGHT, (y + 0.1)*GRID_ELEMENT_HEIGHT, -(z + 0.5)*GRID_ELEMENT_HEIGHT, (GRID_ELEMENT_HEIGHT*0.15));
	}
	if (astar) {
		ofSetColor(0, 115, 100); //dark teal
		ofFill();
		//ofDrawRectangle((x * GRID_ELEMENT_WIDTH), (y * GRID_ELEMENT_HEIGHT), GRID_ELEMENT_WIDTH / 2, GRID_ELEMENT_HEIGHT / 2);
		ofDrawBox((x + 0.5)*GRID_ELEMENT_HEIGHT, (y + 0.3)*GRID_ELEMENT_HEIGHT, -(z + 0.5)*GRID_ELEMENT_HEIGHT, (GRID_ELEMENT_HEIGHT*0.3));
	}
	if (greedy) {
		ofSetColor(76, 175, 80); //Google Green
		ofFill();
		//ofDrawRectangle((x * GRID_ELEMENT_WIDTH), (y * GRID_ELEMENT_HEIGHT), GRID_ELEMENT_WIDTH / 2, GRID_ELEMENT_HEIGHT / 2);
		ofDrawBox((x + 0.5)*GRID_ELEMENT_HEIGHT, (y + 0.1)*GRID_ELEMENT_HEIGHT, -(z + 0.5)*GRID_ELEMENT_HEIGHT, (GRID_ELEMENT_HEIGHT*0.15));
	}
	if (dfs) {
		ofSetColor(175, 180, 43); //dark teal
		ofFill();
		//ofDrawRectangle((x * GRID_ELEMENT_WIDTH), (y * GRID_ELEMENT_HEIGHT), GRID_ELEMENT_WIDTH / 2, GRID_ELEMENT_HEIGHT / 2);
		ofDrawBox((x + 0.5)*GRID_ELEMENT_HEIGHT, (y + 0.1)*GRID_ELEMENT_HEIGHT, -(z + 0.5)*GRID_ELEMENT_HEIGHT, (GRID_ELEMENT_HEIGHT*0.15));
	}
	if (visited_human) {
		ofSetColor(200); //dark teal
		ofFill();
		//ofDrawRectangle((x * GRID_ELEMENT_WIDTH), (y * GRID_ELEMENT_HEIGHT), GRID_ELEMENT_WIDTH / 2, GRID_ELEMENT_HEIGHT / 2);
		ofDrawBox((x + 0.5)*GRID_ELEMENT_HEIGHT, (y + 0.2)*GRID_ELEMENT_HEIGHT, -(z + 0.5)*GRID_ELEMENT_HEIGHT, (GRID_ELEMENT_HEIGHT*0.20));
	}
	if (human) {
		ofSetColor(255); //dark teal
		ofFill();
		//ofDrawRectangle((x * GRID_ELEMENT_WIDTH), (y * GRID_ELEMENT_HEIGHT), GRID_ELEMENT_WIDTH / 2, GRID_ELEMENT_HEIGHT / 2);
		ofDrawBox((x + 0.5)*GRID_ELEMENT_HEIGHT, (y + 0.1)*GRID_ELEMENT_HEIGHT, -(z + 0.5)*GRID_ELEMENT_HEIGHT, (GRID_ELEMENT_HEIGHT*0.25));
	}

	// draw circle if marked
	//if (marked) {
	//	ofNoFill();
	//	ofSetColor(249, 77, 42);
	//	//ofDrawEllipse((x + 0.5) * GRID_ELEMENT_WIDTH, (y + 0.5) * GRID_ELEMENT_HEIGHT, GRID_ELEMENT_WIDTH * 0.95, GRID_ELEMENT_HEIGHT * 0.95);
	//	ofDrawSphere((x + 0.5) * GRID_ELEMENT_HEIGHT, (y + 0.5) * GRID_ELEMENT_HEIGHT, -(z + 0.5)*GRID_ELEMENT_HEIGHT, GRID_ELEMENT_HEIGHT / 2);

	//}


	// draw all walls
	if (x == (GRID_SIZE - 1) && y == (GRID_SIZE - 1) && z == (GRID_SIZE - 1)) {
		for (int direction = 0; direction < N_DIRECTIONS; direction++) {
			if (walls[direction]) {
				drawEndWall((Direction)direction);
			}
		}
	}
	else {
		for (int direction = 0; direction < N_DIRECTIONS; direction++) {
			if (walls[direction]) {
				ofNoFill();
				drawWall((Direction)direction);
			}
		}
	}
}
Exemplo n.º 19
0
int main(int argc,char *argv[]) {

    png::rgb_pixel black = png::rgb_pixel(0,0,0);

    //default resolution
    int xres=1920;
    int yres=1080;
    //default size of the pixel
    int pixsize=10;
    // 0 - Original colors, 100 - Complete desaturation
    int saturation=0;
    //Color multiplier value
    int colormult=1;
    //seed
    int seed=time(NULL);

    //if wallstrue equals zero then there will be no walls, else there will be walls
    int wallstrue=1;
    char * name="maze.png";
    //true if user picks the colors
    bool setColor=false;
    std::string userColor;

    for (int i=1;i<argc;i++)
    {
	std::string flag=argv[i];
	if (flag=="-w"||flag=="--width")
	    xres=std::stoi(argv[i+1]);
	if (flag=="-h"||flag=="--height")
	    yres=std::stoi(argv[i+1]);
	if (flag=="-p"||flag=="--pixel-size")
	    pixsize=std::stoi(argv[i+1]);
	if (flag=="-b"||flag=="--walls")
	    wallstrue=std::stoi(argv[i+1]);
	if (flag=="-n"||flag=="--file-name")
	    name=argv[i+1];
	if (flag=="-d"||flag=="--desaturation")
	    saturation=std::stoi(argv[i+1]);
	if (flag=="-t"||flag=="--color-multiplier")
	    colormult=std::stoi(argv[i+1]);
	if (flag=="-s"||flag=="--seed")
	    seed=std::stoi(argv[i+1]);
	if (flag=="-c"||flag=="--set-color")
	    {
		setColor=true;
		userColor=argv[i+1];
	    }


    }

    //ignores drawing walls if pixel size is 1
    if (pixsize==1)
	wallstrue=0;

    Draw xwin(pixsize,xres,yres);

    int xblocks=xwin.screenwidth/xwin.pixwidth-1;
    int yblocks=xwin.screenheight/xwin.pixwidth-1;

    Maze maze(xblocks,yblocks);

    maze.startCreation(seed);

    maze.nextStep();

    int colors[6];

    if (setColor==false)
    {

    for (int i=0;i<6;i++) {
	colors[i]=rand()%256;
    }

    double distance =sqrt(  pow((colors[0]-colors[3]),2) + pow((colors[1]-colors[4]),2) + pow((colors[3]-colors[5]),2));

    while (distance<200|distance>300) {
	for (int i=0;i<6;i++)
	    colors[i]=rand()%256;
	distance =sqrt(  pow((colors[0]-colors[3]),2) + pow((colors[1]-colors[4]),2) + pow((colors[3]-colors[5]),2));
    }

    desaturate(saturation / 100.0, &colors[0], &colors[1], &colors[2]);
    desaturate(saturation / 100.0, &colors[3], &colors[4], &colors[5]);

    }
    else
    {
	for (int i=0;i<12;i+=2)
	{
	    unsigned int col;
	    std::stringstream ss;
	    ss << std::hex << std::string(userColor.begin()+i,userColor.begin()+i+2);
	    ss >> col;
	    colors[i/2]=col;
	}
	
    }

    maze.drawValues(&xwin,colors[0],colors[1],colors[2],colors[3],colors[4],colors[5],colormult);

    if (wallstrue!=0) {
	//horizontal
	drawWall(maze.wall.horwalls,maze.wall.width,maze.wall.height,&xwin,black,1.0,1.0/2.0,0);
	//verticle
	drawWall(maze.wall.vertwalls,maze.wall.width+1,maze.wall.height-1,&xwin,black,1.0/2.0,1.0,1);

    }

    xwin.writePng(name);

    return 0;
}
Exemplo n.º 20
0
void Application::onRender()
{
	//std::cout << "[onRender()] Start" << std::endl;

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	shaderManager.On();
	vertexBufferManager.On();

	glm::mat4 matWorld;
	glm::mat4 mvp;

	shaderManager.SetUniform("eyePosition", cameraManager.GetEye());

	//
	// draw the sun and the moon
	//

	const float orbitRadius = (config::MAP_SIZE * config::FIELD_SIZE * config::SUN_AND_MOON_ORBIT_RADIUS_MULTIPLIER) / 2.0f;

	// sun
	shaderManager.SetUniform("isThisTheSunsVertex", true);
	const glm::vec3 sunCurrentPosition = drawOrb(orbitRadius);
	shaderManager.SetUniform("sunPosition", sunCurrentPosition);
	if (sunCurrentPosition.y > 0)
	{
		shaderManager.SetUniform("diffuseLightStrength",
			config::SUN_DIFFUSE_LIGHT_MAX_STRENGTH * (sunCurrentPosition.y / orbitRadius));
	}
	shaderManager.SetUniform("isThisTheSunsVertex", false);


	// moon
	shaderManager.SetUniform("isThisTheMoonsVertex", true);
	const glm::vec3 moonCurrentPosition = drawOrb(-orbitRadius);
	shaderManager.SetUniform("moonPosition", moonCurrentPosition);
	if (moonCurrentPosition.y > 0)
	{
		shaderManager.SetUniform("diffuseLightStrength",
			config::MOON_DIFFUSE_LIGHT_MAX_STRENGTH * (moonCurrentPosition.y / orbitRadius));
	}
	shaderManager.SetUniform("isThisTheMoonsVertex", false);

	//
	// draw the fields
	//

	for (int i = 0; i < config::MAP_SIZE; ++i)
	{
		for (int j = 0; j < config::MAP_SIZE; ++j)
		{
			const glm::mat4 translateToCurrent =
				glm::translate<float>(i * config::FIELD_SIZE, 0, j * config::FIELD_SIZE);

			//
			// portal
			//

			if (fields[i][j].hasPortal())
			{
				shaderManager.SetUniform("isThisAFieldWithAPortal", true);
				const float middleOfTheField = config::FIELD_SIZE / 2.0f;
				shaderManager.SetUniform("portalLightSourcePosition",
					(translateToCurrent * glm::vec4(middleOfTheField, config::WALL_HEIGHT, middleOfTheField, 1)).xyz);
			}
			else
			{
				shaderManager.SetUniform("isThisAFieldWithAPortal", false);
			}

			//
			// grass
			//

			shaderManager.SetUniform("world", translateToCurrent);
			shaderManager.SetUniform("worldInverseTranspose", glm::transpose(glm::inverse(translateToCurrent)));
			shaderManager.SetUniform("MVP", cameraManager.GetViewProj() * translateToCurrent);
			shaderManager.SetTexture("textureImage", 0, grassTextureID);
			shaderManager.SetUniform("isASpecularMaterial", false);
			vertexBufferManager.Draw(GL_QUADS, startOfQuadVertices, numberOfQuadVertices);

			//
			// walls
			//

			if (fields[i][j].hasZMinusWall())
			{
				drawWall(translateToCurrent);
			}

			if (fields[i][j].hasZPlusWall())
			{
				matWorld = translateToCurrent
					* glm::translate<float>(0, 0, config::FIELD_SIZE - config::WALL_THICKNESS);
				drawWall(matWorld);
			}

			if (fields[i][j].hasXPlusWall())
			{
				matWorld = translateToCurrent
					* glm::translate<float>(config::FIELD_SIZE, 0, 0)
					* glm::rotate<float>(-90, 0, 1, 0);
				drawWall(matWorld);
			}

			if (fields[i][j].hasXMinusWall())
			{
				matWorld = translateToCurrent
					* glm::translate<float>(config::WALL_THICKNESS, 0, 0)
					* glm::rotate<float>(-90, 0, 1, 0);
				drawWall(matWorld);
			}

			//
			// coin and diamond
			//

			if (!fields[i][j].hasCoin() && !fields[i][j].hasDiamond())
			{
				continue;
			}

			const float offset = config::FIELD_SIZE / 2.0f;
			matWorld = translateToCurrent
				* glm::translate<float>(offset, 0, offset); // translate to the middle of the field

			// rotation
			if (fields[i][j].hasCoin())
			{
				const float coinRotation = SDL_GetTicks() / 1000.0f * 360.0f / config::COIN_ANIMATION_LENGTH;
				matWorld *= glm::rotate<float>(coinRotation, 0, 1, 0); // for animation
			}
			else if (fields[i][j].hasDiamond())
			{
				const float diamondRotation = SDL_GetTicks() / 1000.0f * 360.0f / config::DIAMOND_ANIMATION_LENGTH;
				matWorld *= glm::rotate<float>(diamondRotation, 0, 1, 0); // for animation
			}

			shaderManager.SetUniform("world", matWorld);
			shaderManager.SetUniform("worldInverseTranspose", glm::transpose(glm::inverse(matWorld)));
			shaderManager.SetUniform("MVP", cameraManager.GetViewProj() * matWorld);
			shaderManager.SetUniform("isASpecularMaterial", true);

			// set the texture and draw the geometry
			if (fields[i][j].hasCoin())
			{
				shaderManager.SetTexture("textureImage", 0, coinTextureID);
				vertexBufferManager.Draw(GL_QUAD_STRIP, startOfCylinderShieldVertices, numberOfCylinderShieldVertices);
				vertexBufferManager.Draw(GL_TRIANGLE_FAN, startOfCylinderBottomVertices, numberOfCylinderBottomVertices);
				vertexBufferManager.Draw(GL_TRIANGLE_FAN, startOfCylinderTopVertices, numberOfCylinderTopVertices);
			}
			else if (fields[i][j].hasDiamond())
			{
				shaderManager.SetTexture("textureImage", 0, diamondTextureID);
				vertexBufferManager.Draw(GL_TRIANGLE_FAN, startOfBottomPyramidVertices, numberOfBottomPyramidVertices);
				vertexBufferManager.Draw(GL_TRIANGLE_FAN, startOfTopPyramidVertices, numberOfTopPyramidVertices);
			}
		}
	}

	//
	// draw the hero
	//

	if (!isWin && !isGameOver)
	{
		//
		// default state
		//

		const glm::mat4 rotateToDirection = CharacterHelper::getRotationToDirectionMatrix(hero);

		const glm::mat4 scaleDown = glm::scale<float>(
			config::FIELD_SIZE / 3.5f, config::FIELD_SIZE / 3.5f, config::FIELD_SIZE / 3.5f);

		const glm::mat4 translateToHeroPosition = CharacterHelper::getTranslateToHeroPositionMatrix(hero);
		const glm::mat4 translateToTheMiddleOfTheField = CharacterHelper::getTranslateToTheMiddleOfTheFieldMatrix(hero);
		const glm::mat4 translateToUp = glm::translate<float>(0, config::FIELD_SIZE / 2.0f, 0);

		glm::mat4 movingTranslate = CharacterHelper::getMovingTranslateMatrix(hero);
		glm::mat4 turningRotation = CharacterHelper::getTurningRotationMatrix(hero);

		matWorld = movingTranslate
			* translateToUp
			* translateToTheMiddleOfTheField
			* translateToHeroPosition
			* scaleDown
			* turningRotation
			* rotateToDirection;
	}
	else if (isWin)
	{
		//
		// win state
		//

		const glm::mat4 rotateToDirection = CharacterHelper::getRotationToDirectionMatrix(hero);

		const glm::mat4 scaleDown = glm::scale<float>(
			config::FIELD_SIZE / 3.5f, config::FIELD_SIZE / 3.5f, config::FIELD_SIZE / 3.5f);

		const glm::mat4 translateToHeroPosition = CharacterHelper::getTranslateToHeroPositionMatrix(hero);
		const glm::mat4 translateToTheMiddleOfTheField = CharacterHelper::getTranslateToTheMiddleOfTheFieldMatrix(hero);
		const glm::mat4 translateToUp = glm::translate<float>(0, config::FIELD_SIZE / 2.0f, 0);

		// *** jump function:
		// 0 <= x <= JUMP_LENGTH (-> from 0 to jumpSize): (x / JUMP_LENGTH) * jumpSize
		// JUMP_LENGTH < x <= 2*JUMP_LENGTH (-> from jumpSize to 0): (1 - ((x - JUMP_LENGTH) / JUMP_LENGTH)) * jumpSize

		glm::mat4 jumpTranslate = glm::mat4(0);
		float jumpHeight = (collectedCoins / (float)config::NUMBER_OF_COINS) * config::JUMP_HEIGHT + config::FIELD_SIZE * 3;
		if (winLastRenderingTime != 0)
		{
			xWinFunctionParameter += SDL_GetTicks() - winLastRenderingTime;

			float y;
			if (xWinFunctionParameter <= config::JUMP_LENGTH_IN_MS)
			{
				y = (xWinFunctionParameter / (float)config::JUMP_LENGTH_IN_MS) * jumpHeight;
			}
			else if (xWinFunctionParameter <= 2.0f * config::JUMP_LENGTH_IN_MS)
			{
				y = (1 - ((xWinFunctionParameter - config::JUMP_LENGTH_IN_MS) / (float)config::JUMP_LENGTH_IN_MS)) * jumpHeight;
			}
			else
			{
				y = 0;
				xWinFunctionParameter = 0;
			}

			jumpTranslate = glm::translate<float>(0, y, 0);
			winLastRenderingTime = SDL_GetTicks();
		}
		else
		{
			winLastRenderingTime = SDL_GetTicks();
		}

		matWorld = jumpTranslate
			* translateToUp
			* translateToTheMiddleOfTheField
			* translateToHeroPosition
			* scaleDown
			* rotateToDirection;
	}
	else
	{
		//
		// game over state
		//

		const glm::mat4 rotateToDirection = CharacterHelper::getRotationToDirectionMatrix(hero);

		const glm::mat4 scaleDown = glm::scale<float>(
			config::FIELD_SIZE / 3.5f, config::FIELD_SIZE / 3.5f, config::FIELD_SIZE / 3.5f);

		const glm::mat4 translateToHeroPosition = CharacterHelper::getTranslateToHeroPositionMatrix(hero);
		const glm::mat4 translateToTheMiddleOfTheField = CharacterHelper::getTranslateToTheMiddleOfTheFieldMatrix(hero);
		const glm::mat4 translateToUp = glm::translate<float>(0, config::FIELD_SIZE / 2.0f, 0);

		glm::mat4 gameOverRotation = glm::mat4(1);
		if (gameOverLastRenderingTime > 0)
		{
			xGameOverFunctionParameter += SDL_GetTicks() - gameOverLastRenderingTime;

			float y;
			if (xGameOverFunctionParameter <= config::GAME_OVER_ANIMATION_LENGTH_IN_MS)
			{
				y = (xGameOverFunctionParameter / (float)config::GAME_OVER_ANIMATION_LENGTH_IN_MS) * 45;
				gameOverLastRenderingTime = SDL_GetTicks();
			}
			else
			{
				y = 45;
				gameOverLastRenderingTime = -1;
			}
			gameOverRotation = glm::rotate<float>(y, 1, 0, 0);
		}
		else if (gameOverLastRenderingTime == 0)
		{
			gameOverLastRenderingTime = SDL_GetTicks();
		}
		else
		{
			gameOverRotation = glm::rotate<float>(45, 1, 0, 0);
		}

		matWorld = translateToUp
			* translateToTheMiddleOfTheField
			* translateToHeroPosition
			* scaleDown
			* rotateToDirection
			* gameOverRotation;
	}

	shaderManager.SetUniform("world", matWorld);
	shaderManager.SetUniform("worldInverseTranspose", glm::transpose(glm::inverse(matWorld)));
	shaderManager.SetUniform("MVP", cameraManager.GetViewProj() * matWorld);
	shaderManager.SetTexture("textureImage", 0, suzanneTextureID);
	shaderManager.SetUniform("isASpecularMaterial", true);
	heroMesh->draw();

	//
	// turn off the managers
	//

	vertexBufferManager.Off();
	shaderManager.Off();

	//std::cout << "[onRender()] End" << std::endl;
}