Ah okay thanks for explanation!
You mean that my example of commandline arguments width and height still work fine?
I thought I tried example OpenTK 2.00 / 3.00 Preview and it shows normal without resizing mode. It is so impossible because Unity has maybe bug? I will tell you an example of OpenTK I already write that
For example:
hlSharp.exe is launcher
Engine.dll ( just arguments with width and height and any arguments )
PS: Why does Unity Player not recognize switch-case statements ? Only If-else statements? It looks like very old parameters by MDM Zinc Studio / Adobe Air.
I show example codes with OpenTK:
For Engine.dll
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL4;
using System;
using System.Drawing;
using System.IO;
using System.Windows;
namespace Engine
{
public class Client
{
private SDLWindow game;
bool developer = false;
bool showConsole = false;
string gameModDir;
private Point CenterWindowOnScreen()
{
int screenWidth = (int)SystemParameters.PrimaryScreenWidth;
int screenHeight = (int)SystemParameters.PrimaryScreenHeight;
int gameWidth = game.Width;
int gameHeight = game.Height;
return new Point((screenWidth / 2) - (gameWidth / 2), (screenHeight / 2) - (gameHeight / 2));
}
public int Host(string[] args)
{
int argIndex = args.Length;
game = new SDLWindow();;
for (int i = 0; i < argIndex; i++)
{
switch (args[i])
{
case "-width":
case "-w":
game.Width = int.Parse(args[++i]);
break;
case "-height":
case "-h":
game.Height = int.Parse(args[++i]);
break;
case "-game":
if(gameModDir == AppDomain.CurrentDomain.BaseDirectory + args[++i])
{
if(File.Exists(gameModDir))
gameModDir = AppDomain.CurrentDomain.BaseDirectory + args[++i];
} else
{
gameModDir = AppDomain.CurrentDomain.BaseDirectory + "valve";
game.Title = "Half-Life CSharp";
}
break;
case "-noborder":
game.WindowBorder = WindowBorder.Hidden;
break;
case "-dev":
developer = true;
break;
case "-console":
showConsole = true;
break;
default:
break;
}
}
game.Location = CenterWindowOnScreen();
game.Run(60);
return argIndex;
}
}
class SDLWindow : GameWindow
{
public SDLWindow() : base(640, 480, GraphicsMode.Default,
"Half-Life CSharp", GameWindowFlags.FixedWindow,
DisplayDevice.Default, 4, 0, GraphicsContextFlags.Default)
{
WindowBorder = WindowBorder.Fixed;
}
protected override void OnResize(EventArgs e)
{
GL.Viewport(0, 0, Width, Height);
}
protected override void OnLoad(EventArgs e)
{
CursorVisible = true;
}
protected override void OnRenderFrame(FrameEventArgs e)
{
Color4 backColor;
backColor.A = 1.0f;
backColor.R = 0.1f;
backColor.G = 0.1f;
backColor.B = 0.3f;
GL.ClearColor(backColor);
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
SwapBuffers();
}
}
}
And launcher of HLSharp with OpenTK
using System;
using System.Reflection;
using System.Threading;
using System.Windows.Forms;
namespace hlSharp
{
class Program
{
/**
* args should "-dev, -console, -width, -height
* and more paraments of original Half-Life"
*/
static Mutex mutex = new Mutex(true, "{8F6F0AC4-B9A1-45fd-A8CF-72F04E6BDE8F}");
static int Main(string[] args)
{
if (mutex.WaitOne(TimeSpan.Zero, true))
{
var DLL = Assembly.LoadFile(AppDomain.CurrentDomain.BaseDirectory + "Engine.dll");
var class1Type = DLL.GetType("Engine.Client");
var c = Activator.CreateInstance(class1Type);
var method = class1Type.GetMethod("Host");
method.Invoke(c, new object[] { args });
mutex.ReleaseMutex();
}
else
{
MessageBox.Show("Please close instance of Half-Life CSharp!", "HL-CSharp Message");
}
return 0;
}
}
}
Result:
But it works fine. ( Sometimes crash - I can not find resolve )
// Fixed version because I forget to restart computer because VS Community 2017 shows built-in apps but without VS Community 2017 it can not show app ( it makes invisible and close. That is why It resolves fine. PS: Thanks for explanation because Unity Player has sure bug - if I use commandline arguments than it shows “resizable mode” - But It is really crazy. That is why I wish unity player should work fine like my opentk-game with arguments. Please fix for next version with unity player. Where is report bug tracker of Unity? I am sure because they say if unity player doesn’t work if I use commandline arguments than it makes as window with resizing mode. - I really don’t like that. Please believe me!
I show you my written gamelauncher with changing resolution:
// EDIT:
I found report bug from Unity Editor. I have submitted it.