对于描述对象位置和大小的矩形来说,什么是一个好的变量名?

发布于 2024-07-19 07:12:50 字数 191 浏览 5 评论 0原文

标题是相当不言自明的,但我会重申:对于描述对象位置和大小的矩形来说,什么是一个好的变量名称。

编辑 - 该对象是类似乒乓球游戏的球拍,并且已经有一个名为“bounds”的矩形来限制球拍可以移动到的位置。

我最终选择了桨位置和大小的“边界”,以及限制桨可以移动的位置的“movableArea”。

The title is fairly self-explanatory, but I'll reiterate: What would be a good variable name for a rectangle that describes an objects position and size.

EDIT - The object is a paddle for a Pong-like game, and there is already a rectangle named 'bounds' to restrict where the paddle can be moved to.

I ended up going with 'bounds' for the paddles position and size, and 'movableArea' to restricted where the paddle can be moved.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

下雨或天晴 2024-07-26 07:12:50

如果它是一个桨,那为什么不使用 paddleBound 呢? 这不是火箭科学,它描述了对象及其属性,并且应该足以将其与其他任何东西区分开来,除了另一个桨(然后您可以使用 paddel1Bound 或 userPaddleBound 进行进一步区分)。

If it's a paddle, then why not paddleBound? That's not rocket science, it describes the object and its property and should be enough to distinguish it from anything else, except maybe the other paddle (then you can just use paddel1Bound or userPaddleBound for further distinction).

冷了相思 2024-07-26 07:12:50

鉴于您问题的背景,为什么不使用 Paddle?

Given the context of your question, why not Paddle?

薔薇婲 2024-07-26 07:12:50

BoundingBox 可能不错。

BoundingBox might be good.

没有伤那来痛 2024-07-26 07:12:50

boundingBox 或boundsRect 怎么样?

How about boundingBox or boundsRect?

你爱我像她 2024-07-26 07:12:50

Apple 的 Cocoa 框架对这种变量使用 framebounds (含义略有不同)。 我一直觉得他们很好。 如果您只需要一个,我投票给frame

Apple's Cocoa framework uses frame and bounds (with slightly different meanings) for this kind of variable. I've always found them to be good. If you need just one, I vote for frame.

梦中楼上月下 2024-07-26 07:12:50

好吧,如果变量的类型是 Foo 我会选择

foo矩形

或类似的东西。 它还取决于语言和约定,也许还取决于上下文。

Well, if the variable is of type Foo I would choose

fooRectangle

Or something similar to that. It also depends on the language and what the conventions are and perhaps the context.

╰◇生如夏花灿烂 2024-07-26 07:12:50

我比较喜欢短的。 xy盒子怎么样?

I prefer short. How about xyBox?

无语# 2024-07-26 07:12:50

周长怎么样?

How about perimeter?

风追烟花雨 2024-07-26 07:12:50

那这个呢 ?

矩形下边界; // 桨可以移动到

矩形边界的边界; // 当前边界

what about this ?

Rectangle nextBounds; // bounds where the paddle can be moved to

Rectangle bounds; // current bounds

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文