【发布时间】:2012-01-20 17:32:32
【问题描述】:
嘿,我正在我的游戏中实现 MVC,但我无法让这个东西在我的脑海中运行。我将视图与游戏逻辑解耦,控制器也解耦了。事情确实有效,但我无法确定侦听器模式或信号和插槽是否更适合我的情况。
我有几个纯虚方法的基类实体:
onEntityCreate //Called when new entity is allocated
onEntityDelete //Called when new entity is deallocated
onEntityBuild //Called on respawn or spawn
onEntityDispose //Called before respawn or deallocation
onEntityTick //called every tick when is entity "alive"
onEntityUpdate //called when entity position/orientation updates
我想在两个不同的线程中运行视图和逻辑。如果我可以在逻辑结束时调度这些事件,请勾选查看,但我不知道如何。
【问题讨论】:
标签: c++ signals-slots observer-pattern