Beispiel #1
0
static void next_level()
{
    points++;
    food = getFood();

    if(snake.len < MAX_SNAKE_LEN-1)
        snake.len++;
    if(snake.speed > MAX_SPEED)
        snake.speed--;

    render_level();
}
Beispiel #2
0
void render() {
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  //Configurando el frustrum
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluPerspective(camera->aperture,(GLfloat)screen_width/(GLfloat)screen_height,1.0f,1000.0f);
	
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();


  gluLookAt(camera->position.x, camera->position.y, camera->position.z,
	    camera->center.x,   camera->center.y,   camera->center.z,
	    camera->up.x,       camera->up.y,       camera->up.z);

  /*
  //Rendering light point
  glPushMatrix();
  glDisable(GL_LIGHTING);
  glColor3f(0, 0.7, 0);
  glTranslatef(light_point->position[0], 
	      light_point->position[1],
	      light_point->position[2]);
  glutSolidSphere(0.1, 10, 10);
  glEnable(GL_LIGHTING);
  glPopMatrix();
  */
  glPushMatrix();
  glRotatef(surface->alphax,1.0,0.0,0.0);
  glRotatef(surface->alphaz,0.0,0.0,1.0);
 
	
  render_surface(surface);
  render_control_points(surface);
  render_ball(ball, surface);
  glPopMatrix();
  render_level();
  render_text();


  glFlush();
  glutSwapBuffers();
}
Beispiel #3
0
static void reset()
{
    int i;

    // setup the screen
    lcdClear();
    for (i=MIN_X; i<MAX_X; i++) {
        lcdSetPixel(i,MIN_Y,0b000101011);
        lcdSetPixel(i,MAX_Y,0b000101011);
    }

    for (i=MIN_Y; i<MAX_Y; i++) {
        lcdSetPixel(MIN_X,i,0b000101011);
        lcdSetPixel(MAX_X,i,0b000101011);
    }

    snake.speed = MIN_SPEED;
    snake.len = 3;
    snake.dir = 0;
    snake.t_start = 2;

    points = 0;

    food = getFood();

    // create snake in the middle of the field
    snake.tail[0].x = SIZE_X/2;
    snake.tail[0].y = SIZE_Y/2;
    snake.tail[1].x = SIZE_X/2 +1;
    snake.tail[1].y = SIZE_Y/2;
    snake.tail[2].x = SIZE_X/2 +2;
    snake.tail[2].y = SIZE_Y/2;

    // print initail tail
    draw_block(snake.tail[0].x, snake.tail[0].y, 0b00011000);
    draw_block(snake.tail[1].x, snake.tail[1].y, 0b00011000);
    draw_block(snake.tail[2].x, snake.tail[2].y, 0b00011000);

    // switch to level one
    render_level();
}
Beispiel #4
0
void Render::render(core::Level* plevel)
{
    float camera_min_x, camera_min_y, camera_max_x, camera_max_y, camera_zoom;
    get_camera_extents(
        camera_min_x, camera_min_y, camera_max_x, camera_max_y, camera_zoom);
    /* m_sp_logger->info("Camera Extents: min_x{} min_y{} max_x{} max_y{}", */
    /*     camera_min_x, */
    /*     camera_min_y, */
    /*     camera_max_x, */
    /*     camera_max_y); */
    m_up_renderer->clear();
    render_level(plevel,
        camera_min_x,
        camera_min_y,
        camera_max_x,
        camera_max_y,
        camera_zoom);
    render_entities(
        camera_min_x, camera_min_y, camera_max_x, camera_max_y, camera_zoom);
    m_up_renderer->present();
}