You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
2.8 KiB
C++

#include <lowlevellib.h>
float xpos = 0;
float ypos = 0;
int os_main(int argc, char **argv, char **envp)
{
llgfx_SetDisplayMode(320,240,16,false);
llgfx_tab_chars[0] = '.';
llgfx_tab_pos[0] = 32;
llgfx_id background = llgfx_LoadGfx("l1bkgnd.png");
llsound_id musik = llsound_LoadSnd("theme3.ogg",LLSOUND_STREAM);
llsound_Play(musik,LLSOUND_LOOP);
llsound_id heli = llsound_LoadSnd("helicopter_1.wav");
llsound_id vol = llsound_LoadSnd("volume.wav");
llsound_id down = llsound_LoadSnd("down.wav");
llsound_id down_array[4];
down_array[0] = llsound_CloneSnd(down);
down_array[1] = llsound_CloneSnd(down);
down_array[2] = llsound_CloneSnd(down);
down_array[3] = llsound_CloneSnd(down);
int down_index=0;
llirq_ResetTime();
while(osmain_endgame==false){
float delta = llirq_GetDeltaTime();
if(background)
llgfx_TILE_BLIT(0,background,(xpos++)/16,(ypos++)/16);
else
llgfx_ClearScreen(BLUE);
llgfx_Printf("Sounddriver demo\n");
llgfx_Printf("Musik Pos:\t%f sec\n", llsound_GetSndPlaytime(musik) );
llgfx_Printf("Heli Pos:\t%f sec\n", llsound_GetSndPlaytime(heli) );
llgfx_Printf("Vol Pos:\t%f sec\n", llsound_GetSndPlaytime(vol) );
llgfx_Printf("\n");
int status = llsound_GetStatus(heli);
if( status == 0 )
llgfx_Printf("Heli=Stopped, press Key_A to play\n", llsound_GetSndPlaytime(heli));
else
llgfx_Printf("Heli=Resuming Playback, release Key_A to stop\n", llsound_GetSndPlaytime(heli));
if( Justdown(llinput_Keys[LLINPUT_KEY_A]) ){
llsound_Resume(heli,LLSOUND_LOOP,llsound_GetSndPlaytime(heli));
}
if( Justup(llinput_Keys[LLINPUT_KEY_A]) ){
llsound_Stop(heli);
}
// volume.wav
llgfx_Printf("\n");
if( Justdown(llinput_Keys[LLINPUT_KEY_B]) ){
llsound_Play(vol);
}
status = llsound_GetStatus(vol);
if( status == 0 )
llgfx_Printf("vol=Stopped, press Key_B to play\n", llsound_GetSndPlaytime(vol));
else
llgfx_Printf("vol=Playing\n", llsound_GetSndPlaytime(vol));
// down.wav
llgfx_Printf("\n");
if( Justdown(llinput_Keys[LLINPUT_KEY_X]) ){
llsound_Play( down_array[(down_index++)%4] );
}
int cnt = 4;
llgfx_Printf("Press Key_X to play one of down.wav\n");
while(cnt--)
{
llgfx_Printf("down[%d]\t%f\n",cnt,llsound_GetSndPlaytime(down_array[cnt]));
}
llgfx_Printf("\n");
llgfx_Printf("Musik sndlength\t%f secs\n",llsound_GetSndLength(musik));
llgfx_Printf("Heli sndlength\t%f secs\n",llsound_GetSndLength(heli));
llgfx_Printf("vol sndlength\t%f secs\n",llsound_GetSndLength(vol));
llgfx_Printf("Down sndlength\t%f secs\n",llsound_GetSndLength(down));
llgfx_sBLITFX blitfx;
blitfx.fixalpha = 0.5f;
llgfx_DrawText(" l3lib v1.0 - August 2006, GP2X Win32 Driver",BLIT_FXBLEND|BLIT_SRC_CKEY,&blitfx);
llgfx_FlipScreen(0);
llinput_Update();
llsound_Update();
}
return 0;
}