diff --git a/AmongUsCapture/AmongUsCapture.csproj b/AmongUsCapture/AmongUsCapture.csproj
index e0798d51..1011462d 100644
--- a/AmongUsCapture/AmongUsCapture.csproj
+++ b/AmongUsCapture/AmongUsCapture.csproj
@@ -19,6 +19,7 @@
+
diff --git a/AmongUsCapture/Program.cs b/AmongUsCapture/Program.cs
index d62b2cb7..68e1548f 100644
--- a/AmongUsCapture/Program.cs
+++ b/AmongUsCapture/Program.cs
@@ -18,16 +18,13 @@ static void Main()
var appstate = new Application("org.AmongUsCapture.AmongUsCaptureUtil", GLib.ApplicationFlags.None);
appstate.Register(GLib.Cancellable.Current);
Application.Init();
- if(doConsole)
+
+ // This particular line is a Win32 system call and should only ever be run there
+ if(doConsole && RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
AllocConsole(); // needs to be the first call in the program to prevent weird bugs
}
- /* This is winforms stuff and doesn't apply to GTK.
- Application.SetHighDpiMode(HighDpiMode.SystemAware);
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- */
-
+
ClientSocket socket = new ClientSocket();
var windowbuilder = new Builder();
@@ -52,7 +49,5 @@ static void Main()
[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool AllocConsole();
-
-
}
}
diff --git a/AmongUsCapture/UserForm.cs b/AmongUsCapture/UserForm.cs
index 11bc71f7..40417ba4 100644
--- a/AmongUsCapture/UserForm.cs
+++ b/AmongUsCapture/UserForm.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
+using System.IO;
using System.Reflection;
using System.Reflection.Metadata;
using System.Runtime.CompilerServices;
@@ -79,6 +80,43 @@ public UserForm(Builder builder, ClientSocket sock) : base("Among Us Capture - G
}
+ private void _primaryWindowMenuQuitItem_Activated(object o, EventArgs e)
+ {
+ this.Close();
+ }
+
+ private void _primaryWindowMenuItemAbout_Activated(object o, EventArgs e)
+ {
+ var abouticon = new Pixbuf(Assembly.GetExecutingAssembly().GetManifestResourceStream("amonguscapture_gtk.icon.ico"));
+ AboutDialog about = new AboutDialog();
+
+ about.Name = "_amonguscaptureGtkAboutDialog";
+ about.ProgramName = "Among Us Capture (GTK)";
+ string version = String.Empty;
+ using(Stream stream = Assembly.GetExecutingAssembly()
+ .GetManifestResourceStream("amonguscapture_gtk.version.txt"))
+ if (stream == null)
+ version = "Unknown";
+ else
+ {
+ using (StreamReader sreader = new StreamReader(stream))
+ {
+ version = sreader.ReadToEnd();
+ }
+ }
+
+ about.Version = version;
+ about.Comments = "amonguscapture_gtk is a GTK version of the Among Us Capture utility made by denverquane.";
+ about.Website = "https://github.com/TauAkiou/amonguscapture-gtk";
+ about.Logo = abouticon;
+
+ about.Run();
+
+ about.Dispose();
+
+
+ }
+
private void _consoleTextView_OnPopulateContextMenu(object o, PopulatePopupArgs e)
{
Menu textViewContextMenu = (Menu)e.Args[0];
diff --git a/AmongUsCapture/Userform.Gtk.cs b/AmongUsCapture/Userform.Gtk.cs
index feb6a87b..d4e209bc 100644
--- a/AmongUsCapture/Userform.Gtk.cs
+++ b/AmongUsCapture/Userform.Gtk.cs
@@ -6,6 +6,17 @@ namespace AmongUsCapture
{
public partial class UserForm
{
+ // Menubar
+ private VBox _primaryWindowContainer;
+ private MenuBar _primaryWindowMenuBar;
+ private MenuItem _primaryMenuItemFile;
+ private MenuItem _primaryMenuItemAbout;
+
+ // Menu
+ private Menu _primaryWindowMenuFile;
+ private MenuItem _primaryWindowMenuQuitItem;
+
+
// Top level windows
private HPaned _primaryWindowPane;
private VBox _primaryWindowLeftContainer;
@@ -13,6 +24,9 @@ public partial class UserForm
// UserSettings (Left Side)
private VBox _userSettingsParentContainer;
private Frame _userSettingsParentFrame;
+
+ private Frame _gameInfoParentFrame;
+ private VBox _gameInfoParentContainer;
// GameCode objects
private Frame _gameCodeParentFrame;
@@ -23,8 +37,7 @@ public partial class UserForm
// Websocket/Host Control
private Frame _hostControlFrame;
private VBox _hostControlLayoutContainer;
-
-
+
private Frame _urlHostEntryFrame;
private HBox _urlHostEntryLayoutContainer;
private Entry _urlHostEntryField;
@@ -54,6 +67,16 @@ public partial class UserForm
public void InitializeWindow()
{
+ // Menubar
+ _primaryWindowContainer = new VBox();
+ _primaryWindowMenuBar = new MenuBar();
+
+ _primaryMenuItemFile = new MenuItem();
+
+ _primaryWindowMenuFile = new Menu();
+ _primaryWindowMenuQuitItem = new MenuItem();
+
+
// Top level window pane.
_primaryWindowPane = new HPaned();
_primaryWindowLeftContainer = new VBox();
@@ -61,6 +84,9 @@ public void InitializeWindow()
// Left side User Settings Pane
_userSettingsParentFrame = new Frame();
_userSettingsParentContainer = new VBox();
+
+ _gameInfoParentFrame = new Frame();
+ _gameInfoParentContainer = new VBox();
// Left Side Current State Field
_currentStateFrame = new Frame();
@@ -96,6 +122,30 @@ public void InitializeWindow()
_consoleTextView = new TextView();
+ //
+
+ _primaryWindowContainer.Name = "_primaryWindowContainer";
+ _primaryWindowContainer.PackStart(_primaryWindowMenuBar, false, false, 2);
+ _primaryWindowContainer.PackStart(_primaryWindowPane, true, true, 0);
+
+ _primaryWindowMenuBar.Name = "_primaryWindowMenuBar";
+ _primaryWindowMenuBar.Append(_primaryMenuItemFile);
+
+ _primaryMenuItemFile.Name = "_primaryMenuItemFile";
+ _primaryMenuItemFile.Label = "File";
+ _primaryMenuItemFile.Submenu = _primaryWindowMenuFile;
+
+ _primaryMenuItemAbout.Name = "_primaryMenuItemAbout";
+ _primaryMenuItemAbout.Label = "About";
+ _primaryMenuItemAbout.Activated += _primaryWindowMenuItemAbout_Activated;
+
+ _primaryWindowMenuFile.Name = "_primaryWindowMenu";
+ _primaryWindowMenuFile.Append(_primaryWindowMenuQuitItem);
+
+ _primaryWindowMenuQuitItem.Name = "_primaryWindowMenuQuitItem";
+ _primaryWindowMenuQuitItem.Label = "Quit";
+ _primaryWindowMenuQuitItem.Activated += _primaryWindowMenuQuitItem_Activated;
+
// _primaryWindowPane definition (splitContainer1)
_primaryWindowPane.Name = "_primaryWindowPane";
_primaryWindowPane.SetSizeRequest(824, 476);
@@ -117,10 +167,19 @@ public void InitializeWindow()
_userSettingsParentFrame.Add(_userSettingsParentContainer);
_userSettingsParentContainer.Margin = 5;
- _userSettingsParentContainer.PackStart(_currentStateFrame, true, false, 10);
+ _userSettingsParentContainer.PackStart(_gameInfoParentFrame, true, false, 10);
_userSettingsParentContainer.PackStart(_hostControlFrame, true, false, 10);
- _userSettingsParentContainer.PackStart(_gameCodeParentFrame, true, false, 5);
_userSettingsParentContainer.Name = "_userSettingsParentContainer";
+
+ _gameInfoParentFrame.Name = "_gameInfoParentFrame";
+ _gameInfoParentFrame.Label = "Game Information";
+ _gameInfoParentFrame.SetSizeRequest(55, 40);
+ _gameInfoParentFrame.Add(_gameInfoParentContainer);
+
+ _gameInfoParentContainer.Name = "_gameInfoParentContainer";
+ _gameInfoParentContainer.PackStart(_currentStateFrame, true, false, 10);
+ _gameInfoParentContainer.PackStart(_gameCodeParentFrame, true, false, 10);
+ _gameInfoParentContainer.Margin = 5;
// CurrentStateFrame
_currentStateFrame.Add(_currentStateContainer);
@@ -183,7 +242,7 @@ public void InitializeWindow()
_urlHostEntryFrame.Add(_urlHostEntryLayoutContainer);
_urlHostEntryLayoutContainer.Name = "_urlHostEntryLayoutContainer";
- _urlHostEntryLayoutContainer.SetSizeRequest(25, 20);
+ _urlHostEntryLayoutContainer.SetSizeRequest(70, 20);
_urlHostEntryLayoutContainer.PackStart(_urlHostEntryField, true, false, 5);
_urlHostEntryLayoutContainer.MarginBottom = 5;
@@ -199,7 +258,7 @@ public void InitializeWindow()
_connectCodeEntryField.Name = "_connectCodeEntryField";
_connectCodeEntryField.Xalign = (float)0.5;
- _connectCodeEntryField.SetSizeRequest(50, 20);
+ _connectCodeEntryField.SetSizeRequest(70, 20);
_connectCodeEntryField.MaxLength = 6;
_connectCodeSubmitButton.Name = "_connectCodeSubmitButton";
@@ -231,7 +290,7 @@ public void InitializeWindow()
_consoleTextView.Buffer.Changed += _consoleTextView_BufferChanged;
SetDefaultSize(824, 476);
- Add(_primaryWindowPane);
+ Add(_primaryWindowContainer);
}