Example #1
0
        /// <summary>
        /// This function is called only once when the application is loaded
        /// </summary>
        private void _Load()
        {
            try
            {
                messages.Localize(this);
                //SkinEditorAction.Sensitive = false;
                setText("");
                if (Configuration.Window.Window_Maximized)
                {
                    this.Maximize();
                }
                else
                {
                    ResetSize();
                }
                hpaned1.Position = Configuration.Window.WindowSize;
                ChannelList = pidgeonlist1;
                toolStripProgressBar1.Visible = false;
                micro = new MicroChat();
                ChannelList.Visible = true;
                main = new Client.Graphics.Window();
                main.Events = ((global::Gdk.EventMask)(256));
                main.HasUserList = false;
                main.CreateChat(null);
                main.WindowName = "Pidgeon";
                toolStripStatusNetwork.TooltipText = messages.Localize("[[main-wcp]]");
                Chat = main;
                main.Redraw();
                Chat.Making = false;
                if (Configuration.Kernel.Debugging)
                {
                    Core.PrintRing(Chat, false);
                }

                Chat.scrollback.InsertText("Welcome to pidgeon client " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version, Client.ContentLine.MessageStyle.System, false, 0, true);

                if (Core.Extensions.Count > 0)
                {
                    foreach (Extension nn in Core.Extensions)
                    {
                        Chat.scrollback.InsertText("Extension " + nn.Name + " (" + nn.Version + ")", Client.ContentLine.MessageStyle.System, false, 0, true);
                    }
                }
                done = true;

                foreach (string text in Core.StartupParams)
                {
                    Core.ParseLink(text);
                }
                Hooks._Sys.Initialise(this);
            }
            catch (Exception f)
            {
                Core.handleException(f);
            }
        }
Example #2
0
 private void items_AfterSelect(object sender, RowActivatedArgs e)
 {
     try
     {
         SelectedWindow = null;
         RedrawMenu();
         TreeIter iter;
         TreePath[] path = tv.Selection.GetSelectedRows();
         if (path.Length < 1)
         {
             Core.DebugLog("items_AfterSelect(object sender, RowActivatedArgs e): GetSelectedRows returned 0 value");
             return;
         }
         tv.Model.GetIter(out iter, path[0]);
         Hooks._Sys.Poke();
         Window window = null;
         ItemType type = (ItemType)tv.Model.GetValue(iter, 2);
         switch (type)
         {
             case ItemType.Channel:
                 Channel chan = (Channel)tv.Model.GetValue(iter, 1);
                 Core.SelectedNetwork = chan._Network;
                 window = chan.RetrieveWindow();
                 if (window != null)
                 {
                     SelectedWindow = window;
                     window.MenuColor = Configuration.CurrentSkin.FontColor;
                 }
                 if (!chan.IsAlive)
                 {
                     joinToolStripMenuItem.Visible = true;
                 }
                 partToolStripMenuItem.Visible = true;
                 closeToolStripMenuItem.Visible = true;
                 chan._Network.RenderedChannel = chan;
                 chan._Network._Protocol.ShowChat(chan._Network.SystemWindowID + chan.Name);
                 Core.SystemForm.UpdateStatus();
                 return;
             case ItemType.Server:
                 Network server = (Network)tv.Model.GetValue(iter, 1);
                 if (server.ParentSv == null)
                 {
                     server._Protocol.ShowChat("!system");
                 }
                 else
                 {
                     server.ParentSv.ShowChat("!" + server.SystemWindowID);
                 }
                 server.SystemWindow.MenuColor = Configuration.CurrentSkin.FontColor;
                 SelectedWindow = server.SystemWindow;
                 Core.SelectedNetwork = server;
                 disconnectToolStripMenuItem.Visible = true;
                 closeToolStripMenuItem.Visible = true;
                 Core.SystemForm.UpdateStatus();
                 return;
             case ItemType.Services:
                 ProtocolSv protocol = (ProtocolSv)tv.Model.GetValue(iter, 1);
                 closeToolStripMenuItem.Visible = true;
                 SelectedWindow = protocol.SystemWindow;
                 protocol.ShowChat("!root");
                 Core.SelectedNetwork = null;
                 disconnectToolStripMenuItem.Visible = true;
                 Core.SystemForm.UpdateStatus();
                 return;
             case ItemType.DCC:
                 ProtocolDCC dcc = (ProtocolDCC)tv.Model.GetValue(iter, 1);
                 closeToolStripMenuItem.Visible = true;
                 SelectedWindow = dcc.SystemWindow;
                 dcc.ShowChat(dcc.SystemWindow.WindowName);
                 Core.SelectedNetwork = null;
                 disconnectToolStripMenuItem.Visible = true;
                 Core.SystemForm.UpdateStatus();
                 return;
             case ItemType.QuasselCore:
                 ProtocolQuassel quassel = (ProtocolQuassel)tv.Model.GetValue(iter, 1);
                 closeToolStripMenuItem.Visible = true;
                 SelectedWindow = quassel.SystemWindow;
                 quassel.ShowChat("!root");
                 Core.SelectedNetwork = null;
                 disconnectToolStripMenuItem.Visible = true;
                 return;
             case ItemType.System:
                 return;
             case ItemType.User:
                 User us = (User)tv.Model.GetValue(iter, 1);
                 Core.SelectedNetwork = us._Network;
                 lock (us._Network.PrivateWins)
                 {
                     if (us._Network.PrivateWins.ContainsKey(us))
                     {
                         window = us._Network.PrivateWins[us];
                     }
                 }
                 if (window != null)
                 {
                     SelectedWindow = window;
                     window.MenuColor = Configuration.CurrentSkin.FontColor;
                 }
                 us._Network._Protocol.ShowChat(us._Network.SystemWindowID + us.Nick);
                 closeToolStripMenuItem.Visible = true;
                 Core.SystemForm.UpdateStatus();
                 return;
         }
     }
     catch (Exception f)
     {
         Core.handleException(f);
     }
 }
Example #3
0
 /// <summary>
 /// Switches window (thread unsafe)
 /// </summary>
 /// <param name="window"></param>
 public void SwitchWindow(Graphics.Window window)
 {
     if (System.Threading.Thread.CurrentThread != Core._KernelThread)
     {
         throw new Core.PidgeonException("You can't control other windows from non kernel thread");
     }
     if (hpaned1.Child2 != null)
     {
         hpaned1.Remove(hpaned1.Child2);
     }
     hpaned1.Add2(window);
     Chat = window;
 }
Example #4
0
        static async Task Main(string[] args)
        {
            //setup sdl input system
            Engine.Instance.AddModule <Input.InputModule>();
            //setup vulkan instance
            Engine.Instance.AddModule <Graphics.GraphicsModule>();
            //setup open al
            //Engine.Instance.AddModule<Audio.AudioModule>();

            //create new scene
            var scene = new Core.Scene();

            Input.InputModule.OnApplicationClose += () => Engine.Instance.IsRunning = false;

            //create a window
            var window = new Graphics.Window(
                "Tortuga",
                0, 0,
                1920, 1080
                );

            //camera
            Graphics.Camera mainCamera;
            {
                var entity = new Core.Entity();
                mainCamera = await entity.AddComponent <Graphics.Camera>();

                //set camera's render target to be the window
                mainCamera.RenderTarget = window;
                scene.AddEntity(entity);
            }

            //mesh
            var mesh = await AssetLoader.LoadObj("Assets/Models/Sphere.obj");

            var material = await AssetLoader.LoadMaterial("Assets/Materials/Bricks.instanced.jsonc");

            for (int i = -3; i < 4; i++)
            {
                for (int j = -3; j < 4; j++)
                {
                    var entity = new Core.Entity();

                    //attach transform
                    var transform = entity.GetComponent <Core.Transform>();
                    transform.Position = new Vector3(i * 5, j * 5, -40);

                    //attach mesh renderer
                    var renderer = await entity.AddComponent <Graphics.MeshRenderer>();

                    //setup mesh
                    renderer.Mesh = mesh;

                    //setup material
                    renderer.Material = material;
                    scene.AddEntity(entity);
                }
            }

            //light
            {
                var entity = new Core.Entity();

                //attach light
                var light = await entity.AddComponent <Graphics.Light>();

                scene.AddEntity(entity);
            }

            // //user interface
            // {
            //     var win = new UI.UiWindow();
            //     win.Position = new Vector2(100, 100);
            //     win.Scale = new Vector2(500, 500);
            //     scene.AddUserInterface(win);
            //     var windowContent = new UI.UiRenderable();
            //     windowContent.RenderFromCamera = mainCamera;
            //     windowContent.PositionXConstraint = new UI.PercentConstraint(0.0f);
            //     windowContent.PositionYConstraint = new UI.PercentConstraint(0.0f);
            //     windowContent.ScaleXConstraint = new UI.PercentConstraint(1.0f);
            //     windowContent.ScaleYConstraint = new UI.PercentConstraint(1.0f);
            //     win.Content.Add(windowContent);
            // }

            //scene.AddSystem<Audio.AudioSystem>();
            scene.AddSystem <Graphics.RenderingSystem>();
            scene.AddSystem <CameraMovement>();

            Engine.Instance.LoadScene(scene);
            await Engine.Instance.Run();
        }