Coder Social home page Coder Social logo

Multiple Buttons are Mixed about 3d2d-imgui HOT 9 CLOSED

wyozi avatar wyozi commented on June 12, 2024
Multiple Buttons are Mixed

from 3d2d-imgui.

Comments (9)

wyozi avatar wyozi commented on June 12, 2024

I can't seem to reproduce. Can you post the code you're using. Here's the code I tested with

ENT.Type = "anim"
function ENT:Initialize()
    if SERVER then
        self:PhysicsInit(SOLID_VPHYSICS)
        self:SetMoveType(MOVETYPE_VPHYSICS)
        self:SetSolid(SOLID_VPHYSICS)
        self:SetModel("models/props_borealis/bluebarrel001.mdl")
    end
end

function ENT:Draw()
    self:DrawModel()

    self.p = self.p or tdui.Create()

    if self.p:Button("Woop", "DermaLarge", 0, 0, 100, 50) then
        self:SetColor(Color(math.random(0, 255), math.random(0, 255), math.random(0, 255))) 
    end
    self.p:Render(self:GetPos() + self:GetForward() * -25, self:GetAngles(), 0.1)
end

from 3d2d-imgui.

KronKraken-zz avatar KronKraken-zz commented on June 12, 2024

A sec i'll make you a video

from 3d2d-imgui.

KronKraken-zz avatar KronKraken-zz commented on June 12, 2024

But wait is that rendering server side? I am rendering client side, any problems with that?

from 3d2d-imgui.

wyozi avatar wyozi commented on June 12, 2024

It is rendering on clientside. It is a shared file. I spawned two barrels and the button on each of them works independently of each other.

If I had to guess, I'd say you're maybe not caching the tdui panel properly. Make sure you don't store it in a local variable but the self object.

from 3d2d-imgui.

KronKraken-zz avatar KronKraken-zz commented on June 12, 2024

http://i.imgur.com/N1uYn4O.jpg = 1 Printer Works fine
http://i.imgur.com/niuF8fX.jpg = 2 Printers, struggle(sorry for bug on the print)

from 3d2d-imgui.

wyozi avatar wyozi commented on June 12, 2024

I just tested two independently working entities, so I'm not sure if it's my code not working. Are you sure you don't for example store the printer status in ENT instead of `self`` or use the same tdui panel for two entities?

I don't think I can help you further without seeing the code you're using.

from 3d2d-imgui.

KronKraken-zz avatar KronKraken-zz commented on June 12, 2024

Oh that you said was the actual problem, it was storing it on local p, now it is self.p, so no bug, thanks for the help tho! :D

from 3d2d-imgui.

KronKraken-zz avatar KronKraken-zz commented on June 12, 2024

The thing was on the readme i saw "local p" so that's why i did it, thanks for the help 👍

from 3d2d-imgui.

wyozi avatar wyozi commented on June 12, 2024

Yeah, I'll try to clarify it a bit. Maybe a PostDrawTranslucentRenderables hook isn't the best example, because most people want to use it for entities :octocat:

from 3d2d-imgui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.