Exemple #1
0
	void print_date(int yPos) {
		for(int x = 0; x<128; x++) {
			for(int y=yPos; y<yPos+18; y++ ){
				reset_pixel(x,y);
			}
		}
		/*int dayWidth = get_dayWidth();
		int monthWidth = get_monthWidth();
		int dateWidth = dayWidth + monthWidth + 6; //6=Punkt + Leerzeichen
		int xPosDate = (127 - dateWidth) / 2 + 1;*/
		int xPosDate = get_dateXPos();
		
		if ((yPos == POS_DATE_STD) && (day==14) && (month==1)){
			uint8_t roseSymb[90];
			for(int i=0; i<90; i++){
				roseSymb[i] = pgm_read_byte(&rose[0][i]);
			}
			print_symbol(16, 45, roseSymb, (127 - ROSE_WIDTH) / 2 + 1, POS_DATE_STD);
		} else if ((yPos == POS_DATE_STD) && (day==4) && (month==7)) {
			int spruch [11];
			convertString("Alles Liebe", spruch);
			int xSpruch = (127 - get_stringWidth(spruch, 11)) / 2 + 1;
			print_ASCIIString(xSpruch, POS_DATE_STD, spruch, 11);
			uint8_t herzSymb[32];
			for(int i=0; i<32; i++){
				herzSymb[i] = pgm_read_byte(&herz[0][i]);
			}
			print_symbol(16, 16, herzSymb, xSpruch - 16 - 4, POS_DATE_STD);
			print_symbol(16, 16, herzSymb, xSpruch + get_stringWidth(spruch, 11) + 4, POS_DATE_STD);
		} else {
			print_day(xPosDate, yPos);	//Tag
			print_letter(alphaHeight, pgm_read_byte(&alphaWidth[54]), 54, xPosDate + get_dayWidth() + 1, yPos); //Punkt
			print_month(xPosDate + get_dayWidth() + 6, yPos); //Monat ..+6=Punkt+Leerzeichen
		}
	}
Exemple #2
0
int				get_key(t_env *env_list, t_cmd_path *cmds,
		t_hist *history, char *key)
{
	t_hist		*tmp;
	int			i;

	i = 0;
	while (read(0, key, 15))
	{
		if (is_arrow(key))
			i = press_arrow(key[2], history, &tmp, i);
		else if (is_enter(key))
		{
			history = press_enter(env_list, history);
			tmp = history->next;
			i = 0;
		}
		else if (is_delete(key))
			press_delete();
		else if (key[0] > 30)
			print_letter(key);
		else if (key[0] == 9 && key[1] == 0 && key[2] == 0)
			autocomplete(cmds);
		else
			is_special_action(key);
		ft_bzero(key, 15);
	}
	return (0);
}
Exemple #3
0
/** for each letter in string argument,
 *  prints letter and ASCII integer code
 */
void print_letters(char arg[], int length)
{
    int i = 0;
    for (i = 0; i < length; i++) {
        print_letter(arg[i]);
    }
    printf("\n");
}
Exemple #4
0
int	type_o(t_data *data)
{
  if (data->message.indice < MAX_CHAT_MSG - 1)
    {
      data->message.msg[data->message.indice] = 'o';
      data->message.indice++;
      print_letter(data, "o");
    }
  return (0);
}
Exemple #5
0
int	type_question(t_data *data)
{
  if (data->message.indice < MAX_CHAT_MSG - 1)
    {
      data->message.msg[data->message.indice] = '?';
      data->message.indice++;
      print_letter(data, "?");
    }
  return (0);
}
Exemple #6
0
int	type_brackets_close(t_data *data)
{
  if (data->message.indice < MAX_CHAT_MSG - 1)
    {
      data->message.msg[data->message.indice] = ']';
      data->message.indice++;
      print_letter(data, "]");
    }
  return (0);
}
Exemple #7
0
void print_word(char *word, int iline){
	//printf("DEBUG: im in print_word/n");
	int len =  mystrlen(word);
	//printf("first word is in length: %d\n",len);
	
	int i;
	for(i=0; i<len; ++i){
	  print_letter(word[i], iline);
	  
	}
}
Exemple #8
0
void print_ASCIIString(int xStart, int yPos, int* string, int size){
	int tempXPos = xStart;
	for(int i=0; i<size; i++){
		if(string[i] < 0 ){//Leerzeichen
			tempXPos += 3;
		} else {
			print_letter(alphaHeight, pgm_read_byte(&alphaWidth[string[i]]), string[i], tempXPos, yPos);
			tempXPos+=pgm_read_byte(&alphaWidth[string[i]])+1;
		}
	}
	
}
Exemple #9
0
void MISSISSIPPI()
{
	INT word[4];
	INT m[4];
	INT i0, i1, i2, i3, i, cnt = 0;
	
	
	for (i0 = 0; i0 < 4; i0++) {
		word[0] = i0;
		for (i1 = 0; i1 < 4; i1++) {
			word[1] = i1;
			for (i2 = 0; i2 < 4; i2++) {
				word[2] = i2;
				for (i3 = 0; i3 < 4; i3++) {
					word[3] = i3;
					for (i = 0; i < 4; i++) {
						m[i] = 0;
						}
					for (i = 0; i < 4; i++) {
						m[word[i]]++;
						}
					if (m[0] > 1)
						continue;
					if (m[1] > 2)
						continue;
					INT_vec_quicksort_decreasingly(m, 4);
					if (m[0] != 2)
						continue;
					if (m[1] != 2)
						continue;
					
					cnt++;
					cout << setw(5) << cnt << " & ";
					for (i = 0; i < 4; i++) {
						print_letter(word[i]);
						}
					cout << "\\\\" << endl;
					}
				}
			}
		}
}
Exemple #10
0
	void print_month(int xPos, int yPos) {
		int tempXPos = xPos;
		int tempYPos = yPos;
		int tempLetter;		
		for (int i=0; i<maxMonthLength; i++) {
			tempLetter = pgm_read_byte(&months[month][i]);
			if (tempLetter<54) {
				if((tempLetter == 6) || (tempLetter == 15) || (tempLetter == 16) || (tempLetter == 24)) {
					tempYPos = yPos + 1;
				} else {
					tempYPos = yPos;
				}
				if(tempLetter == 1) {
					tempXPos --;
				}
				print_letter(alphaHeight, pgm_read_byte(&alphaWidth[tempLetter]), tempLetter, tempXPos, tempYPos);
				tempXPos+=pgm_read_byte(&alphaWidth[tempLetter])+1;
			}
		}
	}
Exemple #11
0
int main() {
  srand((unsigned) time(NULL));
  
  printf("LIBRARY\n");
  printf("=======\n");
  add_song(table, "hello", "adele");
  add_song(table, "arabella", "arctic monkeys");
  add_song(table, "formation", "beyonce");
  add_song(table, "sorry", "beyonce");
  add_song(table, "cardiac arrest", "bad suns");
  add_song(table, "summer", "calvin harris");
  add_song(table, "closer", "the chainsmokers");
  print_library(table);
  printf("\n");
  
  printf("searching for \'closer - the chainsmokers\'\n");
  printf("===========================================\n");
  song_node *findSong = find_song(table, "closer", "the chainsmokers");
  if (findSong) printf("found %s - %s\n", findSong->name, findSong->artist);
  printf("\n");
  
  printf("searching for \'kids - mgmt\'\n");
  printf("=============================\n");
  song_node *findSong2 = find_song(table, "kids", "mgmt");
  if (findSong2) printf("found %s - %s\n", findSong2->name, findSong2->artist);
  printf("\n");
    
  printf("searching for adele\n");
  printf("===================\n");
  song_node *findArtist = find_artist(table, "adele");
  if (findArtist) print_list(findArtist);
  printf("\n");
  
  printf("searching for akmu\n");
  printf("===================\n");
  song_node *findArtist2 = find_artist(table, "akmu");
  if (findSong2) print_list(findArtist2);
  printf("\n");
  
  printf("print \'b\'\n");
  printf("===========\n");
  print_letter(table, "b");
  printf("\n");
  
  printf("print beyonce\n");
  printf("=============\n");
  print_artist(table, "beyonce");
  printf("\n");
  
  printf("print entire library\n");
  printf("====================\n");
  print_library(table);
  printf("\n");
  
  printf("shuffle and list three songs\n");
  printf("============================\n");
  shuffle(table, 3);
  printf("\n");
  
  printf("deleting a song\n");
  printf("===============\n");
  printf("deleting \'summer - calvin harris\'\n");
  delete_song(table, "summer", "calvin harris");
  print_library(table);
  printf("\n");
  
  printf("deleting everything (FAULTY)\n");
  printf("============================\n");
  delete_all(table);
  print_library(table);
}