Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Using alert

Credits go to Ceagon Xylas for helping out!
This thread is locked; no one can reply to it. rss feed Print
Using alert
Dragonsoulj
Member #7,678
August 2006

I am trying to use an alert to choose between a full screen game or a windowed game. They are the same game, just uses different set_gfx_mode coding. I need to know how to use the results of the alert in an if-else statement (I can't figure out how to use the return values 1 or 2 in a test. I don't know how to retrieve the value returned). Here is my alert.

alert("'F'ull Screen or 'W'indowed?", NULL, NULL, "&Full Screen", "&Windowed", 'F', 'W');

Any help is appreciated.

~ Dragonsoulj

P.S. I forgot to mention, I am using C++.

Ceagon Xylas
Member #5,495
February 2005
avatar

I think this is what you were asking.

if(alert("'F'ull Screen or 'W'indowed?", NULL, NULL, "&Full Screen", "&Windowed", 'F', 'W')==1)
  set_gfx_mode(GFX_AUTODETECT_FULLSCREEN,640,480,0,0);
else
  set_gfx_mode(GFX_AUTODETECT_WINDOWED,640,480,0,0);

Or, if you want the value-specific else case

int aV=alert("'F'ull Screen or 'W'indowed?", NULL, NULL, "&Full Screen", "&Windowed", 'F', 'W');
if(aV==1)
  set_gfx_mode(GFX_AUTODETECT_FULLSCREEN,640,480,0,0);
else if(aV==2)
  set_gfx_mode(GFX_AUTODETECT_WINDOWED,640,480,0,0);

Dragonsoulj
Member #7,678
August 2006

Thanks, both of those help. I was trying to do it the second way, but I couldn't get the returned variable stored anywhere.

Go to: