Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » gstream and mouse

This thread is locked; no one can reply to it. rss feed Print
gstream and mouse
swaroop
Member #11,524
December 2009

Hey guys. I ve a small problem with gstream and allegro's mouse controls. Whenever i use gstream i can't use the mouse controls. I m a complete newbie, so please tell me in simple terms what i m doing wrong
void simple()
{
int pos=20, x=20, y=20;
char one_line='\0';

for(int i=1,j=0;i<50 && j < 100; i++)
{


gs>>one_line;
gs<<flush;
if(i==49)
{
i=0;
j++;
gs<<endl;

}
if(mouse_b & 1)
j=100;
}
}
int main()
{



allegro_init();
set_color_depth(16);
set_gfx_mode(GFX_AUTODETECT,1440,900,0,0);

install_keyboard();
install_mouse();
show_mouse(screen);
buffer = create_bitmap(1440,900);
gs.set_bitmap(screen);

simple();
return 0;
}
END_OF_MAIN();

LennyLen
Member #5,313
December 2004
avatar

You're supposed to call install_timer() before calling install_mouse().

And please use <code></code> tags when you're posting code.

swaroop
Member #11,524
December 2009

Ok. Now i m able to click. Problem is, how do i know when exactly i have to click to terminate the loop?

GullRaDriel
Member #3,861
September 2003
avatar

I don't understand you question ???

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

swaroop
Member #11,524
December 2009

Ok see.
Thing is I m using gstream for keyboard input.
For example

char string[100];
for(int i=0;i<N;i++)
{ gs>>string[i];
   if(mouse_b &1)
    i=N;
}

This doesn't work.

Go to: