Adonthell  0.4
label Class Reference
Inheritance diagram for label:
Collaboration diagram for label:

Classes

struct  Scursor
 
struct  Sline_text
 

Public Member Functions

 label ()
 Constructor by default, cursor is not moveable, cursor is not visible, and the form is set as NOTHING, the default size is (0, 0) More...
 
virtual ~label ()
 Destructor. More...
 
void set_font (win_font &font)
 Set the font. More...
 
void set_text (const string &text)
 Set the text. More...
 
void add_text (const string &text)
 Add text. More...
 
void set_form (const u_int8 form)
 Set the form of the display NOTHING, AUTO_SIZE, AUTO_HEIGHT. More...
 
void set_cursor_visible (const bool b)
 Set visible cursor. More...
 
void set_cursor_moveable (const bool b)
 Set if the cursor can be moved with arrow key. More...
 
bool update ()
 Update the label. More...
 
bool input_update ()
 Update input label, you can move the cursor if the cursor is moveable. More...
 
const string & text_string () const
 Get the text in string. More...
 
const char * text_char () const
 Get the text in char. More...
 
void resize (u_int16 l, u_int16 h)
 Resize the label. More...
 
- Public Member Functions inherited from image
 image ()
 Default constructor. More...
 
 image (u_int16 l, u_int16 h, const u_int8 &scale=1)
 Creates an image with a specified size. More...
 
 image (SDL_Surface *s, const SDL_Color &color)
 Create image from SDL_Surface. More...
 
virtual ~image ()
 Destructor. More...
 
void resize (u_int16 l, u_int16 h)
 Resize this image. More...
 
void clear ()
 Resets the image to it's initial state, that is totally empty. More...
 
s_int8 get (igzstream &file)
 Loads an image from an opened file, saved in game internal format, with alpha and mask values. More...
 
s_int8 load (string fname)
 Loads an image from a file name, in game internal format, with alpha and mask values. More...
 
s_int8 get_raw (igzstream &file)
 Loads an image from an opened file, saved in game internal format, without alpha and mask values. More...
 
s_int8 load_raw (string fname)
 Loads an image from a file name, in game internal format, without alpha and mask values. More...
 
s_int8 get_pnm (SDL_RWops *file)
 Loads an image from an opened file, in PNM format, without alpha and mask values. More...
 
s_int8 load_pnm (string fname)
 Loads an image from a file name, in PNM format, without alpha and mask values. More...
 
s_int8 put (ogzstream &file) const
 Saves an image into an opened file, in game format, with alpha and mask values. More...
 
s_int8 save (string fname) const
 Saves an image into an file, in game format, with alpha and mask values. More...
 
s_int8 put_raw (ogzstream &file) const
 Saves an image into an opened file, in game format, without alpha and mask values. More...
 
s_int8 save_raw (string fname) const
 Saves an image into an file, in game format, without alpha and mask values. More...
 
s_int8 put_pnm (SDL_RWops *file) const
 Saves an image into an opened file, in PNM format, without alpha and mask values. More...
 
s_int8 save_pnm (string fname) const
 Saves an image into an file, in PNM format, without alpha and mask values. More...
 
void zoom (const surface &src)
 Zooms a surface. More...
 
void zoom (const surface &src, u_int16 l, u_int16 h, u_int16 x=0, u_int16 y=0)
 Zooms a surface. More...
 
void zoom_to (const surface &src, u_int16 l, u_int16 h, u_int16 x=0, u_int16 y=0)
 Synonym of zoom () to guarantee its access from Python. More...
 
void tile (const surface &src)
 Tiles a surface. More...
 
void tile (const surface &src, u_int16 l, u_int16 h, u_int16 x=0, u_int16 y=0)
 Tiles a surface. More...
 
void tile_to (const surface &src, u_int16 l, u_int16 h, u_int16 x=0, u_int16 y=0)
 Synonym of tile () to guarantee its access from Python. More...
 
void brightness (const surface &src, u_int8 cont, bool proceed_mask=false)
 Applies a "brightness" to a surface. More...
 
imageoperator= (const image &src)
 Image copy (similar to copy ()). More...
 
void copy (const image &src)
 Synonym of operator = to guarantee its access from Python. More...
 
- Public Member Functions inherited from surface
 surface (const u_int8 &scale=1)
 Default constructor. More...
 
virtual ~surface ()
 Destructor. More...
 
bool is_masked () const
 Returns whether a surface is masked or not. More...
 
void set_mask (bool m)
 Sets the mask parameter of the surface. More...
 
u_int8 alpha () const
 Returns the alpha value of the surface. More...
 
void set_alpha (u_int8 a, const bool &alpha_channel=false)
 Sets the alpha value of the surface. More...
 
bool has_alpha_channel () const
 Returns whether the surface has an alpha channel. More...
 
u_int8 scale () const
 Get the surfaces current scaling factor. More...
 
void set_scale (const u_int8 &scale)
 Change the scale of the surface to the given value, resizing the internal texture appropriately. More...
 
void draw (s_int16 x, s_int16 y, const drawing_area *da_opt=NULL, surface *target=NULL) const
 Draw the surface. More...
 
void draw (s_int16 x, s_int16 y, s_int16 sx, s_int16 sy, u_int16 sl, u_int16 sh, const drawing_area *da_opt=NULL, surface *target=NULL) const
 Draw a part of the surface. More...
 
void draw_part (s_int16 x, s_int16 y, s_int16 sx, s_int16 sy, u_int16 sl, u_int16 sh, const drawing_area *da_opt=NULL, surface *target=NULL) const
 Synonym of draw () to guarantee its access from Python. More...
 
void fillrect (s_int16 x, s_int16 y, u_int16 l, u_int16 h, u_int32 col, drawing_area *da_opt=NULL)
 Fills an area of the surface with a given color. More...
 
u_int32 map_color (const u_int8 &r, const u_int8 &g, const u_int8 &b, const u_int8 &a=255) const
 
void unmap_color (u_int32 col, u_int8 &r, u_int8 &g, u_int8 &b, u_int8 &a) const
 
void lock () const
 Locks the surface. More...
 
void unlock () const
 Unlock the surface after you've worked on it's pixels with the get_pix () and put_pix () methods. More...
 
void put_pix (u_int16 x, u_int16 y, u_int32 col)
 Puts a pixel of a given color. More...
 
void put_pix (u_int16 x, u_int16 y, u_int8 r, u_int8 g, u_int8 b)
 Puts a pixel of a given color. More...
 
void put_pix_rgb (u_int16 x, u_int16 y, u_int8 r, u_int8 g, u_int8 b)
 Synonym of put_pix () to guarantee its access from Python. More...
 
u_int32 get_pix (u_int16 x, u_int16 y) const
 Gets a pixel from the surface. More...
 
void get_pix (u_int16 x, u_int16 y, u_int8 &r, u_int8 &g, u_int8 &b) const
 Gets a pixel from a surface. More...
 
void get_pix_rgb (u_int16 x, u_int16 y, u_int8 r, u_int8 g, u_int8 b) const
 Synonym of get_pix () to guarantee its access from Python. More...
 
surfaceoperator= (const surface &src)
 Surface copy (similar to copy ()). More...
 
void copy (const surface &src)
 Synonym of operator = to guarantee its access from Python. More...
 
- Public Member Functions inherited from drawable
 drawable ()
 Default constructor. More...
 
virtual ~drawable ()
 Destructor. More...
 
u_int16 length () const
 Returns the length of the drawable. More...
 
u_int16 height () const
 Returns the height of the drawable. More...
 

Static Public Attributes

static const u_int8 NOTHING = 0
 
static const u_int8 AUTO_HEIGHT = 1
 
static const u_int8 AUTO_SIZE = 2
 
const static SDL_Keycode KEY_CURSOR_NEXT = SDLK_RIGHT
 
const static SDL_Keycode KEY_CURSOR_PREVIOUS = SDLK_LEFT
 

Protected Member Functions

void fit_text_width ()
 
u_int16 ucd (u_int16 &idx) const
 
u_int16 ucd (const std::string &text, u_int16 &idx) const
 
void init_vec_cursor ()
 Init vector and cursor, don't erase my_text_. More...
 
void build (const bool erase_all)
 Build label. More...
 
void build_form_nothing ()
 Build the label when the form set top nothing. More...
 
void build_form_auto_height ()
 
void build_form_auto_size ()
 
void clean_surface (const bool erase_all)
 
u_int8 find_word (u_int16 &index, u_int16 &wlength, u_int16 &wlengthpix, s_int16 &woffset, u_int16 &last_letter, const u_int16 rlength)
 
void draw_string (const bool at_cursor)
 
void update_cursor ()
 
void cursor_next ()
 
void cursor_previous ()
 
void cursor_draw ()
 
void cursor_undraw ()
 
bool last_letter (u_int16 idx)
 
- Protected Member Functions inherited from surface
void resize (u_int16 l, u_int16 h)
 Resize this surface. More...
 
void clear ()
 Resets the surface to it's initial state, that is totally empty. More...
 
void set_data (void *data, u_int16 l, u_int16 h, u_int8 bytes_per_pixel=BYTES_PER_PIXEL, u_int32 red_mask=R_MASK, u_int32 green_mask=G_MASK, u_int32 blue_mask=B_MASK, u_int32 alpha_mask=0)
 
void * get_data (u_int8 bytes_per_pixel, u_int32 red_mask, u_int32 green_mask, u_int32 blue_mask, u_int32 alpha_mask) const
 
SDL_Surface * to_sw_surface (SDL_Rect *rect=NULL) const
 Create a software surface backed by the (streaming) texture data. More...
 
void lock (SDL_Rect *rect) const
 lock part of the surface specified by rect More...
 
- Protected Member Functions inherited from drawable
void set_length (u_int16 l)
 Sets the length of the drawable. More...
 
void set_height (u_int16 h)
 Sets the height of the drawable. More...
 

Protected Attributes

win_fontmy_font_
 
string my_text_
 
string new_text_
 
u_int8 my_form_
 
bool visible_cursor_
 
bool moveable_cursor_
 
u_int16 cursor_cur_blink_
 
Scursor my_cursor_
 
Scursor my_old_cursor_
 
vector< Sline_textmy_vect_
 
u_int16 start_line_
 
- Protected Attributes inherited from surface
SDL_Texture * Surface
 the surface More...
 
u_int8 scale_
 current scale More...
 
s_int16 offset_x_
 sub-pixel offset More...
 

Static Protected Attributes

static u_int16 cursor_blink_cycle = 75
 

Detailed Description

Definition at line 29 of file label.h.

Constructor & Destructor Documentation

◆ label()

label::label ( )

Constructor by default, cursor is not moveable, cursor is not visible, and the form is set as NOTHING, the default size is (0, 0)

Constructor.

Definition at line 28 of file label.cc.

◆ ~label()

label::~label ( )
virtual

Destructor.

Definition at line 53 of file label.cc.

Member Function Documentation

◆ set_font()

void label::set_font ( win_font font)

Set the font.

Definition at line 61 of file label.cc.

◆ set_text()

void label::set_text ( const string &  text)

Set the text.

Definition at line 70 of file label.cc.

◆ add_text()

void label::add_text ( const string &  text)

Add text.

Definition at line 90 of file label.cc.

◆ set_form()

void label::set_form ( const u_int8  form)

Set the form of the display NOTHING, AUTO_SIZE, AUTO_HEIGHT.

Set the form.

Definition at line 126 of file label.cc.

◆ set_cursor_visible()

void label::set_cursor_visible ( const bool  b)

Set visible cursor.

Set if cursor is visible.

Definition at line 198 of file label.cc.

◆ set_cursor_moveable()

void label::set_cursor_moveable ( const bool  b)

Set if the cursor can be moved with arrow key.

Set the cursor moveable with arrow.

Definition at line 207 of file label.cc.

◆ update()

bool label::update ( )
virtual

Update the label.

Reimplemented from drawable.

Definition at line 618 of file label.cc.

◆ input_update()

bool label::input_update ( )
virtual

Update input label, you can move the cursor if the cursor is moveable.

Reimplemented from drawable.

Reimplemented in label_input.

Definition at line 673 of file label.cc.

◆ text_string()

const string & label::text_string ( ) const

Get the text in string.

Definition at line 726 of file label.cc.

◆ text_char()

const char * label::text_char ( ) const

Get the text in char.

Definition at line 731 of file label.cc.

◆ resize()

void label::resize ( u_int16  l,
u_int16  h 
)

Resize the label.

REsize the label.

Definition at line 116 of file label.cc.

◆ init_vec_cursor()

void label::init_vec_cursor ( )
protected

Init vector and cursor, don't erase my_text_.

Init vector and cursor.

Definition at line 140 of file label.cc.

◆ build()

void label::build ( const bool  erase_all)
protected

Build label.

Update the vector start : it's the index where the function must start to update.

Definition at line 166 of file label.cc.

◆ build_form_nothing()

void label::build_form_nothing ( )
protected

Build the label when the form set top nothing.

Definition at line 216 of file label.cc.


The documentation for this class was generated from the following files: