Home - Forums - Documentation - Gallery - Bugs
Current revision (20:08, 25 March 2009) (edit) (undo)
 
Line 1: Line 1:
 +
= CrystalSpace =
-
= Querying for a component =
+
== Querying for a component ==
-
 
+
<source lang="python">
<source lang="python">
- 
VirtualClock = object_reg.Get(iVirtualClock)
VirtualClock = object_reg.Get(iVirtualClock)
- 
</source>
</source>
-
 
+
== Checking a keyboard event ==
-
= Checking an event =
+
<source lang="python">
<source lang="python">
-
 
+
if ev.Name == self.KeyboardDown:
-
cooked = csKeyEventHelper.GetCookedCode(ev)
+
cooked = csKeyEventHelper.GetCookedCode(ev)
-
raw = csKeyEventHelper.GetRawCode(ev)
+
raw = csKeyEventHelper.GetRawCode(ev)
-
 
+
</source>
</source>
Line 24: Line 20:
-
= Checking time =
+
== Checking time ==
<source lang="python">
<source lang="python">
- 
elapsed = VirtualClock.GetElapsedTicks()
elapsed = VirtualClock.GetElapsedTicks()
absolute = VirtualClock.GetCurrentTicks()
absolute = VirtualClock.GetCurrentTicks()
- 
</source>
</source>
elapsed is the time elapsed since last call
elapsed is the time elapsed since last call
absolute time elapsed since the start
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 |