Public Member Functions | Private Types | Private Member Functions | Private Attributes

test_utils::fake_event_source Class Reference

fake_event_source is used to generate new events in events::pump() Timing used in function is loop counter incremented everytime events::pump() is called. More...

#include <fake_event_source.hpp>

Inheritance diagram for test_utils::fake_event_source:
Inheritance graph
[legend]
Collaboration diagram for test_utils::fake_event_source:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 fake_event_source ()
 ~fake_event_source ()
void add_event (const size_t time, const SDL_Event &event)
 adds a generic event to queue
void add_event (event_node_ptr new_node)
 adds any type of event to queue
void start ()
 Sets event time source back to zero.
event_node_ptr press_key (const size_t time, const SDLKey key, const SDLMod mod=KMOD_NONE)
 adds keyboard press event to queue
event_node_ptr release_key (const size_t time, const SDLKey key, const SDLMod mod=KMOD_NONE)
 adds keyboard release event to queue
event_node_ptr type_key (const size_t time, const SDLKey key, const SDLMod mod=KMOD_NONE)
 Just push and release a key release is done in time+1.
event_node_ptr move_mouse (const size_t time, const int x, const int y)
 Adds mouse motion event to queue.
event_node_ptr mouse_press (const size_t time, const Uint8 button)
 adds mouse button click event to queue
event_node_ptr mouse_release (const size_t time, const Uint8 button)
 adds mouse button realease event to queue
event_node_ptr mouse_click (const size_t time, const Uint8 button)
 Make mouse click that equals to press and release relase is done in time+1.
void process (events::pump_info &)
 Called by events::pump() to fire events.

Private Types

typedef std::priority_queue
< event_node_ptr, std::vector
< event_node_ptr >, less_ptr
< event_node_ptr > > 
event_queue

Private Member Functions

SDL_Event make_key_event (Uint8 type, const SDLKey key, const SDLMod mod)
SDL_Event make_mouse_click_event (const Uint8 type, const Uint8 button)

Private Attributes

size_t frame_count_
event_queue queue_

Detailed Description

fake_event_source is used to generate new events in events::pump() Timing used in function is loop counter incremented everytime events::pump() is called.

Definition at line 112 of file fake_event_source.hpp.


Member Typedef Documentation

Definition at line 117 of file fake_event_source.hpp.


Constructor & Destructor Documentation

test_utils::fake_event_source::fake_event_source (  ) 

Definition at line 95 of file fake_event_source.cpp.

test_utils::fake_event_source::~fake_event_source (  ) 

Definition at line 101 of file fake_event_source.cpp.

References events::pump(), and queue_.

Here is the call graph for this function:


Member Function Documentation

void test_utils::fake_event_source::add_event ( const size_t  time,
const SDL_Event &  event 
)

adds a generic event to queue

Definition at line 114 of file fake_event_source.cpp.

References queue_.

Referenced by mouse_press(), mouse_release(), move_mouse(), test_utils::play_scenario::play(), press_key(), and release_key().

Here is the caller graph for this function:

void test_utils::fake_event_source::add_event ( event_node_ptr  new_node  ) 

adds any type of event to queue

Definition at line 120 of file fake_event_source.cpp.

References queue_.

SDL_Event test_utils::fake_event_source::make_key_event ( Uint8  type,
const SDLKey  key,
const SDLMod  mod 
) [private]

Definition at line 130 of file fake_event_source.cpp.

Referenced by press_key(), and release_key().

Here is the caller graph for this function:

SDL_Event test_utils::fake_event_source::make_mouse_click_event ( const Uint8  type,
const Uint8  button 
) [private]

Definition at line 156 of file fake_event_source.cpp.

Referenced by mouse_press(), and mouse_release().

Here is the caller graph for this function:

event_node_ptr test_utils::fake_event_source::mouse_click ( const size_t  time,
const Uint8  button 
)

Make mouse click that equals to press and release relase is done in time+1.

Returns:
release event only

Definition at line 184 of file fake_event_source.cpp.

References mouse_press(), and mouse_release().

Here is the call graph for this function:

event_node_ptr test_utils::fake_event_source::mouse_press ( const size_t  time,
const Uint8  button 
)

adds mouse button click event to queue

Definition at line 168 of file fake_event_source.cpp.

References add_event(), and make_mouse_click_event().

Referenced by mouse_click().

Here is the call graph for this function:

Here is the caller graph for this function:

event_node_ptr test_utils::fake_event_source::mouse_release ( const size_t  time,
const Uint8  button 
)

adds mouse button realease event to queue

Definition at line 176 of file fake_event_source.cpp.

References add_event(), and make_mouse_click_event().

Referenced by mouse_click().

Here is the call graph for this function:

Here is the caller graph for this function:

event_node_ptr test_utils::fake_event_source::move_mouse ( const size_t  time,
const int  x,
const int  y 
)

Adds mouse motion event to queue.

Definition at line 145 of file fake_event_source.cpp.

References add_event().

Here is the call graph for this function:

event_node_ptr test_utils::fake_event_source::press_key ( const size_t  time,
const SDLKey  key,
const SDLMod  mod = KMOD_NONE 
)

adds keyboard press event to queue

Definition at line 190 of file fake_event_source.cpp.

References add_event(), and make_key_event().

Referenced by type_key().

Here is the call graph for this function:

Here is the caller graph for this function:

void test_utils::fake_event_source::process ( events::pump_info  )  [virtual]

Called by events::pump() to fire events.

Implements events::pump_monitor.

Definition at line 212 of file fake_event_source.cpp.

References events::commands_disabled, frame_count_, and queue_.

event_node_ptr test_utils::fake_event_source::release_key ( const size_t  time,
const SDLKey  key,
const SDLMod  mod = KMOD_NONE 
)

adds keyboard release event to queue

Definition at line 198 of file fake_event_source.cpp.

References add_event(), and make_key_event().

Referenced by type_key().

Here is the call graph for this function:

Here is the caller graph for this function:

void test_utils::fake_event_source::start (  ) 

Sets event time source back to zero.

Definition at line 125 of file fake_event_source.cpp.

References frame_count_.

event_node_ptr test_utils::fake_event_source::type_key ( const size_t  time,
const SDLKey  key,
const SDLMod  mod = KMOD_NONE 
)

Just push and release a key release is done in time+1.

Returns:
release event only

Definition at line 206 of file fake_event_source.cpp.

References press_key(), and release_key().

Referenced by test_utils::play_scenario::add_formula_command(), test_utils::play_scenario::add_initial_signals(), test_utils::add_key_type_to_source::operator()(), and test_utils::play_scenario::play().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 116 of file fake_event_source.hpp.

Referenced by process(), and start().

Definition at line 119 of file fake_event_source.hpp.

Referenced by add_event(), process(), and ~fake_event_source().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:26:08 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs