void UserInterfaceIngameGUI::draw(){
	drawgui();
	drawhealthbar();
	for(irr::u32 i=0;i<Buttons.size();i++){
		Buttons[i]->draw();
	}
}
Beispiel #2
0
/* jammer mode */
void jammermode(void){
	int c, x;
	currmode = PM_JAMMER;
	while(currmode == PM_JAMMER){
		if((c = getch()) != ERR) switch(c){
			case KEY_ESCAPE:
				currmode = PM_NORMAL;
				break;
			case '[':
				act_viewinstrdec();
				break;
			case ']':
				act_viewinstrinc();
				break;
			case '<':
				if(octave) octave--;
				break;
			case '>':
				if(octave < 8) octave++;
				break;
			default:
				x = freqkey(c);
				if(x) {
					//shouldn't have to use this if statement...grr...
					if(tune->type == LFT) tune->iedplonk(x, currinstr, tune);
					else if(tune->type == AHX) tune->iedplonk(x, currinstr, htTune);
				}
				break;
		}
		drawgui();
		usleep(10000);
	}
}
Beispiel #3
0
/* vi cmdline mode */
void cmdlinemode(void){
	u16 c;
	int len;
	keypad(stdscr, TRUE);

	currmode = PM_CMDLINE;
	strncat(cmdstr, ":", 100);
	for(;;){
		drawgui();

		c = nextchar();
		switch(c){
			case KEY_ESCAPE:
				//cmdstr = "";
				currmode = PM_NORMAL;
				goto end;
			case ENTER:
				_parsecmd(cmdstr);
				goto end;
#ifndef WINDOWS
			case BACKSPACE:
				setdisplay("\\o/");
				cmdstr[strlen(cmdstr)-1] = '\0';
				break;
#endif
			case '\t':
				break;
			default:
				len = strlen(cmdstr);
				cmdstr[len++] = c;
				cmdstr[len++] = '\0';
				break;
		}
	}
end:
	strcpy(cmdstr, "");
	keypad(stdscr, FALSE);
	return;
}
Beispiel #4
0
/* vi insert mode */
void insertmode(void){
	int c;
	currmode = PM_INSERT;
	drawgui();
	for(;;){
		if((c = getch()) != ERR) switch(c){
			case KEY_ESCAPE:
				currmode = PM_NORMAL;
				return;
			case 'h':
			case KEY_LEFT:
				act_mvleft();
				break;
			case 'j':
			case KEY_DOWN:
				act_mvdown();
				break;
			case 'k':
			case KEY_UP:
				act_mvup();
				break;
			case 'l':
			case KEY_RIGHT:
				act_mvright();
				break;
			/* change octave */
			case '<':
				if(octave) octave--;
				break;
			case '>':
				if(octave < 8) octave++;
				break;
			/* change instrument */
			case CTRL('J'):
				if(currtab == 2){
					act_viewinstrdec();
				}else if(currtab == 1){
					act_viewtrackdec();
				}
				break;
			case CTRL('K'):
				if(currtab == 2){
					act_viewinstrinc();
				}else if(currtab == 1){
					act_viewtrackinc();
				}
				break;
			case '[':
				act_viewinstrdec();
				break;
			case ']':
				act_viewinstrinc();
				break;
			case CTRL('H'):
				currtab--;
				if(currtab < 0)
					currtab = 2;
				break;
			case CTRL('L'):
				currtab++;
				currtab %= 3;
				break;
			case 'Z':
				c = nextchar();
				switch(c){
					case 'Z':
						lft_savefile(filename);
						erase();
						refresh();
						endwin();
						exit(0);
						break;
					case 'Q':
						erase();
						refresh();
						endwin();
						exit(0);
						break;
				}
				break;
			case ' ':
				silence();
				currmode = PM_NORMAL;
				return;
			case ENTER:
				if(currtab != 2){
					if(currtab == 1){
						silence();
						startplaytrack(currtrack);
					}else if(currtab == 0){
						silence();
						startplaysong(songy);
					}
				}
				break;
			case '`':
				if(currtab == 0){
					int t = tune->sng[songy].track[songx / 4];
					if(t) currtrack = t;
					currtab = 1;
				}else if(currtab == 1){
					currtab = 0;
				}
				break;
			default:
				_insertc(c);
				if(currtab == 1){
					tracky+=step;
					tracky %= (tune->tracklen);
				}else if(currtab == 2){
					//if(instry < instrument[currinstr].length-1) instry++;
					if(instrx < 2) instrx++;
					else instrx--;
					instry %= instrument[currinstr].length;
				}
				saved = 0;
		}
		drawgui();
		usleep(10000);
	}
}
Beispiel #5
0
/* visual line mode */
void visuallinemode(void){
	int c;
	int min, max;
	char buf[1024];

	currmode = PM_VISUALLINE;

	/* Store the current line as the first and last node of a linked list */
	if(currtab==0){
		highlight_firstline = songy;
		highlight_lastline = songy;
	}else if(currtab==1){
		highlight_firstline = tracky;
		highlight_lastline = tracky;
	}else if(currtab==2){
		highlight_firstline = instry;
		highlight_lastline = instry;
	}else{
		highlight_firstline = -1;
		highlight_lastline = -1;
	}

	// initialize difference
	highlight_lineamount = 1;

	// make it visible to gui.c
	//highlightlines = firstnode;

	while(currmode == PM_VISUALLINE){
		if((c = getch()) != ERR) switch(c){
			case 'V':
			case KEY_ESCAPE:
				currmode = PM_NORMAL;
				break;
			case 'v':
				visualmode();
			case 'h':
				act_mvleft();
				break;
			case 'j':
				act_mvdown();
				// update lastnode
				if(currtab==0){
					highlight_lastline = songy;
				}else if(currtab==1){
					highlight_lastline = tracky;
				}else if(currtab==2){
					highlight_lastline = instry;
				}
				// update the highlighted length
				highlight_lineamount = (highlight_firstline>highlight_lastline)?
						highlight_firstline - highlight_lastline +1
						: highlight_lastline - highlight_firstline +1;
				break;
			case 'k':
				act_mvup();
				// update lastnode
				if(currtab==0){
					highlight_lastline = songy;
				}else if(currtab==1){
					highlight_lastline = tracky;
				}else if(currtab==2){
					highlight_lastline = instry;
				}
				// update the highlighted length
				highlight_lineamount = (highlight_firstline>highlight_lastline)?
						highlight_firstline - highlight_lastline +1
						: highlight_lastline - highlight_firstline +1;
				break;
			case 'l':
				act_mvright();
				break;
			case 'g':
				if(nextchar() == 'g'){
					act_mvtop();
				}
				break;
			case 'G':
				act_mvbottom();
				break;
			// d: copy every line that is highlighted to the paste buffer and clear them, too
			case 'd':
				min = (highlight_firstline < highlight_lastline)?
						highlight_firstline
						: highlight_lastline;
				max = (highlight_firstline < highlight_lastline)?
						highlight_lastline
						: highlight_firstline;
				if(currtab == 0){
					for(int i=min; i<=max; i++)
						act_clrinsongtab(i);
				}else if(currtab == 1){
					for(int i=min; i<=max; i++)
						act_clrintracktab(currtrack, i);
				}else if(currtab == 2){
					for(int i=min; i<=max; i++)
						act_clrininstrtab(currinstr, i);
				}
				//snprintf(buf, sizeof(buf), "%d fewer lines", highlight_lineamount);
				//infinitemsg = buf;
				currmode = PM_NORMAL;
				break;
			// y: copy every line that is highlighted to the paste buffer
			case 'y':
				if(currtab == 0){
					//tcliplen = 1;
					//memcpy(&tclip, &tune->sng[songy], sizeof(struct songline)*highlight_lineamount);
					tcliplen = highlight_lineamount;
					//moved up, then yanked
					if(highlight_firstline > highlight_lastline){
						for(int i = 0; i < highlight_lineamount; i++)
							memcpy(&tclip[i], &tune->sng[songy+i], sizeof(struct songline));
					//moved down, then yanked
					}else if(highlight_lastline > highlight_firstline){
						for(int i = highlight_lineamount-1, j = 0; i >= 0; i--, j++){
								memcpy(&tclip[i], &tune->sng[songy-j], sizeof(struct songline));
						}
					}
				}else if(currtab == 1){
					tcliplen = highlight_lineamount;
					//moved up, then yanked
					if(highlight_firstline > highlight_lastline){
						for(int i = 0; i < highlight_lineamount; i++)
							memcpy(&tclip[i], &tune->trk[currtrack].line[tracky+i], sizeof(struct trackline));
					//moved down, then yanked
					}else if(highlight_lastline > highlight_firstline){
						for(int i = highlight_lineamount-1, j = 0; i >= 0; i--, j++){
								memcpy(&tclip[i], &tune->trk[currtrack].line[tracky-j], sizeof(struct trackline));
						}
					}
				}else if(currtab == 2){
					//icliplen = 1;
					//memcpy(&iclip, &instrument[currinstr].line[instry], sizeof(struct instrline)*highlight_lineamount);
					icliplen = highlight_lineamount;
					//moved up, then yanked
					if(highlight_firstline > highlight_lastline){
						for(int i = 0; i < highlight_lineamount; i++)
							memcpy(&iclip[i], &instrument[currinstr].line[instry+i], sizeof(struct instrline));
					//moved down, then yanked
					}else if(highlight_lastline > highlight_firstline){
						for(int i = highlight_lineamount-1, j = 0; i >= 0; i--, j++){
								memcpy(&iclip[i], &instrument[currinstr].line[instry-j], sizeof(struct instrline));
						}
					}
				}

				snprintf(buf, sizeof(buf), "%d lines yanked", highlight_lineamount);
				infinitemsg = buf;
				currmode = PM_NORMAL;
				break;
		}
		drawgui();

		// update the highlighted length
		/*highlight_lineamount = (highlight_firstline>highlight_lastline)?
				highlight_firstline - highlight_lastline +1
				: highlight_lastline - highlight_firstline +1;
				*/
	}
	highlight_firstline = -1;
	highlight_lastline = -1;

	return;
}
Beispiel #6
0
/* visual mode */
void visualmode(void){
	int c;

	currmode = PM_VISUAL;
	//attrset(A_REVERSE);
	if(currtab == 0){
	}else if(currtab == 1){
		highlight_firstx = trackx;
		highlight_lastx = trackx;
		highlight_firsty = tracky;
		highlight_lasty = tracky;
	}else if(currtab == 2){
	}else{
		highlight_firstx = -1;
		highlight_lastx = -1;
		highlight_firsty = -1;
		highlight_lasty = -1;
	}

	while(currmode == PM_VISUAL){
		if((c = getch()) != ERR) switch(c){
			case 'v':
			case KEY_ESCAPE:
				currmode = PM_NORMAL;
				break;
			case 'V':
				visuallinemode();
				break;
			case 'h':
				act_mvleft();
				if(currtab==0){
				}else if(currtab==1){
					highlight_lastx = trackx;
				}else if(currtab==2){
				}
				break;
			case 'j':
				act_mvdown();
				if(currtab==0){
				}else if(currtab==1){
					highlight_lasty = tracky;
				}else if(currtab==2){
				}
				break;
			case 'k':
				act_mvup();
				if(currtab==0){
				}else if(currtab==1){
					highlight_lasty = tracky;
				}else if(currtab==2){
				}
				break;
			case 'l':
				act_mvright();
				if(currtab==0){
				}else if(currtab==1){
					highlight_lastx = trackx;
				}else if(currtab==2){
				}
				break;
		}
		drawgui();
	}
	attrset(A_BOLD);
	return;
}