如何布局简单游戏的代码? [英] How to layout the code of a simple game?

查看:103
本文介绍了如何布局简单游戏的代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我来自背景主要是开发网站,也可能是一些简单的基于表单的应用程序。 MVC适用于此,但我不太明白这是适用于一个游戏。那么你们怎么做呢?



我正在用Qt和OpenGL开发,如果这是相关的。我有一个QGLWidget,我现在基本上用作中央枢纽。它应该将输入传递给Player对象,以便它可以处理它,还是应该直接控制播放器?对象应该绘制自己,还是应该有另一个处理方法?基本上什么地方在哪里?谁处理什么?



相关文章的链接,一些这些问题,提示或文件结构的答案都赞赏。我不太在乎如何编程,只是如何模块化很好。



感谢:)

解决方案

看本教程:



http://ezide.com/games/writing-games.html



它是为python编写的,并解释了MVC对于游戏非常好。



祝你好运!


I'm coming from a background mostly developing websites, and maybe some simple form-based apps. MVC works well for that, but I don't quite see how that's applicable to a game. So how do you guys do it?

I'm developing with Qt and OpenGL, if that's relevant. I have a QGLWidget which I'm basically using as a central hub at the moment. Should it pass off input to a Player object so that it can handle it, or should it control the player directly? Should objects draw themselves, or should there another handler for that? Basically, what goes where? Who handles what?

Links to relevant articles, answers to some of these questions, tips, or file structures are all appreciated. I don't really care about how to program it, just how to modularize nicely.

Thanks :)

解决方案

Look at this tutorial:

http://ezide.com/games/writing-games.html

It is written for python and explains MVC for games very good.

Good Luck!

这篇关于如何布局简单游戏的代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆