2000-09-12 01:52:04 +02:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
paul.cpp
|
|
|
|
|
|
|
|
Author: PKG
|
|
|
|
Created:
|
|
|
|
Project: Spongebob
|
|
|
|
Purpose:
|
|
|
|
|
|
|
|
Copyright (c) 2000 Climax Development Ltd
|
|
|
|
|
|
|
|
===========================================================================*/
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Includes
|
|
|
|
-------- */
|
|
|
|
|
|
|
|
#include "paul\paul.h"
|
|
|
|
|
|
|
|
#ifndef __SYSTEM_DBG_H__
|
|
|
|
#include "system\dbg.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __GFX_FONT_H__
|
|
|
|
#include "gfx\font.h"
|
|
|
|
#endif
|
|
|
|
|
2000-09-15 18:51:09 +02:00
|
|
|
#ifndef __MEMORY_HEADER__
|
|
|
|
#include "mem\memory.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __UTILS_HEADER__
|
|
|
|
#include "utils\utils.h"
|
|
|
|
#endif
|
|
|
|
|
2000-10-05 16:16:09 +02:00
|
|
|
#ifndef __SOUND_SOUND_H__
|
|
|
|
#include "sound\sound.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __PAD_PADS_H__
|
|
|
|
#include "pad\pads.h"
|
|
|
|
#endif
|
|
|
|
|
2000-10-18 00:04:57 +02:00
|
|
|
#ifndef __GFX_SPRBANK_H__
|
|
|
|
#include "gfx\sprbank.h"
|
|
|
|
#endif
|
|
|
|
|
2000-10-31 17:43:44 +01:00
|
|
|
#ifndef __GUI_GUI_H__
|
|
|
|
#include "gui\gui.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __GUI_GTEXTBOX_H__
|
|
|
|
#include "gui\gtextbox.h"
|
|
|
|
#endif
|
|
|
|
|
2000-11-02 18:16:10 +01:00
|
|
|
#ifndef __GUI_GFRAME_H__
|
|
|
|
#include "gui\gframe.h"
|
|
|
|
#endif
|
|
|
|
|
2000-10-31 17:43:44 +01:00
|
|
|
#ifndef __GUI_GREADOUT_H__
|
|
|
|
#include "gui\greadout.h"
|
|
|
|
#endif
|
|
|
|
|
2000-11-02 18:16:10 +01:00
|
|
|
#ifndef __GUI_GBUTTON_H__
|
|
|
|
#include "gui\gbutton.h"
|
|
|
|
#endif
|
|
|
|
|
2000-10-31 17:43:44 +01:00
|
|
|
#ifndef __LOCALE_TEXTDBASE_H__
|
|
|
|
#include "locale\textdbase.h"
|
|
|
|
#endif
|
|
|
|
|
2000-09-12 01:52:04 +02:00
|
|
|
|
|
|
|
/* Std Lib
|
|
|
|
------- */
|
|
|
|
|
|
|
|
/* Data
|
|
|
|
---- */
|
|
|
|
|
2000-11-03 01:07:42 +01:00
|
|
|
#ifndef __SPR_UIGFX_H__
|
|
|
|
#include <uigfx.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2000-09-12 01:52:04 +02:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Tyepdefs && Defines
|
|
|
|
------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Structure defintions
|
|
|
|
-------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function Prototypes
|
|
|
|
------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Vars
|
|
|
|
---- */
|
|
|
|
static FontBank s_fontBank;
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2000-10-31 17:43:44 +01:00
|
|
|
unsigned int str=STR__PAULS_TEST_STRING_1;
|
|
|
|
int w=150;
|
|
|
|
int h=40;
|
2000-10-18 00:04:57 +02:00
|
|
|
|
2000-11-03 01:07:42 +01:00
|
|
|
CGUITextReadout::TextReadoutData onOffTextReadouts[]=
|
|
|
|
{
|
|
|
|
{ 0, STR__ON, },
|
|
|
|
{ 1, STR__OFF, },
|
|
|
|
{ 0, 0, },
|
|
|
|
};
|
|
|
|
CGUISpriteReadout::SpriteReadoutData onOffSpriteReadouts[]=
|
2000-09-12 01:52:04 +02:00
|
|
|
{
|
2000-11-03 01:07:42 +01:00
|
|
|
{ 0, FRM__CROSS, },
|
|
|
|
{ 1, FRM__TICK, },
|
|
|
|
{ 0, 0, },
|
2000-10-31 17:43:44 +01:00
|
|
|
};
|
2000-11-03 01:07:42 +01:00
|
|
|
int onOffValues[]=
|
2000-11-02 18:16:10 +01:00
|
|
|
{
|
2000-11-03 01:07:42 +01:00
|
|
|
0,1,
|
2000-11-02 18:16:10 +01:00
|
|
|
0,
|
|
|
|
};
|
2000-11-03 01:07:42 +01:00
|
|
|
int musicStatus=0;
|
|
|
|
int sfxStatus=0;
|
|
|
|
|
|
|
|
|
2000-09-15 18:51:09 +02:00
|
|
|
|
2000-11-02 18:16:10 +01:00
|
|
|
CGUIControlFrame *baseGUIObject;
|
2000-10-06 00:40:39 +02:00
|
|
|
|
2000-10-05 16:16:09 +02:00
|
|
|
|
2000-10-31 17:43:44 +01:00
|
|
|
void CPaulScene::init()
|
|
|
|
{
|
2000-11-03 01:07:42 +01:00
|
|
|
CGUIGroupFrame *fr;
|
|
|
|
CGUITextBox *tb;
|
|
|
|
CGUIButton *bu;
|
|
|
|
CGUITextReadout *tr;
|
|
|
|
CGUISpriteReadout *sr;
|
2000-11-02 18:16:10 +01:00
|
|
|
|
2000-10-31 17:43:44 +01:00
|
|
|
s_fontBank.initialise(&standardFont);
|
|
|
|
|
2000-11-02 18:16:10 +01:00
|
|
|
baseGUIObject=new ("Uber GUI object") CGUIControlFrame();
|
2000-11-03 01:07:42 +01:00
|
|
|
baseGUIObject->init(NULL,1);
|
|
|
|
baseGUIObject->setObjectXYWH(32,32,512-64,256-64);
|
|
|
|
|
|
|
|
fr=new ("frame") CGUIGroupFrame();
|
|
|
|
fr->init(baseGUIObject,2);
|
|
|
|
fr->setObjectXYWH(10,10,448-20,30);
|
|
|
|
tb=new ("textbox") CGUITextBox();
|
|
|
|
tb->init(fr,20);
|
|
|
|
tb->setObjectXYWH(0,0,300,30);
|
|
|
|
tb->setText(STR__PAULS_TEST__MUSIC);
|
|
|
|
bu=new ("button") CGUIButton();
|
|
|
|
bu->init(fr,21);
|
|
|
|
// bu->setObjectXYWH(0,0,0,0);
|
|
|
|
bu->setButtonTarget(&musicStatus);
|
|
|
|
bu->setButtonData(onOffValues);
|
|
|
|
tr=new ("textreadout") CGUITextReadout();
|
|
|
|
tr->init(fr,22);
|
|
|
|
tr->setObjectXYWH(300,0,128,30);
|
|
|
|
tr->setReadoutTarget(&musicStatus);
|
|
|
|
tr->setReadoutData(onOffTextReadouts);
|
2000-11-02 18:16:10 +01:00
|
|
|
|
2000-11-03 01:07:42 +01:00
|
|
|
fr=new ("frame") CGUIGroupFrame();
|
|
|
|
fr->init(baseGUIObject,3);
|
|
|
|
fr->setObjectXYWH(10,50,448-20,30);
|
|
|
|
tb=new ("textbox") CGUITextBox();
|
|
|
|
tb->init(fr,30);
|
|
|
|
tb->setObjectXYWH(0,0,300,30);
|
|
|
|
tb->setText(STR__PAULS_TEST__SFX);
|
|
|
|
bu=new ("button") CGUIButton();
|
|
|
|
bu->init(fr,31);
|
|
|
|
// bu->setObjectXYWH(0,0,0,0);
|
|
|
|
bu->setButtonTarget(&sfxStatus);
|
|
|
|
bu->setButtonData(onOffValues);
|
|
|
|
sr=new ("spritereadout") CGUISpriteReadout();
|
|
|
|
sr->init(fr,32);
|
|
|
|
sr->setObjectXYWH(300,0,128,30);
|
|
|
|
sr->setReadoutTarget(&sfxStatus);
|
|
|
|
sr->setReadoutData(onOffSpriteReadouts);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fr=new ("frame") CGUIGroupFrame();
|
|
|
|
fr->init(baseGUIObject,3);
|
|
|
|
fr->setObjectXYWH(10,90,448-20,30);
|
|
|
|
tb=new ("textbox") CGUITextBox();
|
|
|
|
tb->init(fr,30);
|
|
|
|
tb->setObjectXYWH(0,0,300,30);
|
|
|
|
tb->setText(STR__PAULS_TEST__SFX);
|
|
|
|
bu=new ("button") CGUIButton();
|
|
|
|
bu->init(fr,31);
|
|
|
|
// bu->setObjectXYWH(0,0,0,0);
|
|
|
|
bu->setButtonTarget(&sfxStatus);
|
|
|
|
bu->setButtonData(onOffValues);
|
|
|
|
sr=new ("spritereadout") CGUISpriteReadout();
|
|
|
|
sr->init(fr,32);
|
|
|
|
sr->setObjectXYWH(300,0,128,30);
|
|
|
|
sr->setReadoutTarget(&sfxStatus);
|
|
|
|
sr->setReadoutData(onOffSpriteReadouts);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2000-10-31 17:43:44 +01:00
|
|
|
tb=new ("textbox") CGUITextBox();
|
2000-11-02 18:16:10 +01:00
|
|
|
tb->init(baseGUIObject,1);
|
|
|
|
tb->setObjectXYWH(10,10,400,25);
|
|
|
|
tb->setText(STR__PAULS_TEST_STRING_1);
|
|
|
|
|
|
|
|
fr=new ("frame") CGUIGroupFrame();
|
|
|
|
fr->init(baseGUIObject,2);
|
|
|
|
fr->setObjectXYWH(10,40,400,25);
|
|
|
|
tb=new ("textbox") CGUITextBox();
|
|
|
|
tb->init(fr,20);
|
|
|
|
tb->setObjectXYWH(50,1,300,22);
|
|
|
|
tb->setText(STR__PAULS_TEST_STRING_1);
|
|
|
|
bu=new ("button") CGUIButton();
|
|
|
|
bu->init(fr,21);
|
|
|
|
bu->setObjectXYWH(50,1,10,10);
|
|
|
|
bu->setButtonTarget(&testValue);
|
|
|
|
bu->setButtonData(testButtonData);
|
2000-10-31 17:43:44 +01:00
|
|
|
|
|
|
|
tr=new ("textreadout") CGUITextReadout();
|
2000-11-02 18:16:10 +01:00
|
|
|
tr->init(baseGUIObject,3);
|
|
|
|
tr->setObjectXYWH(10,70,400,25);
|
2000-10-31 17:43:44 +01:00
|
|
|
tr->setReadoutTarget(&testValue);
|
2000-11-02 18:16:10 +01:00
|
|
|
tr->setReadoutData(testReadoutData);
|
2000-11-03 01:07:42 +01:00
|
|
|
*/
|
2000-11-02 18:16:10 +01:00
|
|
|
// Heh.. this'll actually work =)
|
|
|
|
// baseGUIObject->shutdown();
|
|
|
|
|
|
|
|
|
|
|
|
baseGUIObject->select();
|
2000-09-12 01:52:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CPaulScene::shutdown()
|
|
|
|
{
|
2000-10-31 17:43:44 +01:00
|
|
|
s_fontBank.dump();
|
2000-09-12 01:52:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2000-11-03 01:07:42 +01:00
|
|
|
int showDebugLog=false;
|
2000-09-12 01:52:04 +02:00
|
|
|
void CPaulScene::render()
|
|
|
|
{
|
2000-11-03 01:07:42 +01:00
|
|
|
|
|
|
|
if(showDebugLog)
|
2000-09-12 01:52:04 +02:00
|
|
|
{
|
2000-11-03 01:07:42 +01:00
|
|
|
int logCount;
|
|
|
|
int i,y,charHeight;
|
|
|
|
logCount=getNumberOfDbgLinesInLog();
|
|
|
|
y=20;
|
|
|
|
charHeight=s_fontBank.getCharHeight();
|
|
|
|
for(i=0;i<logCount;i++)
|
|
|
|
{
|
|
|
|
s_fontBank.print(20,y,getDbgLineFromLog(i));
|
|
|
|
y+=charHeight;
|
|
|
|
}
|
2000-09-12 01:52:04 +02:00
|
|
|
}
|
2000-11-03 01:07:42 +01:00
|
|
|
|
2000-11-02 18:16:10 +01:00
|
|
|
baseGUIObject->render();
|
2000-09-12 01:52:04 +02:00
|
|
|
}
|
|
|
|
|
2000-10-31 17:43:44 +01:00
|
|
|
|
2000-09-12 01:52:04 +02:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2000-10-19 17:40:24 +02:00
|
|
|
void CPaulScene::think(int _frames)
|
2000-09-12 01:52:04 +02:00
|
|
|
{
|
2000-11-02 18:16:10 +01:00
|
|
|
/*
|
2000-10-31 17:43:44 +01:00
|
|
|
CGUITextBox *tb;
|
|
|
|
tb=(CGUITextBox *)guiGetItem(1);
|
|
|
|
tb->setObjectWH(w,h);
|
|
|
|
tb->setText(str);
|
2000-11-02 18:16:10 +01:00
|
|
|
*/
|
2000-10-11 18:47:03 +02:00
|
|
|
|
2000-11-02 18:16:10 +01:00
|
|
|
baseGUIObject->think(_frames);
|
2000-09-12 01:52:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*===========================================================================
|
|
|
|
end */
|