示例#1
0
void    strip_h(int nb, char *name, t_infocube *infos, float percent)
{
  t_color	c;
  float start_y;
  float size[2];
  float x;
  float y;
  float z;

  c.color = color(nb);
  glColor3ub((c.rgb)[0], (c.rgb)[1], (c.rgb)[2]);
  start_y = nb * (infos->size * (4.0 / 100.0)) + (nb) *
    (infos->size * (20.0 / 100));
  size[0] = infos->size * percent;
  size[1] = infos->size * (20.0 / 100);
  x = infos->x + infos->size;
  y = infos->y + infos->size - start_y;
  z = infos->z - infos->size - 1;
  draw_h(x, y, z, size);
  printscreen(name, x - 1 - infos->size, y + 0.8, z);
  printscreen(name, x + 1, y + 0.8, infos->z);
  glColor3ub((c.rgb)[0], (c.rgb)[1], (c.rgb)[2]);
  x = infos->x + infos->size;
  y = infos->y + infos->size - start_y;
  z = infos->z + 1;
  draw_h(x, y, z, size);
}
示例#2
0
// Callback function called when a normal key is pressed.
void cbKeyPressed(unsigned char key, int x, int y )
{
    switch (key) {
    case 113:
    case 81:
    case 27: // Q (Escape) - We're outta here.
        glutDestroyWindow(Window_ID);
        exit(1);
        break; // exit doesn't return, but anyway...
    /*
      case 130: case 98: // B - Blending.
         Blend_On = Blend_On ? 0 : 1;
         if (!Blend_On)
            glDisable(GL_BLEND);
         else
            glEnable(GL_BLEND);
         break;
    */
    case 108:
    case 76:  // L - Lighting
        Light_On = Light_On ? 0 : 1;
        Alpha_Add = Alpha_Add ? 0 : 1;
        break;

    case 109:
    case 77:  // M - Mode of Blending
        Render_mode++;
        Render_mode = Render_mode % 5;
        break;
    /*
       case 116: case 84: // T - Texturing.
          Texture_On = Texture_On ? 0 : 1;
          break;

       case 97: case 65:  // A - Alpha-blending hack.
          Alpha_Add = Alpha_Add ? 0 : 1;
          break;

       case 102: case 70:  // F - Filtering.
          Filtering_On = Filtering_On ? 0 : 1;
          break;
    */
    case 112:
    case 80:  // P - printscreen
        printscreen();
        break;

    case 115:
    case 83:
    case 32:  // S - change state
        state = state ? 0 : 1;
        break;

    case 114:
    case 82:  // R - reset view
        X_Rot   = 90.0f;
        Y_Rot   = 0.0f;
        Z_Rot   = 0.0f;
        Z_Off   = -70.0f;
        X_Cam   = 0.0f;
        Y_Cam   = 0.0f;
        break;

    case 111:
    case 79:  // O - toggle text
        Text_on = Text_on ? 0 : 1;
        break;

    case 120:
    case 88:  // X - extra speed
        if (offset_on == 1)
        {
            offset *= offset_delta;
            offset_on = 0;
            offset_off = 1;
        }
        else
        {
            offset /= offset_delta;
            offset_on = 1;
            offset_off = 0;
        }
        break;

    case 105:
    case 73:  // i - macro movie capture plus
        offset += 0.001f;
        printscreen();
        break;

    case 117:
    case 85:  // u - macro movie capture negative
        offset -= 0.001f;
        printscreen();
        break;

    case 121:
    case 89:  // y - macro rotate capture plus
        rotate_offset += 5.0f;
        Z_Rot = 180.0 * rotate_offset/Window_Height - 90.0;
        printscreen();
        break;

    case 116:
    case 84:  // t - macro rotate capture negative
        rotate_offset -= 5.0f;
        Z_Rot = 180.0 * rotate_offset/Window_Height - 90.0;
        printscreen();
        break;

    default:
        printf ("KP: No action for %d.\n", key);
        break;
    }
}
long add2(int n, int m){
   printscreen("Helloworld");
   return n+m;
}
示例#4
0
int main(void)
{
	//#ifdef _DEBUG
	//_CrtSetDbgFlag(_crtDbgFlag|_CRTDBG_LEAK_CHECK_DF);
	//char* pDumMemoryLeak = new char[20];	
	//::mystrcpy(pDumMemoryLeak,"Dum Leak");
	//#endif
	int i=1;
	char buffer[LINE_MAX];
	char* command=buffer;  // check  command
	
	char tableindex[TABLE_MAX][TABLE_NAME_MAX]={0};  //Index of Table		
	Data*** database = (Data***)malloc(sizeof(Data**) * TABLE_MAX);  //Data 
	if(database == NULL) {printf("error in creating Table\n"); exit(1);}
	int j1=0;
	for(j1=0;j1<TABLE_MAX;j1++) database[j1] = NULL;  //Initialize every table to NULL
	Column** columnindex= (Column**) malloc( sizeof(Column*) * TABLE_MAX) ;  //Index of Column 
	if(database == NULL) {printf("error in creating Column\n"); exit(1);}
	int j2=0;
	for(j2=0;j2<TABLE_MAX;j2++) columnindex[j2] = NULL;  //Initialize every column to NULL
	printscreen();   //print screen 
	while(i)
	{
		printf("DB1=>");
		gets(buffer);
		command=buffer;
		while(isspace(*command)){command++;}//ignore ' '
		if(*(command)++!='-')
		{
			printf("command should be started by - \n");
			continue;
		}
		if(*command == 'c')  //create database
		{
			command++;
			while(isspace((*command))){command++;}//ignore ' '
			if(createtable(command,tableindex,columnindex,database) == 0)
				printf("Error in Initializing the table and create it!\n");
			else printf("Succeed in Initializing the table!\n");
			continue;
		}
		if(*command=='i')  // Import DB
		{
			command++;
			while(isspace((*command))){command++;}//ignore ' '
			int i=0;
			char tablename[TABLE_NAME_MAX];
			char filename[20];
			while(*command!=' ')
			{
				tablename[i++]=*(command++);
			}
			tablename[i]='\0';
			while(isspace((*command))){command++;}//ignore ' '
			i=0;
			while(*command!='\0')
			{
				filename[i++]=*(command++);
			}
			filename[i]='\0';
			printf("%d items has been imported\n", ImportTable(tablename,filename,tableindex,columnindex,database));
			continue;
		}
		if(*command=='s')
		{
			command++;
			while(isspace((*command))){command++;}///ignore ' '
			printf("------%d Items has been searched !--------------\n",tablesearch(command,tableindex,columnindex,database) );
			continue;
		}
		if(*command == 'u')  //ignore ' '
		{
			command++;
			while(isspace((*command))){command++;}///ignore ' '
			printf("-------%d Items has been updated!---------------\n",Updatetable(tableindex,columnindex,database,command));
			printf("The result is printed to the File 074090_update.txt \n");
			continue;
		}
		if(*command == 'd')  //delete DB
		{
			command++;
			while(isspace((*command))){command++;}///ignore ' '
			printf("-------%d Items has been Deleted!---------------\n",Deletetable(command,tableindex,columnindex,database) );
			printf("The result is printed to the File 074090_delete \n");
			continue;
		}
		if(*command == 'h')  //help
		{
			help();
			continue;
		}
		if(*command == 'q')  //Quit free Memrory
		{
			quit(database,columnindex,tableindex);
			break;
		}
		else
		{
			puts("Commands can't ben supported!\n");
		}

	}
	printf("\nThank you for using!");
	return 0;
}
// address: 0x80484e5
__size32 add1(__size32 param1) {
    printscreen("Helloworld");
    return param1 + 1;
}