annotate src/parpg/grease/impl/mode.py @ 64:32faacaf6f28

Added funcionality to load Entities from file
author KarstenBock@gmx.net
date Mon, 05 Sep 2011 14:47:21 +0200
parents 09b581087d68
children
rev   line source
27
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
1 #############################################################################
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
2 #
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
3 # Copyright (c) 2010 by Casey Duncan and contributors
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
4 # All Rights Reserved.
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
5 #
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
6 # This software is subject to the provisions of the MIT License
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
7 # A copy of the license should accompany this distribution.
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
8 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
9 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
10 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
11 #
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
12 #############################################################################
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
13 """
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
14 Modes manage the state and transition between different application modes.
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
15 Typically such modes are presented as different screens that the user can
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
16 navigate between, similar to the way a browser navigates web pages. Individual
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
17 modes may be things like:
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
18
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
19 - Title screen
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
20 - Options dialog
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
21 - About screen
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
22 - In-progress game
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
23 - Inventory interface
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
24
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
25 The modal framework provides a simple mechanism to ensure that modes are
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
26 activated and deactivated properly. An activated mode is running and receives
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
27 events. A deactivated mode is paused and does not receive events.
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
28
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
29 Modes may be managed as a *last-in-first-out* stack, or as a list, or ring
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
30 of modes in sequence, or some combination of all.
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
31
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
32 For example usage see: :ref:`the mode section of the tutorial <tut-mode-section>`.
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
33 """
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
34
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
35 __version__ = '$Id$'
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
36
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
37 import abc
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
38 import pyglet
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
39 from grease.mode import *
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
40
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
41 class PygletManager(BaseManager):
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
42 """Mode manager abstract base class using pyglet.
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
43
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
44 The mode manager keeps a stack of modes where a single mode
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
45 is active at one time. As modes are pushed on and popped from
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
46 the stack, the mode at the top is always active. The current
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
47 active mode receives events from the manager's event dispatcher.
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
48 """
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
49
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
50 event_dispatcher = None
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
51 """:class:`pyglet.event.EventDispatcher` object that the
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
52 active mode receive events from.
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
53 """
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
54
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
55 def activate_mode(self, mode):
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
56 """Perform actions to activate a node
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
57
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
58 :param mode: The :class: 'Mode' object to activate
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
59 """
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
60 BaseManager.activate_mode(self, mode)
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
61 self.event_dispatcher.push_handlers(mode)
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
62
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
63 def deactivate_mode(self, mode):
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
64 """Perform actions to deactivate a node
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
65
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
66 :param mode: The :class: 'Mode' object to deactivate
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
67 """
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
68 BaseManager.deactivate_mode(self, mode)
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
69 self.event_dispatcher.remove_handlers(mode)
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
70
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
71 class Manager(PygletManager):
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
72 """A basic mode manager that wraps a single
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
73 :class:`pyglet.event.EventDispatcher` object for use by its modes.
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
74 """
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
75
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
76 def __init__(self, event_dispatcher):
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
77 self.modes = []
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
78 self.event_dispatcher = event_dispatcher
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
79
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
80
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
81 class ManagerWindow(PygletManager, pyglet.window.Window):
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
82 """An integrated mode manager and pyglet window for convenience.
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
83 The window is the event dispatcher used by modes pushed to
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
84 this manager.
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
85
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
86 Constructor arguments are identical to :class:`pyglet.window.Window`
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
87 """
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
88
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
89 def __init__(self, *args, **kw):
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
90 super(ManagerWindow, self).__init__(*args, **kw)
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
91 self.modes = []
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
92 self.event_dispatcher = self
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
93
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
94 def on_key_press(self, symbol, modifiers):
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
95 """Default :meth:`on_key_press handler`, pops the current mode on ``ESC``"""
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
96 if symbol == pyglet.window.key.ESCAPE:
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
97 self.pop_mode()
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
98
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
99 def on_last_mode_pop(self, mode):
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
100 """Hook executed when the last mode is popped from the manager.
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
101 When the last mode is popped from a window, an :meth:`on_close` event
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
102 is dispatched.
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
103
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
104 :param mode: The :class:`Mode` object just popped from the manager
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
105 """
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
106 self.dispatch_event('on_close')
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
107
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
108
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
109 class Mode(BaseMode):
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
110 """Application mode abstract base class using pyglet
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
111
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
112 Subclasses must implement the :meth:`step` method
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
113
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
114 :param step_rate: The rate of :meth:`step()` calls per second.
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
115
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
116 :param master_clock: The :class:`pyglet.clock.Clock` interface used
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
117 as the master clock that ticks the world's clock. This
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
118 defaults to the main pyglet clock.
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
119 """
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
120 clock = None
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
121 """The :class:`pyglet.clock.Clock` instance used as this mode's clock.
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
122 You should use this clock to schedule tasks for this mode, so they
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
123 properly respect when the mode is active or inactive
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
124
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
125 Example::
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
126
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
127 my_mode.clock.schedule_once(my_cool_function, 4)
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
128 """
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
129
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
130 def __init__(self, step_rate=60, master_clock=pyglet.clock,
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
131 clock_factory=pyglet.clock.Clock):
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
132 BaseMode.__init__(self)
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
133 self.step_rate = step_rate
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
134 self.time = 0.0
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
135 self.master_clock = master_clock
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
136 self.clock = clock_factory(time_function=lambda: self.time)
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
137 self.clock.schedule_interval(self.step, 1.0 / step_rate)
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
138
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
139 def on_activate(self):
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
140 """Being called when the Mode is activated"""
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
141 self.master_clock.schedule(self.tick)
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
142
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
143 def on_deactivate(self):
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
144 """Being called when the Mode is deactivated"""
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
145 self.master_clock.unschedule(self.tick)
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
146
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
147 def tick(self, dt):
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
148 """Tick the mode's clock.
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
149
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
150 :param dt: The time delta since the last tick
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
151 :type dt: float
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
152 """
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
153 self.time += dt
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
154 self.clock.tick(poll=False)
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
155
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
156 @abc.abstractmethod
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
157 def step(self, dt):
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
158 """Execute a timestep for this mode. Must be defined by subclasses.
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
159
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
160 :param dt: The time delta since the last time step
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
161 :type dt: float
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
162 """
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
163
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
164 class Multi(BaseMulti, Mode):
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
165 """A mode with multiple submodes. One submode is active at one time.
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
166 Submodes can be switched to directly or switched in sequence. If
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
167 the Multi is active, then one submode is always active.
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
168
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
169 Multis are useful when modes can switch in an order other than
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
170 a LIFO stack, such as in "hotseat" multiplayer games, a
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
171 "wizard" style ui, or a sequence of slides.
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
172
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
173 Note unlike a normal :class:`Mode`, a :class:`Multi` doesn't have it's own
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
174 :attr:`clock` and :attr:`step_rate`. The active submode's are used
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
175 instead.
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
176 """
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
177
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
178 def __init__(self, submodes):
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
179 BaseMulti.__init__(self, submodes)
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
180 self.time = 0.0
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
181
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
182
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
183 def _set_active_submode(self, submode):
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
184 BaseMulti._set_active_submode(self, submode)
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
185 self.master_clock = submode.master_clock
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
186 self.clock = submode.clock
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
187
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
188 def clear_subnode(self):
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
189 """Clear any subnmode data"""
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
190 BaseMulti.clear_subnode(self)
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
191 self.master_clock = None
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
192 self.clock = None
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
193
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
194 def tick(self, dt):
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
195 """Tick the active submode's clock.
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
196
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
197 :param dt: The time delta since the last tick
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
198 :type dt: float
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
199 """
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
200 self.time += dt
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
201 if self.active_submode is not None:
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
202 self.active_submode.clock.tick(poll=False)
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
203