Amulets & Armor  v1.02
Open Source Game
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Data Structures | Macros | Functions
UIBUTTON

User Interface Button Code. More...

Data Structures

struct  T_UIButtonStruct
 

Macros

#define UI_BUTTON_STATE_FOCUSED   0x01 /* -------1 */
 
#define UI_BUTTON_STATE_PRESSED   0x02 /* ------1- */
 
#define UI_BUTTON_STATE_UNKNOWN   0xFC /* 111111-- */
 

Functions

T_UIButton UIButtonCreate (T_UIGroup group, T_resource focusPic, T_resource notFocusPic, T_resource pressedPic, T_word16 x, T_word16 y)
 
T_word32 UIButtonGetAccessoryData (T_UIButton button)
 
T_void UIButtonSetAccessoryData (T_UIButton button, T_word32 data)
 
T_void UIButtonSetHandler (T_UIButton button, T_buttonHandler buttonHandler)
 

Detailed Description

User Interface Button Code.

DEPRECATED!

See Also
http://www.amuletsandarmor.com/AALicense.txt

Macro Definition Documentation

#define UI_BUTTON_STATE_FOCUSED   0x01 /* -------1 */
#define UI_BUTTON_STATE_PRESSED   0x02 /* ------1- */
#define UI_BUTTON_STATE_UNKNOWN   0xFC /* 111111-- */

Function Documentation

T_UIButton UIButtonCreate ( T_UIGroup  group,
T_resource  focusPic,
T_resource  notFocusPic,
T_resource  pressedPic,
T_word16  x,
T_word16  y 
)

UIButtonCreate does all the work to set up a button to be displayed on the screen. Just give it a group, 3 resource pictures, and a XY coordinate to place it on the screen. The button will then appear when the group is drawn.

NOTE: The passed button resources are for masked bitmaps, so you will want the graphics drawn accordingly. However, the button WILL be pressed if in the rectangular area (no checks are made to look into the bitmap).

NOTE: Make sure that the x & y coordinates leave enough room on the screen for the whole button. Otherwise, it will bomb when it is drawn. Also, make sure that all your resource bitmaps are the same size.

Parameters
group– Group to add button to.
focusPic– Picture to use when mouse is over button.
notFocusPic– Picture to use when mouse is elsewhere
pressedPic– Picture to use when mouse is pressing down on button.
x– X position of button
y– Y position of button
Returns
Returned handle to button created or else will be UI_BUTTON_BAD
T_word32 UIButtonGetAccessoryData ( T_UIButton  button)

Every button has a slot available for storing one 32 bit word. This data slot can be used for anything that the calling module wishes. Most of the time, it is used to record a button ID. The ID allows the programmer to use the same button handler for multiple buttons. This routine is used to retrieve that data.

Parameters
button– Button to retrieve data from
Returns
Data that was stored
T_void UIButtonSetAccessoryData ( T_UIButton  button,
T_word32  data 
)

Every button has a slot available for storing one 32 bit word. This data slot can be used for anything that the calling module wishes. Most of the time, it is used to record a button ID. The ID allows the programmer to use the same button handler for multiple buttons. This routine is used to store that data.

Parameters
button– Button to store data within
data– Data to store
T_void UIButtonSetHandler ( T_UIButton  button,
T_buttonHandler  buttonHandler 
)

UIButtonSetHandler will declare the handler that will be used for this button. Basically, the handler will be called when the button is pressed.

Parameters
button– Button to set handler upon
buttonHandler– Function to call when button is pressed