示例#1
0
 public LagOMeterUI()
 {
     this.WindowSpawnPosition = Corner.BOTRIGHT;
     this.Title = "Lag-o-Meter";
     this.Size = new System.Drawing.Size(300, 200);
     this.Bound.Size = this.Size;
     tex = new HagsTexture("white.png");
     this.AlwaysVisible = true;
 }
示例#2
0
        public void Init()
        {
            // Load textures
            font = new HagsTexture("Terminus.png");
            bg = new HagsTexture("consolebg.png");

            // Build vertices for all letters
            int fontw = 9, fonth = 15;
            int hfonts = font.Size.Width / fontw;
            int vfonts = font.Size.Height / fonth;
            int nLetters = hfonts * vfonts; // total number of letters in bitmap font

            letters = new Letter[nLetters];
            int i = 0;
            int currX = 0, currY = 0;
            for (i = 0; i < nLetters; i++)
            {
                // calc coord position
                Vector2 ofs = Vector2.Zero;
                ofs.X = (currX * fontw);
                ofs.Y = (currY * fonth);

                // Control offsets
                currX++;
                if (currX >= hfonts)
                {
                    currX = 0;
                    currY++;
                    if (currY > vfonts)
                        break;
                }

                // Add it in
                Letter letter = new Letter(i, ofs);
                letters[i] = letter;
            }
            if (i != nLetters)
                Common.Instance.WriteLine("Warning: Couldn't load all letters for console");

            Input.Instance.Event += new InputHandler(GotKeyEvent);

            Commands.Instance.AddCommand("toggleconsole", new CommandDelegate(ToggleConsole));
            KeyHags.Instance.SetBind("~", "toggleconsole");
        }
示例#3
0
        public void Init(SlimDX.Direct3D9.Device device)
        {
            Windows = new List<Window>();

            // Bind ESC to ToggleUI
            Commands.Instance.AddCommand("toggleui", new CommandDelegate(ToggleUI));

            // Load cursors
            cursorTextures = new HagsTexture[6];
            cursor_offsets = new System.Drawing.Size[6];

            // textures
            cursorTextures[0] = new HagsTexture("window-theme/cursor.png");
            cursorTextures[1] = new HagsTexture("window-theme/cursor_move.png");
            cursorTextures[2] = new HagsTexture("window-theme/cursor_scale.png");
            cursorTextures[3] = new HagsTexture("window-theme/cursor_caret.png");
            cursorTextures[4] = new HagsTexture("window-theme/cursor_horiz.png");
            cursorTextures[5] = new HagsTexture("window-theme/cursor_vert.png");

            // Set cursor pixel "position" for each cursor theme
            cursor_offsets[0] = new System.Drawing.Size(8, 2);
            cursor_offsets[1] = new System.Drawing.Size(3, 1);
            cursor_offsets[2] = new System.Drawing.Size(3, 2);
            cursor_offsets[3] = new System.Drawing.Size(15, 17);
            cursor_offsets[4] = new System.Drawing.Size(15, 14);
            cursor_offsets[5] = new System.Drawing.Size(14, 16);

            // Hook to input
            Input.Instance.Event += new InputHandler(Input_Event);

            vb = new HagsVertexBuffer();
            base.Init();
            connectGUI = new ConnectGUI();
            AddWindow(connectGUI);

            info = new InfoUI();
            AddWindow(info);

            menuGUI = new MenuGUI();
            AddWindow(menuGUI);
            settingsGUI = new SettingsGUI();
            settingsGUI.Visible = false;
            AddWindow(settingsGUI);
            AddWindow(new LagOMeterUI());
        }
示例#4
0
 // Create new HagsAtlas from texture
 public HagsAtlas(string filename)
 {
     Texture = new HagsTexture(filename);
     TextureName = filename;
     Name = Path.GetFileNameWithoutExtension(filename);
 }