www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/11/02/12:55:04

Message-Id: <199811021754.RAA28177@relay.clara.net>
From: "Arthur" <arfa AT clara DOT net>
To: <djgpp AT delorie DOT com>
Subject: RE: hope iam in the right place
Date: Mon, 2 Nov 1998 17:49:54 -0000
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0
Importance: Normal
In-Reply-To: <35C434F4.105C@pacbell.net>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Reply-To: djgpp AT delorie DOT com

> could you look at this code for me please..

I've reformatted it a bit so you can actually see what you're doing.

> 	     //thank you for looking at this..
> 	       // #1, no sound, but it should work
>            // #2,  why do i need 2 of the }, at the end.
>            // #3, is the KEY_UP, right
>            // --- there all close to the bottom
>            // --- thank's again
> 	//-----------------------------------------
>
>#include <stdlib.h>
>#include <stdio.h>
>#include <allegro.h>
>
>char buf[80];

You don't use this?

>int main (char *argv[])
>{
>     SAMPLE *shoot ;
>
>     allegro_init();
>     install_keyboard();
>     install_mouse();
>     install_timer();
>     set_gfx_mode(GFX_VGA, 320, 200, 100,0);

For all of the above, you should check for failures! Also, why have you got
a 100x0 virtual screen on a 320x200 screen?

>     set_pallete(desktop_pallete);
> 	fade_in (desktop_pallete,1);

Why do you need the set_palette() command, since you fade in to that palette
in the next command?

>     putpixel (screen, 7,20,7);
>     vline(screen,80,25,50,1);
>  // fade_out (1);
>     vline(screen,100,25,50,6);
>
>     show_mouse (screen);
>     load_wav("shoot.wav");

This won't work - you're not telling Allegro where to load the sample.
SAMPLE* load_wav(char* filename); so you should use:
shoot=load_wav("shoot.wav");


>     while (!keypressed(KEY_UP));

This waits until you press the UP key. Is this right?

>     if(install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, argv[0]) != 0)
>     {
>           play_sample(shoot, 62, 192, 1000, 1);
>           while (KEY_UP);

This line does absolutely nothing, since KEY_UP is not zero.

>           play_sample(shoot, 62, 192, 1000, 1);

>           return 0;

Hang on, you havn't closed the bracked for the if statement yet...

>     //---------------------------------
> }              //--#3 why do i need 2 of these ..
> }

One to close the if... statement, one to close the main() statement.

Most of these errors would have been avoided if you had formatted your work
properly so you can see what you are doing wrong. Believe the experts when
they say that you should produce tidy code.

James Arthur
jaa AT arfa DOT clara DOT net
ICQ#15054819


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019