SBSPSS/source/paul/sndtest.cpp

174 lines
3.3 KiB
C++
Raw Normal View History

2001-07-19 20:47:40 +02:00
/*=========================================================================
2001-07-19 21:13:21 +02:00
sndtest.cpp
2001-07-19 20:47:40 +02:00
Author: PKG
Created:
Project: Spongebob
Purpose:
Copyright (c) 2000 Climax Development Ltd
===========================================================================*/
/*----------------------------------------------------------------------
Includes
-------- */
2001-08-04 20:42:27 +02:00
#if defined(__VERSION_DEBUG__)
2001-07-19 20:47:40 +02:00
2001-07-19 21:13:21 +02:00
#include "paul\sndtest.h"
2001-07-19 20:47:40 +02:00
#ifndef __GFX_FONT_H__
#include "gfx\font.h"
#endif
#ifndef __PAD_PADS_H__
#include "pad\pads.h"
#endif
#ifndef __PRIM_HEADER__
#include "gfx\prim.h"
#endif
2001-07-19 21:13:21 +02:00
#ifndef __SOUND_SOUND_H__
#include "sound\sound.h"
2001-07-19 20:47:40 +02:00
#endif
/* Std Lib
------- */
/* Data
---- */
/*----------------------------------------------------------------------
Tyepdefs && Defines
------------------- */
/*----------------------------------------------------------------------
Structure defintions
-------------------- */
/*----------------------------------------------------------------------
Function Prototypes
------------------- */
/*----------------------------------------------------------------------
Vars
---- */
2001-07-19 21:13:21 +02:00
CSceneSoundTest SoundTestScene;
2001-07-19 20:47:40 +02:00
2001-07-19 21:13:21 +02:00
static int s_soundId;
2001-07-19 20:47:40 +02:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-07-19 21:13:21 +02:00
void CSceneSoundTest::init()
2001-07-19 20:47:40 +02:00
{
2001-07-19 21:13:21 +02:00
m_font=new ("scene select font") ScalableFontBank();
2001-07-19 20:47:40 +02:00
m_font->initialise(&standardFont);
m_font->setJustification(FontBank::JUST_CENTRE);
m_font->setOt(10);
2001-07-19 21:13:21 +02:00
m_font->setScale(400);
2001-07-19 20:47:40 +02:00
2001-07-19 21:13:21 +02:00
s_soundId=0;
2001-07-19 20:47:40 +02:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-07-19 21:13:21 +02:00
void CSceneSoundTest::shutdown()
2001-07-19 20:47:40 +02:00
{
m_font->dump(); delete m_font;
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-07-19 21:13:21 +02:00
void CSceneSoundTest::render()
2001-07-19 20:47:40 +02:00
{
2001-07-19 21:13:21 +02:00
POLY_F4 *f4;
char buf[20];
f4=GetPrimF4();
setXYWH(f4,0,0,512,256);
setRGB0(f4,10,20,30);
AddPrimToList(f4,15);
sprintf(buf,"%d",s_soundId);
m_font->print(256,80,buf);
m_font->print(256,140,"UP/DOWN - Select");
m_font->print(256,160,"X - Play");
2001-07-19 20:47:40 +02:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-07-19 21:13:21 +02:00
void CSceneSoundTest::think(int _frames)
2001-07-19 20:47:40 +02:00
{
2001-07-19 21:13:21 +02:00
int padDown,padRepeat;
2001-07-19 20:47:40 +02:00
2001-07-19 21:13:21 +02:00
padDown=PadGetDown(0);
padRepeat=PadGetRepeat(0);
2001-07-19 20:47:40 +02:00
2001-07-19 21:13:21 +02:00
if(padRepeat&PAD_DOWN)
{
if(--s_soundId<0)
2001-07-19 20:47:40 +02:00
{
2001-07-19 21:13:21 +02:00
s_soundId=CSoundMediator::NUM_SFXIDS-1;
2001-07-19 20:47:40 +02:00
}
2001-07-19 21:13:21 +02:00
}
else if(padRepeat&PAD_UP)
{
if(++s_soundId==CSoundMediator::NUM_SFXIDS)
2001-07-19 20:47:40 +02:00
{
2001-07-19 21:13:21 +02:00
s_soundId=0;
2001-07-19 20:47:40 +02:00
}
}
2001-07-19 21:13:21 +02:00
if(padDown&PAD_CROSS)
{
CSoundMediator::playSfx((CSoundMediator::SFXID)s_soundId);
}
2001-07-19 20:47:40 +02:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-07-19 21:13:21 +02:00
int CSceneSoundTest::readyToShutdown()
2001-07-19 20:47:40 +02:00
{
2001-07-19 21:13:21 +02:00
return false;
2001-07-19 20:47:40 +02:00
}
2001-08-04 20:42:27 +02:00
#else
void SndTestSelTestDummyStub()
{
}
#endif
2001-07-19 20:47:40 +02:00
/*===========================================================================
end */