是否有任何控制台“图形” .Net的图书馆? [英] Is there any console "graphics" library for .Net?

查看:123
本文介绍了是否有任何控制台“图形” .Net的图书馆?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的基本目标是编写一个.NET重构的克罗兹王国。对于不熟悉游戏的人:



http:// www .indiefaqs.com / index.php / Kingdom_of_Kroz



http://www.youtube.com/watch?v=cHwlNAFXpIw



原本应该是一个快速分心项目,让我休息一下从所有通用企业WCF / WF / LINQ2SQL / etc工作项目占据我大部分的时间最近。虽然我的努力的结果是可玩的,它看起来像绝对屁股(甚至对于基于控制台的游戏),因为我重新绘制每一帧中的一切。



我知道一些替代的方法,但在简短的测试,我做了他们仍然不提供显着的性能或美观的好处。我不想诉诸一个图书馆,仿效一个控制台,如果我可以帮助它。我喜欢在正确的Win32控制台API下工作,但不是直接使用它,如果我可以帮助它。记住,这是一个明显的利基用例,什么是通常接受的最佳方法呢?有什么特别优化的控制台绘图技术,应该注意吗?我不介意在PInvoke的海中游泳和编组,只要它仍然结束了一个快速,响应和高效的控制台UI。

解决方案

http://msdn.microsoft.com/en- us / library / ms682073(v = VS.85).aspx



这些函数可能需要使用P / Invoke他们应该做你所需要的。您可以在缓冲区中的任意位置写入,并获取基于密钥的非缓冲输入。通常你从GetStdHandle()开始,获取控制台输入和输出streams的句柄,然后从上面的列表中调用一个适当的函数,如WriteConsoleOutputCharacter()或PeekConsoleInput()。



我曾经写过一个库来使用Windows控制台创建一个进程中的窗口系统,并使用简单的Win32 on C. Fun项目,但我不知道现在在哪里。 p>

My basic goal here is writing a .NET remake of Kingdom of Kroz. For those not familiar with the game:

http://www.indiefaqs.com/index.php/Kingdom_of_Kroz

http://www.youtube.com/watch?v=cHwlNAFXpIw

Originally it was supposed to be a quick distraction project to give me a break from all the generic enterprise WCF/WF/LINQ2SQL/etc work projects occupying most of my time lately. While the result of my effort is playable, it looks like absolute arse (even for a console-based game) because of the way I'm redrawing everything in each frame.

I'm aware of some alternate approaches but in the brief tests I've done they still don't offer significant performance or aesthetic benefits. I don't want to resort to a library which 'emulates' a console if I can help it. I'd prefer to work with the proper Win32 console API under the hood, but not to work with it directly if I can help it. Keeping in mind that it's a distinctly niche use case, what would be the 'generally' accepted best approach for this? Are there any particularly optimal console 'drawing' techniques one should be aware of? I don't mind swimming in a sea of PInvoke and marshalling as long as it still ends up with a fast, responsive and efficient console UI.

解决方案

http://msdn.microsoft.com/en-us/library/ms682073(v=VS.85).aspx

Some/many of these functions you might need to use P/Invoke for, but they should do what you need. You can write at arbitrary locations in the buffer and get key-based, non-buffered input. Usually you start with GetStdHandle() to get handles to the console input and output "streams" and then you call one of the appropriate functions from the above list to do something, like WriteConsoleOutputCharacter(), or PeekConsoleInput().

I once wrote a library to create an in-process windowing system using the Windows console and plain Win32 on C. Fun project, but I don't know where it is now.

这篇关于是否有任何控制台“图形” .Net的图书馆?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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