Mail Archives: djgpp/1998/11/02/10:33:06
RaVeN <grommit AT pacbell DOT net> writes:
> could you look at this code for me please..
Sure, although it is very hard to read with the bizarre way that you
have indented it! Why not use some more conventional layout with all
the lines in sensible places?
> char buf[80];
Why declare this array, if you aren't then going to use it for
anything?
> int main (char *argv[]) {
That's not the right prototype for main(). This must either be
declared as int main(), or as int main(int argc, char *argv[]).
> set_gfx_mode(GFX_VGA, 320, 200, 100,0);
Where does the 100 bit come from? If you don't need a virtual screen,
the last two parameters should be zero. If you do need a large virtual
screen, these values must be larger than the physical screen
dimensions, and you must use some other driver than GFX_VGA.
> load_wav("shoot.wav");
> //------------ #1 how come i get no sound
You aren't doing anything with the return value from this load call,
so it just reads the sample into memory but then throws away the
result. You need to assign the loaded data to your pointer variable,
and should also check to make sure that this call has been
successful. See the ex17.c example program for a demo of loading
and playing samples.
> // --- #2 and KEY_UP, is it right
> while (!keypressed(KEY_UP));
Wrong: this should be while (!key[KEY_UP]), or more simply just
readkey(). See the ex5.c example program.
> while (KEY_UP);
Again wrong, for the same reasons as above.
> } //--#3 why do i need 2 of these ..
> }
Because that is how many you have opened earlier on! One for the
if (install_sound()) check, and one for the main() function itself.
Shawn Hargreaves.
- Raw text -