Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


How can I make a console app full screen in C#?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 aaronson2012   Members   -  Reputation: 101

Like
0Likes
Like

Posted 06 October 2010 - 02:11 PM

I'm making an old-school text-based adventure game and I wish to make the console full screen.

This would help in capturing the atmosphere of old games like that, but how can I go about doing this?

Thank you for your reply!

Sponsor:

#2 signal_   Members   -  Reputation: 366

Like
0Likes
Like

Posted 06 October 2010 - 03:18 PM

First off, I am not a C# master so take this with a grain of salt. Perhaps someone could expand or offer a better solution. It seems like there should be an easy way to do this, but I guess not.

I got this code/discussion from here in case you wanted to read what the others had to say.

Here's some code:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace ConsoleApplication1
{
class Program
{
[DllImport("kernel32.dll", ExactSpelling = true)]

private static extern IntPtr GetConsoleWindow();
private static IntPtr ThisConsole = GetConsoleWindow();

[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]

private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
private const int HIDE = 0;
private const int MAXIMIZE = 3;
private const int MINIMIZE = 6;
private const int RESTORE = 9;

static void Main(string[] args)
{
Console.SetWindowSize(Console.LargestWindowWidth, Console.LargestWindowHeight);
ShowWindow(ThisConsole, MAXIMIZE);

Console.WriteLine("Hello World in Full Screen!");
Console.ReadLine();
}
}
}





Edit: Forgot to say this is not true full screen and the display height and width would determine the size of the screen so it might not be an acceptable solution....

#3 braindigitalis   Members   -  Reputation: 230

Like
0Likes
Like

Posted 06 October 2010 - 08:45 PM

I am not sure full screen mode is supported any more. To prove this open a command prompt with start->run 'cmd' and press alt-enter. You will get a message 'This system does not support fullscreen mode.' As i have understood from vista onwards this is not supported so anyone beyond XP (which lets face it, is an old and fast-becoming unsupported OS!) won't be able to play your game fullscreen anyway.

You might want to take note that this is a depreciated feature before coding in support for it at all.

Instead you could emulate full screen in XNA with a SpriteFont, or something like that? It would appear like fullscreen but be much wider in compatibility than trying a real text-mode fullscreen.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS