Public Member Functions | Protected Member Functions | Private Attributes | List of all members
nom::ui::Cursor Class Reference

Helper class for loading, positioning and keeping track of a cursor controlled by an user-defined input. More...

#include <Cursor.hpp>

Inheritance diagram for nom::ui::Cursor:
[legend]
Collaboration diagram for nom::ui::Cursor:
[legend]

Public Member Functions

 Cursor (void)
 
virtual ~Cursor (void)
 Destructor.
 
 Cursor (const SpriteSheet &sheet)
 Construct a new Cursor object, initializing with a SpriteSheet object.
 
 Cursor (const std::string &filename)
 Construct a Cursor from an existing sprite sheet filename.
 
Cursor & operator= (const Cursor &other)
 Copy assignment operator.
 
int32 x (void) const
 
int32 y (void) const
 
bool locked (void) const
 Getter for obtaining locked status.
 
void toggle_lock (bool toggle)
 Toggle the lock variable.
 
- Public Member Functions inherited from nom::AnimatedSprite
 AnimatedSprite (void)
 
 AnimatedSprite (const SpriteSheet &sheet)
 
 AnimatedSprite (const std::string &filename)
 
virtual ~AnimatedSprite (void)
 Destructor.
 
int32 total_frames (void) const
 Get the maximum number of animation frames for this object.
 
int32 frame_inc (void) const
 Get the frame increment value of this object.
 
int32 frame (void) const
 Get the current frame of this object.
 
AnimatedSprite::AnimationStyle style (void) const
 Get the current animation style for this object.
 
AnimatedSprite::AnimationStatus status (void) const
 Get the current status of this animation.
 
void setFrameRate (int32 rate)
 
void setCurrentFrame (int32 frame)
 
void setAnimationStyle (AnimatedSprite::AnimationStyle style)
 Set a new style of animation for this object.
 
void play (void)
 Play the animation.
 
void stop (void)
 Stop the animation playback.
 
void pause (void)
 Pause the animation playback.
 
void unpause (void)
 Un-pause the animation playback.
 
- Public Member Functions inherited from nom::SpriteBatch
 SpriteBatch (void)
 
virtual ~SpriteBatch (void)
 Destructor.
 
 SpriteBatch (const SpriteSheet &sheet)
 
 SpriteBatch (const std::string &filename)
 Construct a SpriteBatch object from an existing sprite sheet filename.
 
SpriteBatch & operator= (const SpriteBatch &other)
 Copy assignment operator.
 
int32 getSheetID (void) const
 Get the object's current sheet_id.
 
int32 frames (void) const
 Obtain the number of frames available.
 
const std::string & sheet_filename (void) const
 
void setSheetID (int32 id)
 Set a new frame ID to render.
 
void update (void)
 
- Public Member Functions inherited from nom::Sprite
 Sprite (void)
 
 Sprite (int32 width, int32 height)
 Construct a Sprite object, initializing the width & height coordinates.
 
Sprite & operator= (const Sprite &other)
 Copy assignment operator.
 
virtual ~Sprite (void)
 Destructor.
 
const Point2i size (void) const
 
const Point2i position (void) const
 
uint32 getState (void) const
 Get the object's state.
 
void setState (uint32 state)
 Set a new state.
 
bool load (const std::string &filename, const Color &colorkey, bool use_cache=false)
 Load a new image onto the Sprite.
 
void draw (RenderTarget target) const
 Render the object onto the primary video buffer – your visible screen.
 
void draw (RenderTarget target, const double angle) const
 
bool resize (enum ResizeAlgorithm scaling_algorithm)
 Rescale the font with a chosen resizing algorithm.
 
bool resize (const Point2f &scale_factor)
 
- Public Member Functions inherited from nom::Transformable
 Transformable (const Coords &coords)
 
 Transformable (const Coords &coords, const Color &color)
 
const Coords getPosition (void) const
 
const Coords getSize (void) const
 
void setPosition (int32 x, int32 y)
 
void setPosition (int32 x, int32 y, int32 width, int32 height)
 
void setPosition (const Coords &coords)
 
void setSize (int32 width, int32 height)
 
void setSize (const Coords &size)
 
void move (uint32 x=0, uint32 y=0)
 
void move (const Coords &offsets=Coords(0, 0))
 
const Color & getColor (void) const
 
void setColor (uint8 red, uint8 green, uint8 blue, uint8 alpha=255)
 
void setColor (const Color &color)
 
- Public Member Functions inherited from nom::IDrawable
 IDrawable (void)
 Do nothing at all default constructor.
 
virtual ~IDrawable (void)
 Do nothing at all destructor.
 

Protected Member Functions

virtual int32 move_up (void)
 
virtual int32 move_down (void)
 
virtual int32 move_left (void)
 
virtual int32 move_right (void)
 
- Protected Member Functions inherited from nom::AnimatedSprite
void update_animation (void)
 Updates the playback of the animation.
 
void initialize (void)
 Initialize values to their respective defaults.
 
void setMaxFrames (int32 max)
 Set the total number of animated frames for this object.
 
void setFrameIncrement (int32 increment)
 Set the increment value of each animated frame of this object.
 
void setAnimationStatus (AnimatedSprite::AnimationStatus status)
 Set a new status state for this object.
 

Private Attributes

bool locked_
 

Additional Inherited Members

- Public Types inherited from nom::AnimatedSprite
enum  AnimationStyle { NoStyle = 0, Blink, Oscillate }
 
enum  AnimationStatus { Stopped = 0, Playing, Paused }
 
- Public Types inherited from nom::IDrawable
typedef std::unique_ptr
< IDrawable > 
UniquePtr
 std::unique_ptr definition type for your convenience, sir!
 
typedef std::shared_ptr
< IDrawable > 
SharedPtr
 std::shared_ptr definition type at your leisure, sir!
 
typedef std::vector
< std::shared_ptr< IDrawable > > 
SharedDrawables
 Vector of std::shared_ptr definition type for the brotherhood, sir!
 
typedef std::vector
< std::unique_ptr< IDrawable > > 
UniqueDrawables
 std::unique_ptr vector container type
 
typedef const Window & RenderTarget
 
- Protected Attributes inherited from nom::AnimatedSprite
int32 max_frames
 Total number of animation frames.
 
int32 current_frame
 Current animation frame.
 
int32 frame_increment
 Value that we increment the current_frame by.
 
enum AnimatedSprite::AnimationStyle animation_style
 Animation playback logic.
 
enum
AnimatedSprite::AnimationStatus 
animation_status
 Status info.
 
AnimationTimer fps
 Keeps record of our current tick and frame rate (think: frame delay)
 
- Protected Attributes inherited from nom::SpriteBatch
Coords offsets
 Source (input) coordinates – used for sprite sheet positioning.
 
SpriteSheet sprite_sheet
 Our attached sprite sheet object.
 
int32 sheet_id
 The sheet's frame ID presently in use.
 
- Protected Attributes inherited from nom::Sprite
Texture sprite
 Object that holds our sprite image.
 
uint32 state
 Convenience instance variable (user-defined)
 
int32 scale_factor
 Scale factor applied if the resize method is called.
 
- Protected Attributes inherited from nom::Transformable
Coords coords
 
Color color
 

Detailed Description

Helper class for loading, positioning and keeping track of a cursor controlled by an user-defined input.

Definition at line 44 of file Cursor.hpp.

Constructor & Destructor Documentation

nom::ui::Cursor::Cursor ( void  )

Default construct for initializing instance variables to their respective defaults.

Definition at line 34 of file Cursor.cpp.

Member Function Documentation

int32 nom::ui::Cursor::move_down ( void  )
protectedvirtual

The deriving classes must implement this iteration for the 'down' action

Returns
-1 when this base class method is left undefined

Definition at line 101 of file Cursor.cpp.

int32 nom::ui::Cursor::move_left ( void  )
protectedvirtual

The deriving classes must implement this iteration for the 'left' action

Returns
-1 when this base class method is left undefined

Definition at line 106 of file Cursor.cpp.

int32 nom::ui::Cursor::move_right ( void  )
protectedvirtual

The deriving classes must implement this iteration for the 'right' action

Returns
-1 when this base class method is left undefined

Definition at line 111 of file Cursor.cpp.

int32 nom::ui::Cursor::move_up ( void  )
protectedvirtual

The deriving classes must implement this iteration for the 'up' action

Returns
-1 when this base class method is left undefined

Definition at line 96 of file Cursor.cpp.

int32 nom::ui::Cursor::x ( void  ) const

X axis position

Returns
The position this cursor is on in the X axis

Definition at line 76 of file Cursor.cpp.

int32 nom::ui::Cursor::y ( void  ) const

Y axis position

Returns
The position this cursor is on in the Y axis

Definition at line 81 of file Cursor.cpp.

Member Data Documentation

bool nom::ui::Cursor::locked_
private

Convenience variable left to the end-user to define, if chosen.

Initialized to false at object creation.

Definition at line 105 of file Cursor.hpp.


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