Ejemplo n.º 1
0
void draw_numeral( int x, int y, int n, int height, int width) {
	switch(n) {	
		case 1:
			draw_one(x, y, height, width) ;
			break ;
		case 2:
			draw_two(x, y, height, width) ;
			break ;
		case 3:
			draw_three(x, y, height, width) ;
			break ;
		case 4:
			draw_four(x, y, height, width) ;
			break ;
		case 5:
			draw_five(x, y, height, width) ;
			break ;
		case 6:
			draw_six(x, y, height, width) ;
			break ;
		case 7:
			draw_seven(x, y, height, width) ;
			break ;
		case 8:
			draw_eight(x, y, height, width) ;
			break ;
		case 9:
			draw_nine(x, y, height, width) ;
			break ;
		case 0:
			draw_zero(x, y, height, width) ;
			break ;
	}
}
Ejemplo n.º 2
0
void draw_ten(int x, int y, int height, int width) {
	//draw 1
	draw_one(x, y, height, width/2) ;
	//draw 0
	draw_zero(x+width, y, height, width/2) ;	
	
}
Ejemplo n.º 3
0
int main (void)
{
	int xSize=600, ySize=600, xMouse, yMouse, j;
	float h=100;
	char c;
	
	gfx_open(xSize, ySize, "Window");
	
	while (1)
	{
		c = gfx_wait();
	
		xMouse = gfx_xpos();
		yMouse = gfx_ypos();

		switch (c)
		{
			case '0':
				draw_zero(xMouse, yMouse, h);
				break;
			case '1':
				draw_one(xMouse, yMouse, h);
				break;
			case '2':
				draw_two(xMouse, yMouse, h);
				break;
			case '3':
				draw_three(xMouse, yMouse, h);
				break;
			case '4':
				draw_four(xMouse, yMouse, h);
				break;
			case '5':
				draw_five(xMouse, yMouse, h);
				break;
			case '6':
				draw_six(xMouse, yMouse, h);
				break;
			case '7':
				draw_seven(xMouse, yMouse, h);
				break;
			case '8':
				draw_eight(xMouse, yMouse, h);
				break;
			case '9':
				draw_nine(xMouse, yMouse, h);
				break;
			case '-':
				h = h/2;
				break;
			case '=':
				h = h*2;
				break;
			case 'q':
				return 0;
		}
	
	}	
	return 0;
}
Ejemplo n.º 4
0
/*F******************************************************************
 * draw_digit(float x_position, float y_position, unsigned int digit, float size)
 * 
 * PURPOSE : Draws the specified digit to the specified coordinates
 *           at the specified size
 *
 * RETURN :  void
 *
 * NOTES :   
 *F*/
void draw_digit(float x_position, float y_position, unsigned int digit, float size) {

  glClearColor(255, 255, 255, 1);
  glClear(GL_COLOR_BUFFER_BIT);
  glBegin(GL_LINES);
  
  switch(digit) {

  case 0:
    draw_zero(x_position, y_position, size);
    return;

  case 1:
    draw_one(x_position, y_position, size);
    return;

  case 2:
    draw_two(x_position, y_position, size);
    return;

  case 3:
    draw_three(x_position, y_position, size);
    return;

  case 4:
    draw_four(x_position, y_position, size);
    return;

  case 5:
    draw_five(x_position, y_position, size);
    return;

  case 6:
    draw_six(x_position, y_position, size);
    return;

  case 7:
    draw_seven(x_position, y_position, size);
    return;

  case 8:
    draw_eight(x_position, y_position, size);
    return;

  case 9:
    draw_nine(x_position, y_position, size);
    return;

  default:
    return;
  }

    glEnd();
    glutSwapBuffers();
}