Eiffel Media API
Overview Cluster Class Classes Index      Previous Next      Top Features

em.utility

Class EM_DELAYED_PROCEDURES


Direct ancestors

EM_TIME_SINGLETON

Known direct descendants

EM_TIME, EM_UDP_SOCKET, EM_NET_GROUP

Creation

Features

Invariants

indexing

description

Delayed procedures.

date

$Date: 2005/10/24 04:01:08 $

revision

$Revision: 1.4 $

class

EM_DELAYED_PROCEDURES

inherit

EM_TIME_SINGLETON

create

make

-- Init

feature -- Initialization

make

-- Init

feature -- Access

time: EM_TIME

-- Returns reference to the singleton

-- (From EM_TIME_SINGLETON)

ensure
time_not_void: Result /= Void

feature -- Basic operations

add_timed_procedure (a_procedure: PROCEDURE[ANY,TUPLE]; a_time_offset_in_ms: INTEGER)

-- Add a_procedure which will be called in TIME_OFFSET miliseconds from "now" in the same thread!
-- Use the feature "process" to call all procedures whose time is up.
-- You could use EM_TIME_SINGLETON for global timing: The EM_EVENT_LOOP will call "process" each loop once.
-- You can also use the EM_EVENT_LOOP to have a per scene executeion.

require
a_procedure /=Voida_time_offset_in_ms >= 0
process_timed_procedures_in_same_thread

-- executes all stored procedures whose time is up...
-- Make sure you don't add procedures which use a lot of computation time. Only small, short
-- procedures are appropriate. Otherwise use add_timed_callback which runs functions in a different thread
-- to avoid a laggy reaction to other events.

wipe_out_all_timed_procedures

-- clear the whole "delayed procedure call" list (procedures added with add_procedure, executed with execute)

feature -- Setters

set_are_timed_procedures_paused (a_value: BOOLEAN)

-- Set are_timed_procedures_paused to a_value
-- Use this to pause the procedure callbacks. This is really usefull if you want to pause a game!
-- However, this will not pause functions added with add_timed_callback.

ensure
are_timed_procedures_paused_set: are_timed_procedures_paused = a_value

feature -- Attributes

are_timed_procedures_paused: BOOLEAN

-- Are timed prcedures paused?

invariant


-- From ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)

end