[AGDev-newbies] menu sound error
Thomas Ward
tward1978 at earthlink.net
Sat Jun 17 00:40:59 BST 2006
Hi, Richard.
I am sorry to say, but the code below has me stumped. For one thing it
is not at all like the way I write my menus, and much less like how I
acquire data from the keyboard.
I could in theory write you a Menu program in C++, but I doubt it would
help you much since I use Microsoft's Visual C++ compiler, and not the
bloodshed and other free compilers.
If you have not already done so I highly suggest grabbing a free copy of
MS Visual C++ Express 2005
which is a superior Windows compiler to the one you are using.
The only catch22, and I expect this is the case, your class has taught
you nothing of Win32 API programming which is esentual for writing high
quality, killer, awesome, cool games for MS Windows.
Smile.
Richard Bennett wrote:
> Hey List, I am sorry for posting to this list so much recently, but I
> am just trying to get some menus or actually a single menu to work. I
> have posted the code below that deals with the menus. The problem is
> that it compiles fine with no errors, plays the first sound which a
> question asking do you want to play, then it will play the second
> sound which is "select the option you want", but then it stops running
> and carries me back to my IDE. I don't understand why this is and must
> have a while loop or something in the wrong area, but can't figure out
> where it should go if indeed I do have it in the wrong place. Can
> someone help? All I am trying to do is learn how to do menus, and I
> think this is the final step in me learning this, but so far, I am
> stuck in this area. Any help will be appreciated.
> BEAN
> *** code here***
> /* select menu option */
> void SelectMenuOption()
> {
> while(key[KEY_ENTER])
> {
> if(g_menu == g_answer)
> {
> if(g_location == 1)
> {
> allegro_message("This would be the yes
> module");
> }
> if(g_location == 2)
> {
> allegro_message("This would
> be the no module");
> }
> }
> }
> }
>
> /* speak the menu option */
> void SpeakMenuOption()
> {
> if(g_menu == g_answer)
> {
>
> if(g_location == 0)
> {
>
> play_sample(sounds[MENUCHOICE], VOLUME, PAN, PITCH, FALSE);
>
> rest(4000);
> }
>
> if(g_location == 1)
> {
> play_sample(sounds[YESANSWER], VOLUME, PAN, PITCH, FALSE);
> rest(2000);
> }
> if(g_location == 2)
> {
> play_sample(sounds[NOANSWER], VOLUME, PAN, PITCH, FALSE);
> rest(2000);
> }
> }
> }
>
>
> /* menu down module */
> void MenuDown()
> {
> g_location=g_location + 1;
> while(key[KEY_DOWN])
> {
>
> if(g_menu == g_answer && g_location >2)
> {
> g_location=1;
> }
> SpeakMenuOption();
> }
> }
>
> /* menu up module */
> void MenuUp()
> {
> while(key[KEY_UP])
> {
> g_location=g_location -1;
> if(g_menu == g_answer && g_location < 1)
> {
> g_location =2;
> }
> SpeakMenuOption();
> }
> }
>
> /* open first question */
> void OpenFirst()
> {
> g_menu=g_answer;
> g_location=0;
> SpeakMenuOption();
> }
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> AGDev-newbies mailing list
> AGDev-newbies at lists.agdev.org
> http://lists.agdev.org/cgi-bin/mailman/listinfo/agdev-newbies
>
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.394 / Virus Database: 268.8.4/364 - Release Date: 6/14/2006
>
More information about the AGDev-newbies
mailing list