Home - Forums - Documentation - Gallery - Bugs
(New page: = Checking an event = csKeyEventHelper.GetCookedCode(ev) raw = csKeyEventHelper.GetRawCode(ev) * cooked means modifiers are applied (shift+a == 'A') * raw is just the key (shift+a ==...)
Current revision (20:08, 25 March 2009) (edit) (undo)
 
(One intermediate revision not shown.)
Line 1: Line 1:
-
= Checking an event =
+
= CrystalSpace =
 +
 
 +
== Querying for a component ==
 +
 
 +
<source lang="python">
 +
VirtualClock = object_reg.Get(iVirtualClock)
 +
</source>
 +
 
 +
== Checking a keyboard event ==
 +
 
 +
<source lang="python">
 +
if ev.Name == self.KeyboardDown:
 +
cooked = csKeyEventHelper.GetCookedCode(ev)
 +
raw = csKeyEventHelper.GetRawCode(ev)
 +
</source>
-
csKeyEventHelper.GetCookedCode(ev)
 
-
raw = csKeyEventHelper.GetRawCode(ev)
 
* cooked means modifiers are applied (shift+a == 'A')
* cooked means modifiers are applied (shift+a == 'A')
* raw is just the key (shift+a == 'a')
* raw is just the key (shift+a == 'a')
 +
 +
 +
== Checking time ==
 +
<source lang="python">
 +
elapsed = VirtualClock.GetElapsedTicks()
 +
absolute = VirtualClock.GetCurrentTicks()
 +
</source>
 +
 +
elapsed is the time elapsed since last call
 +
absolute time elapsed since the start
 +
 +
= CEL =

Current revision

Contents

CrystalSpace

Querying for a component

VirtualClock = object_reg.Get(iVirtualClock)

Checking a keyboard event

if ev.Name == self.KeyboardDown:
  cooked = csKeyEventHelper.GetCookedCode(ev)
  raw = csKeyEventHelper.GetRawCode(ev)


* cooked means modifiers are applied (shift+a == 'A')
* raw is just the key (shift+a == 'a')


Checking time

elapsed = VirtualClock.GetElapsedTicks()
 absolute = VirtualClock.GetCurrentTicks()

elapsed is the time elapsed since last call absolute time elapsed since the start

CEL

| Article | Discussion | View source | History |