我正在尝试用C ++拼凑一个小小的roguelike,但是我遇到了一个问题-为了使游戏能够正确显示,控制台窗口必须有点宽(大约45行) ,115列).右键单击菜单栏并为具有相同名称的Windows设置默认值,更改起来很容易,但是有一种方法可以自动从代码中进行设置,因此我不必让潜在用户弄乱它?我正在使用Pdcurses处理输出,如果有帮助的话.
I'm trying my hand at throwing together a minor roguelike in C++, but I've run into a problem - in order to get the game to display correctly, the console window has to be a bit wide (around 45 rows, 115 cols). It's easy enough to change by right clicking on the menu bar and setting the defaults for windows with the same name, but is there a way I could set it automatically from the code so I don't have to ask potential users to mess with that? I'm using Pdcurses to handle output, if that helps at all.
推荐答案这是一个非常老的问题,但是我还是会贴出答案,以防将来对某人有所帮助. 这是我在MS Windows中使用的:
This is a really old question, but I'll post my answer anyway in case it helps someone in the future. This is what I use in MS Windows:
int err = system("mode con lines=45 cols=115");我直接在调用initscr();之前使用它,它的工作原理就像是一种魅力. 显然,这不是很可移植,但是如果您使用的是Windows,那么它就可以解决问题.
I use this directly before my call to initscr();, and it works like a charm. This is, obviously, not very portable, but it does the trick if all you're developing on is Windows.
更多推荐
有没有一种方法可以强制控制台应用程序以一定的窗口大小运行(使用Pdcurses)?
发布评论