Example #1
0
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
	inicializaConfiguracion();
    	resize(laConfiguracion.anchuraPantalla,laConfiguracion.alturaPantalla);

	Bola::diametro = 100;//3 INICIALIZAR VARIABLE DE CLASE

	temporizador = new QTimer();
	temporizador->setInterval(laConfiguracion.intervaloAnimacion);
	temporizador->setSingleShot(false);
	connect(temporizador, SIGNAL(timeout()), this, SLOT(repintar()));
	temporizador->start();

	inicializarBolas(5,lasBolas);

	dialogoBolas = NULL;

	crearMenu();

	dialogoConf = new DialogoConfiguracion();
	
	connect(dialogoConf->sliderTamanyoBola, SIGNAL(valueChanged(int)), this, SLOT(cambiaTamanyoBola(int)));

	bolaUsuario = new Bola(600,600,0,0,10);

	dialogoSuperConfiguracion = NULL;
}
Example #2
0
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
    	resize(800,600);

	Bola::diametro = 100;

	temporizador = new QTimer();
	temporizador->setInterval(50);
	temporizador->setSingleShot(false);
	connect(temporizador, SIGNAL(timeout()), this, SLOT(repintar()));
	temporizador->start();

	inicializarBolas(5,lasBolas);
}
Example #3
0
/* Wait for the user to press a key or mouse button. */
char get_evento(){
	XEvent event;

	repintar();
	while(1) {
		XNextEvent(gfx_display,&event);

		if(event.type==KeyPress) {
			saved_xpos = event.xkey.x;
			saved_ypos = event.xkey.y;
			return XLookupKeysym(&event.xkey,0);
		} else if(event.type==ButtonPress) {
			saved_xpos = event.xkey.x;
			saved_ypos = event.xkey.y;
			return event.xbutton.button;
		}
	}
}
Example #4
0
//retorna 1 para evento de teclado e 2 para evento de mouse
//0 se não tem nenhum evento no buffer
int evento_aconteceu(){
       XEvent event;

       repintar();

       while (1) {
               if(XCheckMaskEvent(gfx_display,-1,&event)) {
                       if(event.type==KeyPress) {
                               XPutBackEvent(gfx_display,&event);
                               return 1;
                       } else if (event.type==ButtonPress) {
                               XPutBackEvent(gfx_display,&event);
                               return 2;
                       } else {
                               return 0;
                       }
               } else {
                       return 0;
               }
       }
}
Example #5
0
int get_texto(char s[]){
	int c;
	static int tam = 0;//tamanho atual da string, variavel persistente
	static int novo = 1;//bool pra dizer se nova chamada da funcao
	static int fim = 0;//bool pra dizer se apertou enter, persistente
	static char cor_backup; //para apagar o char se backspace
	static int shift_pressionado = 0;
	static int xgt;//posicoes iniciais do plotador no inicio
	static int ygt;
	
	if(novo == 1){//nova chamada de get_texto();
		novo = 0;
		fim = 0; 
		cor_backup = cor_;
		xgt = xa_;
		ygt = ya_;
		tam = 0;
	} 
	else{//carregar contexto
		xa_ = xgt + xf_*10*tam;
		ya_ = ygt;
	}
	
	sublinhar_atual(cor_);
	c = get_evento();//enter =13, backspace = 8;
	if ( c==13 ){
		fim = 1;
	}
	else if(c==-30 || c ==-31){
		shift_pressionado = 1;
		printf("shift pressionado %d\n", shift_pressionado);
	}
	else if (c>=32 && c<=127){//char imprimivel
		
		sublinhar_atual(fundo_);//apaga sublinhado atual
		
		if((c>=(int)'a' && c<=(int)'z') && shift_pressionado){
			c = (char)(c-('a'-'A'));
			shift_pressionado = 0;
		}
		s[tam]=(char) c;
		dtexto("%c", (char)c);
				
		sublinhar_atual(cor_);
		repintar();
		
		s[tam+1]='\0';//cada retorno da funcao ja eh uma substring
		tam++;
	}
	else if(c == 8 && tam >  0){
			tam--;
			xa_ = xa_ - 10 * xf_;
			set_cor( fundo_ );
			dtexto("%c", s[tam]);
			sublinhar_atual( fundo_ );
			set_cor(cor_backup);
			s[tam]='\0';
			//a funcao de escrever o texto apagando incrementou xa_
			//por isso devemos decrementar novamente
			xa_ = xa_ - 10 * xf_;
	}

	if(fim){//enter foi digitado
		sublinhar_atual(fundo_);
		s[tam]='\0';
		novo = 1;
		return 1;
	}
	return 0;
}
Example #6
0
void nkMenuTool::replegarMenu(void){
	if (estaDeplegado()){
		prv_desplegado = false;
		repintar();
	}
}
Example #7
0
void nkMenuTool::desplegarMenu(void){
	if (!estaDeplegado()){
		prv_desplegado = true;
		repintar();
	}
}
Example #8
0
void nkMenuTool::insertarTool(nkTool* un_tool){
	prv_listaTool.Append(un_tool);
	repintar();
}