Spielzustand-Automaten
Aus Spieleprogrammierer-Wiki
(Unterschied zwischen Versionen)
[unmarkierte Version] | [unmarkierte Version] |
(→Grundidee und Architektur) |
(→State: Javaimplementierung hinzugefügt) |
||
Zeile 41: | Zeile 41: | ||
<xh4>C++</xh4> | <xh4>C++</xh4> | ||
| | | | ||
− | <sourcecode lang=cpp tab=4> | + | <sourcecode lang="cpp" tab="4"> |
class State | class State | ||
{ | { | ||
Zeile 59: | Zeile 59: | ||
<xh4>C#</xh4> | <xh4>C#</xh4> | ||
| | | | ||
− | <sourcecode lang=csharp tab=4> | + | <sourcecode lang="csharp" tab="4"> |
public interface State | public interface State | ||
{ | { | ||
Zeile 68: | Zeile 68: | ||
bool OnUpdate(float elapsedTime); | bool OnUpdate(float elapsedTime); | ||
void OnRender(); | void OnRender(); | ||
+ | } | ||
+ | </sourcecode> | ||
+ | }} | ||
+ | |||
+ | {{Spoiler| | ||
+ | <xh4>Java</xh4> | ||
+ | | | ||
+ | <sourcecode lang="java" tab="4"> | ||
+ | public interface State | ||
+ | { | ||
+ | void initialize(); | ||
+ | boolean isInitialized(); | ||
+ | void onEnter(); | ||
+ | void onLeave(); | ||
+ | boolean onUpdate(float elapsedTime); | ||
+ | void onRender(); | ||
} | } | ||
</sourcecode> | </sourcecode> |
Version vom 7. November 2011, 12:16 Uhr
Klicke hier, um diese Version anzusehen.