mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-19 12:35:52 -04:00
If you specify a custom resolution by doing /client resolution, that resolution is saved and used for subsequent sessions
This commit is contained in:
parent
bd3b131e3d
commit
cb2bce7e4c
@ -1,6 +1,7 @@
|
||||
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using ClassicalSharp.Renderers;
|
||||
using OpenTK.Input;
|
||||
@ -110,7 +111,9 @@ namespace ClassicalSharp.Commands {
|
||||
} else if (width <= 0 || height <= 0) {
|
||||
game.Chat.Add("&e/client: &cWidth and height must be above 0.");
|
||||
} else {
|
||||
game.window.ClientSize = new System.Drawing.Size(width, height);
|
||||
game.window.ClientSize = new Size(width, height);
|
||||
Options.Set(OptionsKey.WindowWidth, width);
|
||||
Options.Set(OptionsKey.WindowHeight, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ namespace ClassicalSharp {
|
||||
internal void OnLoad() {
|
||||
Mouse = window.Mouse;
|
||||
Keyboard = window.Keyboard;
|
||||
Options.Load();
|
||||
|
||||
#if ANDROID
|
||||
Graphics = new OpenGLESApi();
|
||||
|
@ -13,7 +13,7 @@ namespace ClassicalSharp {
|
||||
public const string AppName = "ClassicalSharp 0.99.9.5";
|
||||
|
||||
public static string AppDirectory;
|
||||
#if !LAUNCHER
|
||||
#if !LAUNCHER
|
||||
[STAThread]
|
||||
static void Main(string[] args) {
|
||||
AppDirectory = AppDomain.CurrentDomain.BaseDirectory;
|
||||
@ -33,10 +33,17 @@ namespace ClassicalSharp {
|
||||
nullContext = false;
|
||||
#endif
|
||||
|
||||
int width = 854, height = 480;
|
||||
DisplayDevice device = DisplayDevice.Primary;
|
||||
if (device.Width < 854) width = 640;
|
||||
|
||||
Options.Load();
|
||||
int width = Options.GetInt(OptionsKey.WindowWidth, 0, 65536, 0);
|
||||
int height = Options.GetInt(OptionsKey.WindowHeight, 0, 65536, 0);
|
||||
|
||||
// No custom resolution has been set
|
||||
if (width == 0 || height == 0) {
|
||||
width = 854; height = 480;
|
||||
DisplayDevice device = DisplayDevice.Primary;
|
||||
if (device.Width < 854) width = 640;
|
||||
}
|
||||
|
||||
if (args.Length == 0 || args.Length == 1) {
|
||||
const string skinServer = "http://static.classicube.net/skins/";
|
||||
string user = args.Length > 0 ? args[0] : "Singleplayer";
|
||||
@ -44,7 +51,7 @@ namespace ClassicalSharp {
|
||||
game.Run();
|
||||
} else if (args.Length < 4) {
|
||||
Utils.LogDebug("ClassicalSharp.exe is only the raw client. You must either use the launcher or"
|
||||
+ " provide command line arguments to start the client.");
|
||||
+ " provide command line arguments to start the client.");
|
||||
} else {
|
||||
RunMultiplayer(args, nullContext, width, height);
|
||||
}
|
||||
@ -77,7 +84,7 @@ namespace ClassicalSharp {
|
||||
game.Run();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
internal static void CleanupMainDirectory() {
|
||||
string mapPath = Path.Combine(Program.AppDirectory, "maps");
|
||||
|
@ -32,6 +32,8 @@ namespace ClassicalSharp {
|
||||
public const string Mipmaps = "gfx-mipmaps";
|
||||
public const string SurvivalMode = "game-survivalmode";
|
||||
public const string ChatLogging = "chat-logging";
|
||||
public const string WindowWidth = "window-width";
|
||||
public const string WindowHeight = "window-height";
|
||||
|
||||
public const string HacksOn = "hacks-hacksenabled";
|
||||
public const string FieldOfView = "hacks-fov";
|
||||
|
@ -35,6 +35,8 @@ typedef UInt8 FpsLimitMethod;
|
||||
#define OptionsKey_Mipmaps "gfx-mipmaps"
|
||||
#define OptionsKey_SurvivalMode "game-survivalmode"
|
||||
#define OptionsKey_ChatLogging "chat-logging"
|
||||
#define OptionsKey_WindowWidth "window-width"
|
||||
#define OptionsKey_WindowHeight "window-height"
|
||||
|
||||
#define OptionsKey_HacksEnabled "hacks-hacksenabled"
|
||||
#define OptionsKey_FieldOfView "hacks-fov"
|
||||
|
Loading…
x
Reference in New Issue
Block a user