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

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

问题描述

我来自一个背景,主要是开发网站,也许一些简单的基于表单的应用程序。 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?

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

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.

感谢:)

推荐答案

查看本教程:

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

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

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

祝你好运!

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

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