Console Resizing (Problem SOLVED; See for answer)

Started by
2 comments, last by Peon 20 years, 7 months ago
I'm working on a Strategy RPG (ala Final Fantasy Tactics) using a console window, and am finding that the number of characters vertically (default window is 80x25, I think?) is a real pain. My current character design calls for a 'sprite' that is 8 characters tall; that means only 3 could possibly fit vertically. Needless to say, this would clutter the screen quickly. Is there any function that I could use to change the dimensions of the console window? My console class uses Win32 functions, so something of that nature would be very useful. [edited by - Peon on September 2, 2003 3:52:54 PM]
Peon
Advertisement
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/console_functions.asp

I have done this before but I can't remember exactly how it works. You should be able to find what you need at MSDN though.

PS:

Also, you might want to browse around that chapter of MSDN and read more about how consoles work. For example:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/creation_of_a_console.asp


[edited by - Martel on September 2, 2003 5:44:00 AM]
Thanks for those links. I read over the functions that seemed to apply, as well as the link regarding how console work -- no luck. I did however, find functions that looked promising. For some unknown reason, I can't get them to work. Perhaps if anyone has time, they could try these?

Using a call to SetConsoleWindowInfo , I can "set the current size and position of a console screen buffer's window." Looks promising, but I call it with the new dimensions and nothing happens.

I then try a call to the GetConsoleScreenBufferInfo function. It can tell me:

* The current size of the console screen buffer
* The current location of the window
* The maximum size of the window given the current screen buffer size, the current font size, and the screen size

Okay great, I request the maximum size of the window, given those conditions, and the maximum size is unfortunately 80x25, which is the default amount. However, I know that from the GetLargestConsoleWindowSize function, the real max is more like 120x55. This maximum DOES NOT include the size of the screen buffer, so I suspect my screen buffer is too small.

Finally, I call SetConsoleScreenBufferSize and send it the new dimensions of the ScreenBuffer, before calling SetConsoleWindowInfo again to change the window size. Still no luck.

I know that this is really an obscure problem, but if anyone can help, it's much appreciated.


[edited by - Peon on September 2, 2003 2:01:51 PM]
Peon
Wow, well it took a bit of sleuthing, but I finally found an answer on a great website for console programming. It covers basic I/O, colors, window resizing, even mouse events on a console. I highly recommend it to all newbies who are doing console program. There is a lot of nifty stuff you can do, that you probably don''t know about

AdrianXW''s Console Tutorials

I think the problem was that I was making my window size and screen buffer size the same; after doing the tutorial and reading the description of the window sizing function, it turns out that the window dimensions cannot be equal to or greater than the dimensions of the buffer (woops)
Peon

This topic is closed to new replies.

Advertisement