简体   繁体   English

Visual Basic 2010快速写作

[英]Visual Basic 2010 Fast Writing

I am working on developing a simple console game in Visual Basic in which the "level" is drawn out after being read from a file. 我正在用Visual Basic开发一个简单的控制台游戏,在该游戏中,从文件中读取“等级”后便将其绘制出来。

So far, I'm using 到目前为止,我正在使用

Console.ReadKey()

to check for the arrow keys and to therefore move the position of the piece on the console. 检查箭头键,从而在控制台上移动棋子的位置。

The problem is that the only way I know to do this is to redraw the "level" every time that the piece moves - which is relatively slow. 问题是,我知道做到这一点的唯一方法是每次棋子移动时都重新绘制“水平”,这相对较慢。

Is there any better way to achieve this? 有没有更好的方法来实现这一目标?

Three solutions: 三种解决方案:

  1. Redraw only the changing screen chars. 仅重绘更改的屏幕字符。
  2. Skip Console functions and use WINAPI WriteConsole (a little example to use WINAPI console functions). 跳过控制台功能并使用WINAPI WriteConsole (使用WINAPI控制台功能的小示例 )。
  3. Use Forms and draw the text into a window. 使用表单并将文本绘制到窗口中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM