Ejemplo n.º 1
0
void Model::loadObj(const char *filename, float scale) {
  ObjModel *model;

  model = objLoad(filename);
  if (!model) {
    return;
  }

  // Scale it properly
  objScale(model, scale);

  modelBox = objGenerateBox(model);

  startList();
  objDraw(model);
  glEndList();

  loaded = true;
}
Ejemplo n.º 2
0
/*
 * Remove any pointer.
 */
DList* freeListChar(DList* list, char ch) {

	if ( emptyList(list) )
		return list;

	DList* aux = list;
	DList* aux2;

	/* If his next value is the same address as list, it has just one register
	 * and if the char is the same as the char inside the list, it's the
	 * value we need to free from memory.
	 * */
	if ( aux->data == ch && aux->next == list ) {
		list = startList();
		free(aux);

	} else if ( aux->data == ch && aux->next != list ) { // Check if it is the first element of the list.
		aux2 = list;
		do {
			aux2 = aux2->next;
		} while ( aux2->next != list ); // Finds the last register of the list.

		list = list->next; // Changes the list address

	// Removing any other char
	} else {

		do {
			// Checks the data value of next pointer.
			if ( aux->next->data == ch ) {
				// The auxiliary list receive the next pointer of the list.
				aux2 = aux->next;
				// The current pointer gets the next pointer of the following auxiliary pointer.
				aux->next = aux2->next; // Or use aux->prox->prox
				// Frees the data in memory of value selected.
				free(aux2);
			} else {
				aux = aux->next;
			}
		} while ( aux->next != list );
	}
	return list;
}
Ejemplo n.º 3
0
int main(){
    sFila f;
    FILE * fd;
    
    int option;
    int id;
    int cont = 0;
    
    unsigned short int whiler = 0;

    startList(&f);
    while(whiler == 0){
        option = menu();
        switch(option){
            case 1:{
                registerToList(&f);
                break;
            }case 2:{
                printf("\n");
                printf("\t-==[Type the id]==-\n");
                printf("\t-==[ID: ]==-\n");
                move(16, 13);
                scanf("%d", &id);
                search(&f, id);
                wait();
                break;
            }case 3:{
                escritor(&f, fd);
                break;
            }case 4:{
                recover(&f, fd);
                break;
            }case 5:{
                whiler = 1;
             break;
            }default: whiler = 1; break;
        }
    }
    listFree(&f);
    return 0;
}
Ejemplo n.º 4
0
int main(void) {

	DList* mainList;
	mainList = startList(); // Starts the list with NULL value

	mainList = insertChar(mainList, 'C');
	//mainList = insertChar(mainList, 'H');
	//mainList = insertChar(mainList, 'E');
	//mainList = insertChar(mainList, 'R');
	//mainList = insertChar(mainList, 'R');
	//mainList = insertChar(mainList, 'Y');

	printList(mainList);

	mainList = freeListChar(mainList, 'C');

	printf("Remove: \n");
	printList(mainList);

	return EXIT_SUCCESS;
}
Ejemplo n.º 5
0
//
// startList -- const char * version
//
void XHTMLR::startList(const char *key){
	
	std::string k(key);
	startList(k);
	
}