This commit is contained in:
parent
3b2b2c2001
commit
7b80782ebc
3 changed files with 188 additions and 0 deletions
115
source/gui/gbutton.cpp
Normal file
115
source/gui/gbutton.cpp
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
/*=========================================================================
|
||||||
|
|
||||||
|
gbutton.cpp
|
||||||
|
|
||||||
|
Author: PKG
|
||||||
|
Created:
|
||||||
|
Project: Spongebob
|
||||||
|
Purpose:
|
||||||
|
|
||||||
|
Copyright (c) 2000 Climax Development Ltd
|
||||||
|
|
||||||
|
===========================================================================*/
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Includes
|
||||||
|
-------- */
|
||||||
|
|
||||||
|
#include "gui\gbutton.h"
|
||||||
|
|
||||||
|
#ifndef __PAD_PADS_H__
|
||||||
|
#include "pad\pads.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Std Lib
|
||||||
|
------- */
|
||||||
|
|
||||||
|
/* Data
|
||||||
|
---- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Tyepdefs && Defines
|
||||||
|
------------------- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Structure defintions
|
||||||
|
-------------------- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Function Prototypes
|
||||||
|
------------------- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Vars
|
||||||
|
---- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Function:
|
||||||
|
Purpose:
|
||||||
|
Params:
|
||||||
|
Returns:
|
||||||
|
---------------------------------------------------------------------- */
|
||||||
|
void CGUIButton::setButtonTarget(int *_target)
|
||||||
|
{
|
||||||
|
m_target=_target;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Function:
|
||||||
|
Purpose:
|
||||||
|
Params:
|
||||||
|
Returns:
|
||||||
|
---------------------------------------------------------------------- */
|
||||||
|
void CGUIButton::setButtonData(int *_data)
|
||||||
|
{
|
||||||
|
m_data=_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Function:
|
||||||
|
Purpose:
|
||||||
|
Params:
|
||||||
|
Returns:
|
||||||
|
---------------------------------------------------------------------- */
|
||||||
|
void CGUIButton::think(int _frames)
|
||||||
|
{
|
||||||
|
ASSERT(m_target);
|
||||||
|
ASSERT(m_data);
|
||||||
|
|
||||||
|
if(isSelected())
|
||||||
|
{
|
||||||
|
int pad;
|
||||||
|
|
||||||
|
pad=PadGetRepeat(0);
|
||||||
|
if(pad&PAD_CROSS)
|
||||||
|
{
|
||||||
|
int *data;
|
||||||
|
int tmp;
|
||||||
|
GUI_DBGMSG("*C*L*I*C*K");
|
||||||
|
data=m_data;
|
||||||
|
tmp=*data;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
tmp=*data;
|
||||||
|
data++;
|
||||||
|
if(*m_target==tmp)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while(tmp<*data);
|
||||||
|
if(tmp>*data)
|
||||||
|
{
|
||||||
|
data=m_data;
|
||||||
|
}
|
||||||
|
*m_target=*data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*===========================================================================
|
||||||
|
end */
|
65
source/gui/gbutton.h
Normal file
65
source/gui/gbutton.h
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
/*=========================================================================
|
||||||
|
|
||||||
|
gbutton.h
|
||||||
|
|
||||||
|
Author: PKG
|
||||||
|
Created:
|
||||||
|
Project: Spongebob
|
||||||
|
Purpose:
|
||||||
|
|
||||||
|
Copyright (c) 2000 Climax Development Ltd
|
||||||
|
|
||||||
|
===========================================================================*/
|
||||||
|
|
||||||
|
#ifndef __GUI_GBUTTON_H__
|
||||||
|
#define __GUI_GBUTTON_H__
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Includes
|
||||||
|
-------- */
|
||||||
|
|
||||||
|
#ifndef __GUI_GUI_H__
|
||||||
|
#include "gui\gui.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Std Lib
|
||||||
|
------- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Tyepdefs && Defines
|
||||||
|
------------------- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Structure defintions
|
||||||
|
-------------------- */
|
||||||
|
|
||||||
|
class CGUIButton : public CGUIObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void setButtonTarget(int *_target);
|
||||||
|
virtual void setButtonData(int *_data);
|
||||||
|
|
||||||
|
virtual void think(int _frames);
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
int *m_target;
|
||||||
|
int *m_data;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Globals
|
||||||
|
------- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Functions
|
||||||
|
--------- */
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#endif /* __GUI_GBUTTON_H__ */
|
||||||
|
|
||||||
|
/*===========================================================================
|
||||||
|
end */
|
|
@ -441,6 +441,14 @@ SOURCE=..\..\..\source\utils\utils.h
|
||||||
# PROP Default_Filter ""
|
# PROP Default_Filter ""
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\..\source\gui\gbutton.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\..\source\gui\gbutton.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\..\..\source\gui\gframe.cpp
|
SOURCE=..\..\..\source\gui\gframe.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue