Example #1
0
void drawBoundary(int width,int height)
{
	static a=0;

	////////////////Net////////////////
	glColor3ub(100,100,0);

	glPushMatrix();
	glTranslated(-25,height/2,0);
	drawNet(50,height/2);
	glPopMatrix();

	glPushMatrix();
	glTranslated(25+width,height/2,0);
	drawNet(50,height/2);
	glPopMatrix();

	/////////////////////Upper Boundary////////////////
	drawUpperBlock(width,height);

	////////////////////Lower Boundary/////////////////
	drawLowerBlock(width,height);

	///////Outline//////////
	drawOutline();
	
}
void drawNetWindow(GLFWwindow* w, std::vector<double>& values, int mode, int& neuron, bool neuron_increment)
{
    glfwSetWindowShouldClose(w,0);

    float ratio;
    int width, height;

    glfwMakeContextCurrent(w);
    glfwGetFramebufferSize(w,&width,&height);
    ratio=width/(float)height;
    glViewport(0,0,width,height);
    glClear(GL_COLOR_BUFFER_BIT);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(-ratio,ratio,-1.f,1.f,1.f,-1.f);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    glColor3f(NN_BACKGROUND_COLOUR_R,NN_BACKGROUND_COLOUR_G,NN_BACKGROUND_COLOUR_B);

    glBegin(GL_QUADS);

    glVertex2f(-4.0,-1.0);
    glVertex2f(4.0,-1.0);
    glVertex2f(4.0,1.0);
    glVertex2f(-4.0,1.0);

    glEnd();

    drawNet(w,values,mode,neuron,neuron_increment);

    glfwSwapBuffers(w);
}
Example #3
0
void PongGame::draw() {
    drawNet();
    leftPaddle->draw();
    rightPaddle->draw();
    ball->draw();
    drawScore(leftScoreX, scoreY, leftScore);
    drawScore(rightScoreX, scoreY, rightScore);
}
Example #4
0
int main(int argc, char *argv[])
{
	setup();
	float lastFrameTicks = 0.0f;
	Entities.push_back(&leftPaddle);
	Entities.push_back(&rightPaddle);
	Entities.push_back(&leftGoal);
	Entities.push_back(&rightGoal);
	Entities.push_back(&ball);
	Entities.push_back(&topWall);
	Entities.push_back(&bottomWall);
	glMatrixMode(GL_PROJECTION);;
	glOrtho(-1.33, 1.33, -1.0, 1.0, -1.0, 1.0);
	ball.setDirection_x(1);
	ball.setDirection_y(0);
	Mix_Chunk* hitBlip;
	hitBlip = Mix_LoadWAV("blip.wav");
	Mix_Chunk* wallBlip;
	wallBlip = Mix_LoadWAV("bounce.wav");
	bool done = false;
	Mix_Chunk* scoreSound;
	scoreSound = Mix_LoadWAV("score.wav");
	Mix_Music* music;
	music = Mix_LoadMUS("Jumpshot.mp3");
	Mix_PlayMusic(music, -1);
	
	SDL_Event event;

	while (!done) {
		while (SDL_PollEvent(&event)) {
			if (event.type == SDL_QUIT || event.type == SDL_WINDOWEVENT_CLOSE) {
				done = true;
			}
		}
		float ticks = (float)SDL_GetTicks() / 1000.0f;
		float elapsed = ticks - lastFrameTicks;
		lastFrameTicks = ticks;
		glClear(GL_COLOR_BUFFER_BIT);
		processEvents(&leftPaddle, &rightPaddle);
		wallCollisionCheck(&ball, &topWall, &bottomWall, wallBlip);
		goalCollisionCheck(&ball, &leftGoal, &rightGoal, scoreSound);
		paddleCollisionCheck(&ball, &leftPaddle, &rightPaddle, hitBlip);
		update(elapsed, Entities);
		draw(Entities);
		drawNet();
		SDL_GL_SwapWindow(displayWindow);
	}

	SDL_Quit();
	return 0;
}
Example #5
0
	void EditorTrack::onDraw(CL_GraphicContext &p_gc)
	{
		drawNet(p_gc);
		drawTrack(p_gc);
	}
Example #6
0
/* metoda care traseaza terenul */
void Field::markField() {
	drawNet();
	drawBoarders();
	drawField();
	cs_used.push_back(cs);
}