protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); string loginData = @"oauth= username="******"fourtf"); //IrcManager.MessageReceived += (s, e) => //{ // lock (messages) // { // messages.Add(e.Message); // e.Message.CalculateBounds(null, 1000); // } //}; }
public BasicLines1bEngineControlWindow(GuiEngine guiEngine, BasicLines1bEngine engine) { fGuiEngine = guiEngine; fEngine = engine; InitOther(); InitWindow(); fButtonReset.OnClick += FButtonReset_OnClick; }
private void timer1_Tick(object sender, EventArgs e) { var g = CreateGraphics(); GuiEngine.Run(); //g.Clear(System.Drawing.Color.White); g.DrawImageUnscaled(canvas.Bitmap, 0, 0); }
protected override void BeforeRun() { Console.Clear(); Console.WriteLine("Booting CosmosUI"); Screen.SetMode(VbeScreen.ScreenSize.Size1280X1024, VbeScreen.Bpp.Bpp32); Screen.Clear(Colors.Blue); GuiEngine.Load(new Canvas(1280, 1024)); }
public override void LoadContent(GuiEngine engine) { base.LoadContent(engine); if (Childs != null) { foreach (var child in Childs) { child.LoadContent(engine); } } }
public override void LoadContent(GuiEngine engine) { fTexture = GuiPainter.GetTexture1x1(Device); base.LoadContent(engine); if (Childs != null) { foreach (var child in Childs) { child.Header.LoadContent(engine); } } }
public MainWindow(GuiEngine engine) { fEngine = engine; InitOther(); InitWindow(); if (this.Title != null) { this.Title.Control.OnClick += WindowTitle_OnClick; } fGoWindow.OnClick += FGoWindow_OnClick; fGoWindowAspect.OnClick += FGoWindowAspect_OnClick; fGoFullscreen.OnClick += FGoFullscreen_OnClick; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { fEngine = new GuiEngine(this, fOptions, fGraphics); //fEngine.Theme = new MonoGUI.Themes.TestTheme(); fWindow1 = new MainWindow(fEngine); fWindow2 = new MainWindow2(fEngine); fWindow3 = new MainWindow3(fEngine); fEngine.AddWindow(fWindow1); fEngine.AddWindow(fWindow2); fEngine.AddWindow(fWindow3); this.Components.Add(fEngine); base.Initialize(); }
static void Main(string[] args) { Application.Init(); AppSettings.SavePath = Path.Combine(Util.GetUserDataPath(), "Settings.ini"); GuiEngine.Initialize(new GtkGuiEngine()); Cache.Load(); AppSettings.Load(); IrcManager.Connect(); var window = new MainWindow(); window.ShowAll(); window.Hidden += (s, e) => { Application.Quit(); }; Application.Run(); AppSettings.Save(); }
public override void LoadContent(GuiEngine engine) { fTexture = GuiPainter.GetTexture1x1(Device); /* * int w = 100; * int h = 2; * int pixels = w * h; * Color[] colors = new Color[pixels]; * Texture2D texture = new Texture2D(device, w,h); * int index = 0; * for (int y = 0; y < h; y++) * { * for (int x = 0; x < w; x++) * { * Color c = new Color(1.0f*x / w, 1.0f * y / h, 1.0f); * colors[index++] = c; * } * } * texture.SetData<Color>(colors); * fTexture = texture; */ base.LoadContent(engine); }
private void Form1_Load(object sender, EventArgs e) { DoubleBuffered = true; canvas = new FormCanvas(Width, Height); GuiEngine.Load(canvas); }
public override void LoadContent(GuiEngine engine) { fTexture = GuiPainter.GetTexture1x1(Device); base.LoadContent(engine); }
internal override GuiWindow DoCreateControlWindow(GuiEngine guiEngine) { return(new BasicLines1EngineControlWindow(guiEngine, this)); }
public MainWindow2(GuiEngine engine) { fEngine = engine; InitOther(); InitWindow(); }
public override void LoadContent(GuiEngine engine) { base.LoadContent(engine); }
protected override void Run() { GuiEngine.Run(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { fEngine = new GuiEngine(this, fOptions, fGraphics); //fEngine.Theme = new MonoGUI.Themes.TestTheme(); fContent = new List <GuiElement>(); fContent.Add(new GuiPanel() { Name = "Panel", BackgroundColor = Color.Orange, Width = 200, Height = 200, HorizontalAlignment = GuiHorizontalAlignment.Right, Content = new GuiLabel() { Text = "Label in GuiPanel'" } }); fContent.Add(new GuiStackPanel() { Name = "Stack Panel", BackgroundColor = Color.Yellow, Width = 200, Height = 200, HorizontalAlignment = GuiHorizontalAlignment.Right, Childs = new List <GuiStackChild>() { new GuiStackChild() { Control = new GuiLabel() { Text = "Label in GuiStackPanel'" } }, new GuiStackChild() { Control = new GuiLabel() { Text = "Label in GuiStackPanel'" } } } }); fContent.Add(new GuiDockPanel() { Name = "Dock Panel", BackgroundColor = Color.YellowGreen, Width = 200, Height = 200, HorizontalAlignment = GuiHorizontalAlignment.Right, Childs = new List <GuiDockChild>() { new GuiDockChild() { Control = new GuiLabel() { Text = "Bottom in GuiDockChild'" }, Dock = GuiDock.Bottom }, new GuiDockChild() { Control = new GuiLabel() { Text = "Top in GuiDockChild'" }, Dock = GuiDock.Top } } }); fContent.Add(new GuiExpandablePanel() { Name = "Expandable Panel", BackgroundColor = Color.DodgerBlue, Width = 200, Height = 200, HorizontalAlignment = GuiHorizontalAlignment.Right, Title = new GuiDockChild() { Dock = GuiDock.Top, Control = new GuiLabel() { Text = "Expand" } }, Content = new GuiLabel() { Text = "Label in GuiExpandablePanel'" }, Border = new GuiBorder() { Border = new GuiThickness(10), BorderColor = Color.Red } }); fContent.Add(new GuiBox() { Name = "Box", BackgroundColor = Color.Violet, Width = 200, Height = 200, HorizontalAlignment = GuiHorizontalAlignment.Right, }); fContent.Add(new GuiLabel() { Name = "Label", BackgroundColor = Color.Turquoise, Text = "Label", Width = 200, Height = 200, HorizontalAlignment = GuiHorizontalAlignment.Right }); fContent.Add(new GuiBorder() { Name = "Border", BackgroundColor = Color.Transparent, Width = 200, Height = 200, Border = new GuiThickness(2), BorderColor = Color.Black, HorizontalAlignment = GuiHorizontalAlignment.Right, Content = new GuiLabel() { Text = "Label in GuiBorder'" } }); fContentPanel = new GuiPanel(); fWindow1 = new GuiWindow() { Title = new GuiDockChild() { Dock = GuiDock.Top, Control = new GuiLabel() { Text = "Click to change content" } }, Border = new GuiBorder() { Border = new GuiThickness(5), BorderColor = Color.White }, BackgroundColor = new Color(Color.Black, 0.5f), Content = fContentPanel }; fContentInformation = new GuiLabel() { BackgroundColor = Color.Black, ForegroundColor = Color.Yellow }; fWindow2 = new GuiWindow() { Title = new GuiDockChild() { Dock = GuiDock.Top, Control = fContentInformation }, Border = new GuiBorder() { Border = new GuiThickness(5), BorderColor = Color.White }, BackgroundColor = new Color(Color.Black, 0.5f), //Content = new GuiPanel() { BackgroundColor = Color.Red, Content = new GuiElement() { } } // collapsed Content = new GuiPanel() { BackgroundColor = Color.Red, Content = null } // Whole window }; fWindow2.X = 400; fWindow2.Y = 200; fEngine.AddWindow(fWindow1); fEngine.AddWindow(fWindow2); fWindow1.Title.Control.OnClick += WindowTitle_OnClick; this.Components.Add(fEngine); SetContent(fContentIndex); foreach (var content in fContent) { content.Initialize(GraphicsDevice); } base.Initialize(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { fEngine = new GuiEngine(this, fOptions, fGraphics); fEngine.OnResize += FEngine_OnResize; fLabelDisplayMode = new GuiLabel(); fAdapterSize = new GuiLabel() { HorizontalAlignment = GuiHorizontalAlignment.Right, BackgroundColor = Color.Orange }; fWindowSize = new GuiLabel(); fAspectRatio = new GuiLabel(); fFPS = new GuiLabel() { HorizontalAlignment = GuiHorizontalAlignment.Right }; fInfo = new GuiLabel(); lblDrawMode = new GuiLabel() { HorizontalAlignment = GuiHorizontalAlignment.Left, BackgroundColor = Color.Blue, ForegroundColor = Color.Yellow }; lblShaderMode = new GuiLabel() { HorizontalAlignment = GuiHorizontalAlignment.Left, BackgroundColor = Color.Blue, ForegroundColor = Color.Yellow }; lblRenderObjects = new GuiLabel() { HorizontalAlignment = GuiHorizontalAlignment.Left, BackgroundColor = Color.Blue, ForegroundColor = Color.Yellow }; fCurrentElement = new GuiLabel(); fWindow = new GuiWindow() { Dragable = true, Clickable = true, Title = new GuiDockChild() { Dock = GuiDock.Top, Control = new GuiLabel() { Text = "Lines! (Click, Size or Drag)", //VerticalAlignment = GuiVerticalAlignment.Stretch, //HorizontalAlignment = GuiHorizontalAlignment.Stretch, BackgroundColor = Color.Black, ForegroundColor = Color.Yellow, } }, Border = new GuiBorder() { Border = new GuiThickness(15), BorderColor = new Color(Color.Black, 0.3f), }, //BackgroundColor = new Color(Color.Red, 0.9f), HorizontalAlignment = GuiHorizontalAlignment.Left, //VerticalAlignment = GuiVerticalAlignment.Top, WindowState = GuiWindowState.Normal, X = 100, Y = 100, Width = 600, Height = 500, Content = new GuiPanel() { Margin = new GuiThickness(20), Content = new GuiStackPanel() { Childs = new List <GuiStackChild>() { new GuiStackChild() { Control = fFPS }, new GuiStackChild() { Control = fLabelDisplayMode }, new GuiStackChild() { Control = fAdapterSize }, new GuiStackChild() { Control = fWindowSize }, new GuiStackChild() { Control = fAspectRatio }, new GuiStackChild() { Control = fInfo }, new GuiStackChild() { Control = fCurrentElement }, new GuiStackChild() { Control = lblDrawMode }, new GuiStackChild() { Control = lblShaderMode }, new GuiStackChild() { Control = lblRenderObjects } }, HorizontalAlignment = GuiHorizontalAlignment.Left, VerticalAlignment = GuiVerticalAlignment.Top, BackgroundColor = new Color(Color.White, 0.2f), }, BackgroundColor = new Color(Color.Red, 0.7f), } }; fEngine.AddWindow(fWindow); if (fWindow.Title != null) { fWindow.Title.Control.OnClick += WindowTitle_OnClick; } lblDrawMode.OnClick += lblDrawMode_OnClick; lblShaderMode.OnClick += lblShaderMode_OnClick; lblRenderObjects.OnClick += LblRenderObjects_OnClick; this.Components.Add(fEngine); UpdateScale(); base.Initialize(); }
static void Main() { CurrentVersion = VersionNumber.Parse( AssemblyName.GetAssemblyName(Assembly.GetExecutingAssembly().Location).Version.ToString()); if (!File.Exists("./removeupdatenew") && Directory.Exists("./Updater.new")) { UpdaterPath = Path.Combine(new FileInfo(Assembly.GetEntryAssembly().Location).Directory.FullName, "Updater.new", "Chatterino.Updater.exe"); } else { if (File.Exists("./update2")) { UpdaterPath = Path.Combine(new FileInfo(Assembly.GetEntryAssembly().Location).Directory.FullName, "Updater2", "Chatterino.Updater.exe"); } } Directory.SetCurrentDirectory(new FileInfo(Assembly.GetEntryAssembly().Location).Directory.FullName); GuiEngine.Initialize(new WinformsGuiEngine()); ServicePointManager.ServerCertificateValidationCallback = (a, b, c, d) => true; ServicePointManager.DefaultConnectionLimit = int.MaxValue; //ServicePointManager.UseNagleAlgorithm = false; //ServicePointManager.MaxServicePoints = 10000; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //SetProcessDpiAwareness(_Process_DPI_Awareness.Process_Per_Monitor_DPI_Aware); Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location); // Fonts if (Environment.OSVersion.Version.Major >= 6 && Environment.OSVersion.Version.Minor >= 1) { UseDirectX = true; } // Exceptions Application.ThreadException += (s, e) => { e.Exception.Log("exception", "{0}\n"); }; AppDomain.CurrentDomain.UnhandledException += (s, e) => { (e.ExceptionObject as Exception).Log("exception", "{0}\n"); }; EmoteCache.init(); // Update gif emotes int offset = 0; new System.Windows.Forms.Timer { Interval = 30, Enabled = true }.Tick += (s, e) => { if (AppSettings.ChatEnableGifAnimations) { lock (GuiEngine.Current.GifEmotesLock) { offset += 3; if (offset < 0) { offset = 0; } try { if (EmoteList != null && EmoteList.GetGifEmotes() != null) { GuiEngine.Current.GifEmotesOnScreen.UnionWith(EmoteList.GetGifEmotes()); } foreach (LazyLoadedImage emote in GuiEngine.Current.GifEmotesOnScreen) { if (emote.HandleAnimation != null) { emote.HandleAnimation(offset); } } if (ToolTip != null && ToolTip.Visible && ToolTip.Image != null && ToolTip.Image.HandleAnimation != null) { ToolTip.Image.HandleAnimation(offset); lock (ToolTip) { ToolTip.redraw(); } } } catch (Exception err) { GuiEngine.Current.log("error updating gifs " + err.ToString()); } } GifEmoteFramesUpdated?.Invoke(null, EventArgs.Empty); } }; // Settings/Colors try { if (!Directory.Exists(Util.GetUserDataPath())) { Directory.CreateDirectory(Util.GetUserDataPath()); } if (!Directory.Exists(Path.Combine(Util.GetUserDataPath(), "Custom"))) { Directory.CreateDirectory(Path.Combine(Util.GetUserDataPath(), "Custom")); } } catch { } AppSettings.SavePath = Path.Combine(Util.GetUserDataPath(), "Settings.ini"); var showWelcomeForm = false; try { if (!File.Exists(AppSettings.SavePath)) { CanShowChangelogs = false; showWelcomeForm = true; if (File.Exists("./Settings.ini") && !File.Exists(AppSettings.SavePath)) { File.Move("./Settings.ini", AppSettings.SavePath); try { File.Delete("./Settings.ini"); } catch { } } if (File.Exists("./Custom/Commands.txt") && !File.Exists(Path.Combine(Util.GetUserDataPath(), "Custom", "Commands.txt"))) { File.Move("./Custom/Commands.txt", Path.Combine(Util.GetUserDataPath(), "Custom", "Commands.txt")); try { File.Delete("./Custom/Commands.txt"); } catch { } } if (File.Exists("./Custom/Ping.wav") && !File.Exists(Path.Combine(Util.GetUserDataPath(), "Custom", "Ping.wav"))) { File.Move("./Custom/Ping.wav", Path.Combine(Util.GetUserDataPath(), "Custom", "Ping.wav")); try { File.Delete("./Custom/Ping.wav"); } catch { } } if (File.Exists("./Layout.xml") && !File.Exists(Path.Combine(Util.GetUserDataPath(), "Layout.xml"))) { File.Move("./Layout.xml", Path.Combine(Util.GetUserDataPath(), "Layout.xml")); try { File.Delete("./Layout.xml"); } catch { } } } } catch { } AppSettings.Load(); AccountManager.LoadFromJson(Path.Combine(Util.GetUserDataPath(), "Login.json")); IrcManager.Account = AccountManager.FromUsername(AppSettings.SelectedUser) ?? Account.AnonAccount; IrcManager.Connect(); Commands.LoadOrDefault(Path.Combine(Util.GetUserDataPath(), "Custom", "Commands.txt")); Cache.Load(); _updateTheme(); AppSettings.ThemeChanged += (s, e) => _updateTheme(); // Check for updates //try //{ // string updaterPath = "./Updater"; // string newUpdaterPath = "./Updater.new"; // if (Directory.Exists(newUpdaterPath)) // { // if (Directory.Exists(updaterPath)) // Directory.Delete(updaterPath, true); // Directory.Move(newUpdaterPath, updaterPath); // } //} //catch { } Updates.UpdateFound += (s, e) => { try { using (var dialog = new UpdateDialog()) { if (File.Exists(UpdaterPath)) { var result = dialog.ShowDialog(); // OK -> install now // Yes -> install on exit if (result == DialogResult.OK || result == DialogResult.Yes) { using (var client = new WebClient()) { client.DownloadFile(e.Url, Path.Combine(Util.GetUserDataPath(), "update.zip")); } installUpdatesOnExit = true; if (result == DialogResult.OK) { restartAfterUpdates = true; MainForm?.Close(); } } } else { MessageBox.Show("An update is available but the update executable could not be found. If you want to update chatterino you will have to reinstall it."); } } } catch { } }; #if DEBUG Updates.CheckForUpdate("win-dev", CurrentVersion); #else Updates.CheckForUpdate("win-release", CurrentVersion); #endif // Start irc Emotes.LoadGlobalEmotes(); Badges.LoadGlobalBadges(); GuiEngine.Current.LoadBadges(); Net.StartHttpServer(); // Show form MainForm = new MainForm(); MainForm.Show(); if (showWelcomeForm) { new WelcomeForm().Show(); } MainForm.FormClosed += (s, e) => { Application.Exit(); // Save settings AppSettings.Save(); Cache.Save(); EmoteCache.SaveEmoteList(); Commands.Save(Path.Combine(Util.GetUserDataPath(), "Custom", "Commands.txt")); }; Application.Run(); Environment.Exit(0); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { fEngine = new GuiEngine(this, fOptions, fGraphics); fEngine.OnResize += FEngine_OnResize; fFpsEngine = new FpsEngine(this); fInputManager = fEngine.InputManager;// new InputManager(this); fWindow1 = new MainWindow(fEngine); //fWindow2 = new GuiWindow() //{ // BackgroundColor = Color.Yellow, // Content = new GuiExpandablePanel() // { // Content = new GuiLabel() { Text = "Now you see me" }, // PanelState = GuiExpandablePanelState.Expanded, // Title = new GuiDockChild() // { // Dock = GuiDock.Top, // Control = new GuiLabel() { Text = "Click to expand" } // }, // } //}; GuiStackPanel menuPanel = new GuiStackPanel() { BackgroundColor = new Color(Color.DarkSlateBlue, 0.7f) }; fExPanel = new GuiExpandablePanel() { Content = menuPanel, PanelState = GuiExpandablePanelState.Collapsed, Title = new GuiDockChild() { Dock = GuiDock.Top, Control = new GuiLabel() { Text = "Click", BackgroundColor = new Color(Color.Black, 0.7f), ForegroundColor = Color.White }, }, }; fWindow2 = new GuiWindow() { Title = new GuiDockChild() { Dock = GuiDock.Bottom, Control = fExPanel, }, Content = new GuiPanel() { }, // Fill upp window //Content = new GuiPanel() { Width=0, Height=0}, Border = new GuiBorder() { Border = new GuiThickness(1), BorderColor = Color.Red } }; fEngine.AddWindow(fWindow1); fEngine.AddWindow(fWindow2); //var w = new BasicLines1EngineControlWindow(fEngine); //fEngine.AddWindow(w); //fEngine.AddWindow(new MainWindow(fEngine)); this.Components.Add(fEngine); this.Components.Add(fFpsEngine); //this.Components.Add(fInputManager); fContainer = new EngineContainer(this, fGraphics, fInputManager, fEngine, fFpsEngine); fContainer.BackColor = Color.Transparent; fEngines = EngineFactory.GetEngines(fContainer); foreach (var engine in fEngines) { engine.DoInitialize(); } var index = 0; foreach (var engine in fEngines) { var label = new GuiLabel() { Text = engine.GetName(), BackgroundColor = new Color(Color.Gray, 0.5f), ForegroundColor = Color.White, }; label.OnClick += Label_OnClick; label.Tag = index++; menuPanel.Childs.Add(new GuiStackChild() { Control = label }); } base.Initialize(); }