コード例 #1
0
 internal static void Draw()
 {
     Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied);
     GameHooks.OnDraw();
     Main.spriteBatch.End();
     GUI.Draw(Main.spriteBatch);
 }
コード例 #2
0
        internal static void Initialize()
        {
            Binding.Load("bindings.txt");
            Command.Add(new Command("addmacro", AddMacro));
            Command.Add(new Command("clear", Clear));
            Command.Add(new Command("help", Help));
            Command.Add(new Command("macro", Macro));
            Command.Add(new Command("netsend", NetSend));
            Command.Add(new Command("repeat", Repeat));
            Command.Add(new Command("say", Say));
            GUI.Initialize(Game);
            GUI.Add(ConsoleForm = new ConsoleForm());
            GameHooks.OnInitialize();

            ProjNames = new string[Main.instance.Get("projectileTexture").Length];
            dynamic temp = Projectile.New();

            for (int i = 0; i < ProjNames.Length; i++)
            {
                temp.SetDefaults(i);
                ProjNames[i] = temp.name;
            }
            if (File.Exists("startup.macro"))
            {
                Command.Execute("m startup");
            }
        }
コード例 #3
0
        internal static void LoadContent()
        {
            ContentManager content = Game.Content;

            GUI.BindCursor(CursorType.NORMAL, content.Load <Texture2D>("TerrariAPI/Cursors/Normal"));
            GUI.BindCursor(CursorType.RESIZE_VERTICAL, content.Load <Texture2D>("TerrariAPI/Cursors/ResizeVert"));
            GUI.BindCursor(CursorType.RESIZE_HORIZONTAL, content.Load <Texture2D>("TerrariAPI/Cursors/ResizeHorz"));
            GUI.BindCursor(CursorType.RESIZE_DIAGONAL, content.Load <Texture2D>("TerrariAPI/Cursors/ResizeDiag"));
            GUI.BindCursor(CursorType.TEXT, content.Load <Texture2D>("TerrariAPI/Cursors/Text"));
            GUI.BindFont(content.Load <SpriteFont>("TerrariAPI/Font"));
            Main.cursorTexture = new Texture2D(Game.GraphicsDevice, 1, 1);
            GameHooks.OnContent();
        }
コード例 #4
0
 internal static void Update2()
 {
     LastPressedKeys = PressedKeys;
     PressedKeys     = Keyboard.GetState().GetPressedKeys();
     if (!DisableKeys && !DisableBindings)
     {
         foreach (Binding b in Bindings)
         {
             if (!LastPressedKeys.Contains <Keys>(b.key) && PressedKeys.Contains <Keys>(b.key))
             {
                 Command.Execute(b.commands);
             }
         }
     }
     DisableBindings = DisableKeys = DisableMouse = false;
     GameHooks.OnUpdate2();
 }
コード例 #5
0
 internal static void Update()
 {
     GameHooks.OnUpdate();
     GUI.Update();
 }