⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sdlcheckbox.h

📁 游戏开发数据结构Data Structures for Game Programmers
💻 H
字号:
// ============================================================================
// Data Structures For Game Programmers
// Ron Penton
// SDLCheckBox.h
// This is a basic SDLGUI library that I've set up for use with the game demos
// I've used in the book.
// ============================================================================
#ifndef SDLCHECKBOX_H
#define SDLCHECKBOX_H

#include "SDLButton.h"


class SDLCheckBox : public SDLButton
{
public:
// -------------------------------------------------------
// Name:        SDLCheckBox::SDLCheckBox
// Description: This constructs the button
// Arguments:   - p_up: the up bitmap name
//              - p_down: the down bitmap name
//              - p_x: x coordinate
//              - p_y: y coordinate
//              - p_text: the text of the label
//              - p_tforecol: the foreground color of the 
//                            text
//              - p_tbackcol: the background color of the
//                            text
//              - p_font: the font of the label.
//              - p_func: the function this calls when
//                        pressed.
// -------------------------------------------------------
    SDLCheckBox( const char* p_up, const char* p_down,
                 int p_x, int p_y,
                 const char* p_text, 
                 SDL_Color p_tforecol,
                 SDL_Color p_tbackcol,
                 TTF_Font* p_font,
                 void (*p_func)(void) );



// -------------------------------------------------------
// Name:        SDLCheckBox::Draw
// Description: draws the button.
// Arguments:   - p_dest: destination surface.
// -------------------------------------------------------
    void Draw( SDL_Surface* p_dest );


// -------------------------------------------------------
// Name:        SDLCheckBox::IsOver
// Description: determines if a position is over the button
// Arguments:   - p_x: x coordinate
//              - p_y: y coordinate
// Return Value: true if the position is over the button.
// -------------------------------------------------------
    bool IsOver( int p_x, int p_y );


// -------------------------------------------------------
// Name:        SDLCheckBox::ClickDown
// Description: sets the down state of the button
// Arguments:   None.
// Return Value: None.
// -------------------------------------------------------
    void ClickDown();
 

// -------------------------------------------------------
// Name:        SDLCheckBox::ClickUp
// Description: sets the up state of the button
// Arguments:   None.
// Return Value: None.
// -------------------------------------------------------
    void ClickUp();


// -------------------------------------------------------
// Name:        SDLCheckBox::ResetOnUp
// Description: resets the button state if needed.
// Arguments:   None.
// Return Value: None.
// -------------------------------------------------------
    void ResetOnUp();


// -------------------------------------------------------
// Name:        SDLCheckBox::CanGetFocus
// Description: determines if this object can get the 
//              focus of the GUI.
// Arguments:   None.
// Return Value: True or False
// -------------------------------------------------------
    bool CanGetFocus();

    
// ----------------------------------------------------------------
//  Name:           GetFocus
//  Description:    tells the item to get the focus or not.
//  Arguments:      p_focus: true if the item gets the focus
//  Return Value:   None
// ----------------------------------------------------------------
    void GetFocus( bool p_focus );


// ----------------------------------------------------------------
//  Name:           KeyPress
//  Description:    tells the GUI that a key was pressed when this
//                  item was in focus
//  Arguments:      p_key: the that was pressed
//                  p_mod: the keyboard modifier flag (shift, alt, 
//                         control).
//                  p_char: the UNICODE representation of the key
//  Return Value:   None
// ----------------------------------------------------------------
    void KeyPress( SDLKey p_key, SDLMod p_mod, Uint16 p_char );


};








#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -