This commit is contained in:
parent
72afd3de6c
commit
68b6716e0d
8 changed files with 117 additions and 52 deletions
|
@ -71,7 +71,8 @@ gui_src := gui \
|
|||
gbutton \
|
||||
gframe \
|
||||
greadout \
|
||||
gtextbox
|
||||
gtextbox \
|
||||
gtextent
|
||||
|
||||
locale_src := textdbase
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ class CGUIToggleButton : public CGUIObject
|
|||
public:
|
||||
virtual void init(CGUIObject *_parent,GUIId _id=noId);
|
||||
|
||||
virtual void setButtonTarget(int *_target);
|
||||
void setButtonTarget(int *_target);
|
||||
|
||||
virtual void think(int _frames);
|
||||
|
||||
|
@ -60,7 +60,7 @@ class CGUICycleButton : public CGUIToggleButton
|
|||
public:
|
||||
virtual void init(CGUIObject *_parent,GUIId _id=noId);
|
||||
|
||||
virtual void setButtonData(int *_data);
|
||||
void setButtonData(int *_data);
|
||||
|
||||
virtual void think(int _frames);
|
||||
|
||||
|
@ -85,8 +85,8 @@ public:
|
|||
|
||||
virtual void init(CGUIObject *_parent,GUIId _id=noId);
|
||||
|
||||
virtual void setButtonRange(int _min,int _max);
|
||||
virtual void setScrollSpeed(int _scrollSpeed);
|
||||
void setButtonRange(int _min,int _max);
|
||||
void setScrollSpeed(int _scrollSpeed);
|
||||
|
||||
virtual void think(int _frames);
|
||||
|
||||
|
|
|
@ -111,6 +111,32 @@ int CGUIGroupFrame::isSelectable()
|
|||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
int CGUIGroupFrame::isUnselectable()
|
||||
{
|
||||
CGUIObject *pGUI;
|
||||
int unselectable=false;
|
||||
|
||||
pGUI=getChild();
|
||||
while(pGUI)
|
||||
{
|
||||
if(pGUI->isUnselectable())
|
||||
{
|
||||
unselectable=true;
|
||||
break;
|
||||
}
|
||||
pGUI=pGUI->getNext();
|
||||
}
|
||||
|
||||
return unselectable;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -141,21 +167,23 @@ void CGUIControlFrame::think(int _frames)
|
|||
ASSERT(pGUI);
|
||||
pGUI=pGUI->getNext();
|
||||
}
|
||||
pGUI->unselect();
|
||||
|
||||
// Find next selectable object and select it
|
||||
do
|
||||
if(pGUI->isUnselectable())
|
||||
{
|
||||
pGUI=pGUI->getNext();
|
||||
if(!pGUI)pGUI=getChild();
|
||||
pGUI->unselect();
|
||||
|
||||
// Find next selectable object and select it
|
||||
do
|
||||
{
|
||||
pGUI=pGUI->getNext();
|
||||
if(!pGUI)pGUI=getChild();
|
||||
}
|
||||
while(!pGUI->isSelectable());
|
||||
pGUI->select();
|
||||
}
|
||||
while(!pGUI->isSelectable());
|
||||
pGUI->select();
|
||||
}
|
||||
}
|
||||
else if(pad&PAD_UP)
|
||||
{
|
||||
/////////////////////
|
||||
CGUIObject *pGUI,*prevGUI;
|
||||
|
||||
pGUI=getChild();
|
||||
|
@ -172,24 +200,26 @@ void CGUIControlFrame::think(int _frames)
|
|||
}
|
||||
pGUI=pGUI->getNext();
|
||||
}
|
||||
pGUI->unselect();
|
||||
|
||||
// Find previous selectable object and select it
|
||||
if(!prevGUI)
|
||||
if(pGUI->isUnselectable())
|
||||
{
|
||||
do
|
||||
pGUI->unselect();
|
||||
|
||||
// Find previous selectable object and select it
|
||||
if(!prevGUI)
|
||||
{
|
||||
if(pGUI->isSelectable())
|
||||
do
|
||||
{
|
||||
prevGUI=pGUI;
|
||||
if(pGUI->isSelectable())
|
||||
{
|
||||
prevGUI=pGUI;
|
||||
}
|
||||
pGUI=pGUI->getNext();
|
||||
}
|
||||
pGUI=pGUI->getNext();
|
||||
while(pGUI);
|
||||
}
|
||||
while(pGUI);
|
||||
prevGUI->select();
|
||||
}
|
||||
prevGUI->select();
|
||||
}
|
||||
/////////////////////
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ public:
|
|||
virtual void clearFlags(GUI_FLAGS _flags);
|
||||
|
||||
virtual int isSelectable();
|
||||
virtual int isUnselectable();
|
||||
|
||||
|
||||
protected:
|
||||
|
|
|
@ -77,8 +77,6 @@ void CGUITextBox::init(CGUIObject *_parent,GUIId _id)
|
|||
---------------------------------------------------------------------- */
|
||||
void CGUITextBox::setText(unsigned int _textId)
|
||||
{
|
||||
FontBank *fb;
|
||||
|
||||
m_textId=_textId;
|
||||
recalc();
|
||||
}
|
||||
|
@ -92,8 +90,6 @@ void CGUITextBox::setText(unsigned int _textId)
|
|||
---------------------------------------------------------------------- */
|
||||
void CGUITextBox::render()
|
||||
{
|
||||
FontBank *fb;
|
||||
|
||||
if(!isHidden())
|
||||
{
|
||||
getFontBank()->print((getW()-(BORDERWIDTH*2))/2,m_textY,m_textId);
|
||||
|
|
|
@ -112,8 +112,9 @@ void CGUIObject::shutdown()
|
|||
if(m_child)m_child->shutdown(); m_child=NULL;
|
||||
if(m_next)m_next->shutdown(); m_next=NULL;
|
||||
m_parent=NULL;
|
||||
m_this=NULL;
|
||||
|
||||
// Is this actually safe? Not *really* (PKG)
|
||||
// Is this actually safe? Possibly not.. (PKG)
|
||||
delete this;
|
||||
}
|
||||
|
||||
|
@ -303,6 +304,18 @@ void CGUIObjectWithFont::clearFlags(GUI_FLAGS _flags)
|
|||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CGUIObjectWithFont::setOt(int _ot)
|
||||
{
|
||||
CGUIObject::setOt(_ot);
|
||||
getFontBank()->setOt(_ot);
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
|
@ -320,7 +333,6 @@ void CGUIObjectWithFont::recalc()
|
|||
w=getW()-(BORDERWIDTH*2);
|
||||
h=getH()-(BORDERHEIGHT*2);
|
||||
getFontBank()->setPrintArea(x,y,w,h);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -91,9 +91,15 @@ public:
|
|||
CGUIObject *getChild() {return m_child;}
|
||||
CGUIObject *getNext() {return m_next;}
|
||||
virtual int isSelectable() {return false;}
|
||||
virtual int isUnselectable() {return true;}
|
||||
|
||||
void setOt(int _ot) {m_ot=_ot;}
|
||||
int getOt() {return m_ot;}
|
||||
|
||||
// PKG - Do we really need ids!?
|
||||
int getId() {return m_id;}
|
||||
|
||||
|
||||
protected:
|
||||
virtual void recalc();
|
||||
|
||||
|
@ -107,9 +113,6 @@ protected:
|
|||
int getParentX() {if(m_parent)return m_parent->getX()+m_parent->getParentX();else return 0;}
|
||||
int getParentY() {if(m_parent)return m_parent->getY()+m_parent->getParentY();else return 0;}
|
||||
|
||||
void setOt(int _ot) {m_ot=_ot;}
|
||||
int getOt() {return m_ot;}
|
||||
|
||||
|
||||
private:
|
||||
GUIId m_id;
|
||||
|
@ -133,6 +136,8 @@ public:
|
|||
virtual void setFlags(GUI_FLAGS _flags);
|
||||
virtual void clearFlags(GUI_FLAGS _flags);
|
||||
|
||||
void setOt(int _ot);
|
||||
|
||||
|
||||
protected:
|
||||
enum
|
||||
|
|
|
@ -66,6 +66,10 @@
|
|||
#include "gui\gbutton.h"
|
||||
#endif
|
||||
|
||||
#ifndef __GUI_GTEXTENT_H__
|
||||
#include "gui\gtextent.h"
|
||||
#endif
|
||||
|
||||
#ifndef __LOCALE_TEXTDBASE_H__
|
||||
#include "locale\textdbase.h"
|
||||
#endif
|
||||
|
@ -126,6 +130,7 @@ int musicStatus=false;
|
|||
int sfxStatus=false;
|
||||
int readyToExit=false;
|
||||
int musicVol=0;
|
||||
char textEntry[16+1]="SOME TEXT";
|
||||
|
||||
|
||||
|
||||
|
@ -141,9 +146,13 @@ void CPaulScene::init()
|
|||
CGUISpriteReadout *sr;
|
||||
CGUIBarReadout *br;
|
||||
CGUISliderButton *sl;
|
||||
CGUITextEntry *te;
|
||||
|
||||
s_fontBank.initialise(&standardFont);
|
||||
|
||||
int mem=MainRam.TotalRam-MainRam.RamUsed;
|
||||
PAUL_DBGMSG("initial mem free=%d",mem);
|
||||
|
||||
baseGUIObject=new ("Uber GUI object") CGUIControlFrame();
|
||||
baseGUIObject->init(NULL);
|
||||
baseGUIObject->setObjectXYWH(32,32,512-64,256-64);
|
||||
|
@ -180,35 +189,46 @@ void CPaulScene::init()
|
|||
sr->setReadoutTarget(&sfxStatus);
|
||||
sr->setReadoutData(onOffSpriteReadouts);
|
||||
|
||||
fr=new ("frame") CGUIGroupFrame();
|
||||
fr->init(baseGUIObject);
|
||||
fr->setObjectXYWH(10,90,448-20,30);
|
||||
sl=new("sliderbutton") CGUISliderButton();
|
||||
sl->init(fr);
|
||||
sl->setButtonTarget(&musicVol);
|
||||
sl->setButtonRange(0,255);
|
||||
br=new ("spritereadout") CGUIBarReadout();
|
||||
br->init(fr);
|
||||
br->setObjectXYWH(0,0,448-20,30);
|
||||
br->setReadoutTarget(&musicVol);
|
||||
br->setReadoutRange(0,255);
|
||||
fr=new ("frame") CGUIGroupFrame();
|
||||
fr->init(baseGUIObject);
|
||||
fr->setObjectXYWH(10,90,448-20,30);
|
||||
sl=new("sliderbutton") CGUISliderButton();
|
||||
sl->init(fr);
|
||||
sl->setButtonTarget(&musicVol);
|
||||
sl->setButtonRange(0,255);
|
||||
br=new ("spritereadout") CGUIBarReadout();
|
||||
br->init(fr);
|
||||
br->setObjectXYWH(0,0,448-20,30);
|
||||
br->setReadoutTarget(&musicVol);
|
||||
br->setReadoutRange(0,255);
|
||||
|
||||
fr=new ("frame") CGUIGroupFrame();
|
||||
fr->init(baseGUIObject);
|
||||
fr->setObjectXYWH(10,155,448-20,30);
|
||||
fr->setObjectXYWH(10,155,200,30);
|
||||
tb=new ("textbox") CGUITextBox();
|
||||
tb->init(fr);
|
||||
tb->setObjectXYWH(0,0,428,30);
|
||||
tb->setObjectXYWH(0,0,200,30);
|
||||
tb->setText(STR__PAULS_TEST__EXIT);
|
||||
tg=new ("togglebutton") CGUIToggleButton();
|
||||
tg->init(fr);
|
||||
tg->setButtonTarget(&readyToExit);
|
||||
|
||||
// Heh.. this'll actually work =)
|
||||
// baseGUIObject->shutdown();
|
||||
|
||||
fr=new ("frame") CGUIGroupFrame();
|
||||
fr->init(baseGUIObject);
|
||||
fr->setObjectXYWH(220,155,200,30);
|
||||
te=new ("textentry") CGUITextEntry();
|
||||
te->init(fr);
|
||||
te->setObjectXYWH(0,0,200,30);
|
||||
te->setTextDetails(textEntry,16);
|
||||
|
||||
baseGUIObject->select();
|
||||
|
||||
// Heh.. this'll actually work =)
|
||||
//ASSERT(0);
|
||||
// baseGUIObject->shutdown();
|
||||
// baseGUIObject=0;
|
||||
|
||||
PAUL_DBGMSG("change=%d",mem-(MainRam.TotalRam-MainRam.RamUsed));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue