Results 1 to 7 of 7
  1. #1
    ItsMakar's Avatar
    Join Date
    Aug 2021
    Gender
    male
    Posts
    19
    Reputation
    10
    Thanks
    0

    ImGui item giver

    hello, I'm making my client for a terrarium with ImGui and I want to make an item giver, but I don't understand 2 things in 1 how to get the texture of an object by ID and in 2 how to create buttons, I tried to create them through foreach, but nothing worked for me

  2. #2
    convicted tomatophile's Avatar
    Join Date
    Apr 2021
    Gender
    male
    Location
    Southern California
    Posts
    0
    Reputation
    10
    Thanks
    21
    My Mood
    Sleepy
    TextureAssets.Item[id] returns an Asset<Texture2D> of that item. If you're unsure of whether the item's asset will be loaded (1.4 uses asynchronous asset loading), request the asset manually with ImmediateLoad instead of AsyncLoad.
    C# programmer.
    convicted tomatophile#0001

  3. #3
    ItsMakar's Avatar
    Join Date
    Aug 2021
    Gender
    male
    Posts
    19
    Reputation
    10
    Thanks
    0

    Question

    Quote Originally Posted by convicted tomatophile View Post
    TextureAssets.Item[id] returns an Asset<Texture2D> of that item. If you're unsure of whether the item's asset will be loaded (1.4 uses asynchronous asset loading), request the asset manually with ImmediateLoad instead of AsyncLoad.
    how can i display the texture? when using imguics it displays a white square instead of a texture i use https://******.com/0x0ade/ImGuiCS/bl...GuiXNAState.cs

    - - - Updated - - -

    Quote Originally Posted by convicted tomatophile View Post
    TextureAssets.Item[id] returns an Asset<Texture2D> of that item. If you're unsure of whether the item's asset will be loaded (1.4 uses asynchronous asset loading), request the asset manually with ImmediateLoad instead of AsyncLoad.
    ~~And the problem is not even in imgui, the problem is that this method returns Assets, that is, it is not automatically compatible with imgui / xna. The question is how does terraria render such textures?~~

    oh i just had to add .value

    - - - Updated - - -

    i finally fixed my problem

    but when i try to display exactly the texture from the terraria i get a white square

    as far as I understand, the problem is in imgui or my parameters of the button with a picture, since I made a completely working method for obtaining texture by ID here are the codes


    public static Texture2D GetTextureByID(string type, int id, GraphicsDevice graphicsdevice)
    {
    var tx = new Texture2D(graphicsdevice, 20, 20);
    if (type == "item") { tx = Main.instance.Content.Load<Texture2D>("Images\\Ite m_" + id); }
    if (type == "npc") { tx = Main.instance.Content.Load<Texture2D>("Images\\NPC _" + id); }
    if (type == "projectile") { tx = Main.instance.Content.Load<Texture2D>("Images\\Pro jectile_" + id); }
    if (type == "buff") { tx = Main.instance.Content.Load<Texture2D>("Images\\Buf f_" + id); }
    return tx;
    }

    ImGui.ImageButton(ImGuiState.Register(texture), new ImVec2(50, 50), new ImVec2(0, 0), new ImVec2(0, 0), 0, new ImVec4(1, 1, 1, 1), new ImVec4(1, 1, 1, 1));

    I FIXED IT!!!!!!!!!
    Last edited by ItsMakar; 12-17-2021 at 09:20 AM.

  4. #4
    ItsMakar's Avatar
    Join Date
    Aug 2021
    Gender
    male
    Posts
    19
    Reputation
    10
    Thanks
    0

    Unhappy .

    it works but i can't filter items because text input doesn't work any idea how to fix it? I use the ImGuiXNA renderer and apparently the problem is in it

  5. #5
    HiImKyle's Avatar
    Join Date
    Oct 2015
    Gender
    male
    Location
    England
    Posts
    233
    Reputation
    10
    Thanks
    206
    ImGuiXNA is outdated and pretty bad, consider using ImGui.NET

  6. #6
    ItsMakar's Avatar
    Join Date
    Aug 2021
    Gender
    male
    Posts
    19
    Reputation
    10
    Thanks
    0

    imgui.net too not work with xna :(

    Quote Originally Posted by HiImKyle View Post
    ImGuiXNA is outdated and pretty bad, consider using ImGui.NET
    imgui.net too not work with xna

    EDIT: ok someday i will try to completely rewrite my client to imgui.net and i hope it helps
    Last edited by ItsMakar; 06-02-2022 at 06:51 PM.

  7. #7
    ItsMakar's Avatar
    Join Date
    Aug 2021
    Gender
    male
    Posts
    19
    Reputation
    10
    Thanks
    0
    Quote Originally Posted by convicted tomatophile View Post
    TextureAssets.Item[id] returns an Asset<Texture2D> of that item. If you're unsure of whether the item's asset will be loaded (1.4 uses asynchronous asset loading), request the asset manually with ImmediateLoad instead of AsyncLoad.
    you know how to get item name by id?

    - - - Updated - - -

    and how to auto new line after 10 image buttons?

Similar Threads

  1. [Solved] Writing a Item Giver
    By Neppuu in forum Reign Of Kings Discussions & Help
    Replies: 1
    Last Post: 06-14-2015, 05:35 AM
  2. [Request] Runescape Item Giver
    By MrHackster in forum RuneScape Discussions
    Replies: 3
    Last Post: 11-24-2012, 10:51 AM
  3. Free Item Giver
    By Jaketh3snake in forum Realm of the Mad God Help & Requests
    Replies: 13
    Last Post: 10-20-2012, 06:21 AM
  4. Cheat Engine.. ITEM SHOP!
    By Shpalman in forum WarRock - International Hacks
    Replies: 10
    Last Post: 12-13-2006, 05:01 PM
  5. B> some ares items for usd
    By AN1MAL in forum General Game Hacking
    Replies: 3
    Last Post: 08-01-2006, 03:49 PM