无为而治是什么意思By Jeff VerkoeyenThis article is going to cover the creation of a game system using what I call modules. The design of a module system is relatively simple and once you've put it together correctly, you'll be able to make different parts of your game very easily and basically plug them in wherever you want. Each module will inherit from a module class and implement 3 virtual functions which will handle initialization, execution, and cleanup. We can add other functions, but these are the three basic functions. The Module prototype looks like this: 百度 分析人士认为,无标可投的状况大概在春节后1-2个月即可得到缓解,广大投资者不必为此过于担忧。 class Module { private: public: virtual void Initialize()=0; virtual Module* ExecuteModule()=0; virtual void Shutdown()=0; };We won't go through actually implementing a module, as that should be easy to do. We're going to concentrate more on the frame of the module program itself. Next we need to make the game loop, which is also very simple: Module* oldMod=gamemod; if((gamemod=gamemod->ExecuteModule())!=oldMod) { lastMod=oldMod; lastMod->Shutdown(); gamemod->Initialize(); }This code grabs the current module (gamemod being a predeclare Module* that points to whichever module you are currently wanting to run), it then runs the module and the execute module function will return a Module* If this returned Module* doesn't equal the old Module*, then that means we've changed modules, so we shut down the old module and initialize the new one, and then continue on in the game loop. With those few lines of code, you can create whatever you want and expand however you want in any direction and have interlinked modules linking to each other very easily. This is a great alternative to having a switch statement testing the current game state, and also works very nicely for developing games rather quickly (this is the method I use in developing games for the 72 hour game development competitions). Hopefully that sheds some light on an easier method of game development! Read the discussion! Related articles Classes in C++ Understanding inheritance |
梦见很多苍蝇是什么意思 | 尿黄是什么原因男性 | 虎鲸为什么对人类友好 | 金鱼沉底不动什么原因 | 每个月月经都提前是什么原因 |
肾有结晶是什么意思 | 诸法无我是什么意思 | 正印是什么意思 | 501是什么意思 | 西游记什么时候拍的 |
宫颈纳囊是什么 | 没有料酒可以用什么代替 | 去极化是什么意思 | 什么是双飞 | 长绒棉是什么面料 |
第一次坐飞机注意什么 | 感冒为什么会发烧 | 禅心是什么意思 | 师长是什么意思 | sids是什么意思 |
2e是什么意思hcv9jop1ns0r.cn | 瘤是什么意思0735v.com | 进击的巨人真相是什么hcv9jop2ns7r.cn | 什么的流水hcv9jop3ns0r.cn | 半熟芝士是什么意思hcv7jop9ns0r.cn |
壶嘴为什么不能对着人hcv7jop6ns2r.cn | 依巴斯汀片是什么药hcv8jop2ns5r.cn | 结婚12年是什么婚hcv7jop9ns6r.cn | 什么牌子助听器好hcv8jop2ns9r.cn | 区长是什么级别hcv8jop3ns5r.cn |
水泡型脚气用什么药好hcv8jop2ns1r.cn | 牛肉发绿色是什么原因hcv8jop1ns1r.cn | 做宫腔镜检查需要提前做什么准备hcv7jop5ns2r.cn | 什么是痰湿体质hcv7jop6ns7r.cn | 荨麻疹有什么忌口gangsutong.com |
黄瓜为什么是绿色的hcv9jop5ns9r.cn | 尿蛋白三个加号吃什么药hcv9jop0ns0r.cn | 什么是生物钟hanqikai.com | 身上长红痘痘是什么原因hcv9jop2ns2r.cn | 松垮是什么意思hcv8jop9ns4r.cn |