wyozi-gmod / imgui Goto Github PK
View Code? Open in Web Editor NEWImmediate mode 3D2D UI for Garry's Mod
License: MIT License
Immediate mode 3D2D UI for Garry's Mod
License: MIT License
I get a error when it fades out and the error is at line 428 which is imgui.End3D2D(). Ive been having this problem for a while but waited to fix it because it wasnt a game breaking bug so it was at the bottom of my list to fix. Can you please help me.
I'd appreciate a simple screenshot or link if you use IMGUI in your own project, to satisfy my curiosity :)
I would like to use this library without the GPL having a leash on me, more specifically needing to publish source code along with installation instructions to the public.
This is unfortunately a blocking issue for my commissioned work as well as other personal projects.
It's maybe my bad but how to create different render for different player?
For example, I want to create a bank system where player could log into their account and show their money. But what happens to me is that when you press button on 1. entity, it's pressed on 2. entity that is elsewhere, so when player pressed login, it displayed his money on every single entity on the map.
Ever since ive got imgui my game crashes heres the script
''include("shared.lua")
local imgui = include("imgui.lua")
surface.CreateFont( "Font", {
font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
extended = false,
size = 100,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false,
} )
surface.CreateFont( "Font2", {
font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
extended = false,
size = 30,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false,
} )
function ENT:Draw()
self:DrawModel()
local Pos = self:GetPos()
local Ang = self:GetAngles()
local temp = LocalPlayer():GetNetworkedInt( "temp", 0)
Ang:RotateAroundAxis(Ang:Up(), 90)
cam.Start3D2D(Pos + Ang:Up() * 10.6, Ang, 0.11 )
imgui.Start3D2D(Pos + Ang:Up() * 10.6, Ang, 0.11 )
draw.WordBox(8, -80, -150, "", "Font", Color(120, 120, 255, 0), Color(255, 255, 255, 0))
draw.RoundedBox(0, -135, -145, 275, 290, Color(120,120,120,255))
draw.SimpleText("$"..self.Entity:GetMoneyAmount(), "Font", 0, -100, Color(255, 255, 255, 255),1 ,1)
draw.RoundedBox(0, -102, -32, 204, 30, Color(75,75,75,255))
draw.RoundedBox(0, -102, 28, 204, 30, Color(75,75,75,255))
draw.RoundedBox(0, -100, -30, self.Entity:GetTemp() * 2, 25, Color(100,100,100,255))
draw.RoundedBox(0, -100, 30, self.Entity:GetPower() * 2, 25, Color(100,100,100,255))
draw.SimpleText("Temperature: "..self.Entity:GetTemp(), "Font2", 0, -18, Color(255, 255, 255, 255),1 ,1)
draw.SimpleText("Power: "..self.Entity:GetPower(), "Font2", 0, 43, Color(255, 255, 255, 255),1 ,1)
if imgui.xTextButton("Foo bar", "!Roboto@24", -100, 100, 200, 25) then
-- the xTextButton function returns true, if user clicked on this area during this frame
print("yay, we were clicked :D")
end
cam.End3D2D()
imgui.End3D2D()
end''
In which case those would be derived from text size
see title; i am not sure what kind of debug output would be more helpful/informative. i've been able to get around this by specifying a cooldown until the code in the condition runs again after pressing the button but this seems hacky.
Hi, Sorry if the issues tab isn't the right place for this.
I am trying to have a button start as one color, and once it is pressed have it change to another color until it's changed elsewhere.
I've tried a couple different things to do this, but I'm having trouble figuring it out.
Also, I'd like to have the button's background color be solid rather than just transparent with a border.
Are these things possible? Thank you.
if (imgui.Entity3D2D(LocalPlayer(), Vector(0,0,0), Angle(0,0,0), 1)) then
if (imgui.xButton(250, 0, 0, 1000, 1000, Color(255, 255, 255), Color(255, 0, 0), Color(0, 0, 255))) then
chat.AddText("PRESSED IT")
end
draw.RoundedBox(10, 0, 0, 500, 500, Color(255,0,0))
imgui.End3D2D()
end
Lines 363 to 369 in 35473f1
Is there a reason for using DrawTexturedRect opposed to DrawRect, seeing as colorMat can't be changed?
lul
`function ENT:DrawTranslucent()
self:DrawModel()
if LocalPlayer():GetPos():Distance(self:GetPos())>500 then return end
local w = 1000
local h = 376
if imgui.Entity3D2D(self,Vector(22, -20, 30), Angle(0, 90, 90), 0.1, 200, 150) then
draw.RoundedBox(0,0,0,350,500,Color(130,70,30,200))
if imgui.xTextButton("Soda", "!Roboto@24", 30, 30, 100, 100) then
-- the xTextButton function returns true, if user clicked on this area during this frame
print("yay, we were clicked :D")
end
imgui.End3D2D()
end
end`
Hi guys. I wanted to make a custom printer for classic DarkRP and I stuck in rotating procces. As far as I know imgui doesn't support rotating directly. I've tried to ask Copilot and Chat-GPT 3.5 but both of them didn't satisfy me. Here's the pic:
With red pen I marked where I'd love to see the button.
Part of my code (cl_init.lua):
function ENT:Draw()
self:DrawModel()
if imgui.Entity3D2D(self, Vector(-12, 12, 7.9), Angle(0, 0, 0), 0.1) then
self:SetColor(Color(70, 70, 70))
surface.SetDrawColor(70, 70, 70)
surface.DrawRect(10, 10, 210, 220)
draw.SimpleTextOutlined(self:GetMoneyAmount(), "MoneyFont", 0, 0, Color( 255, 255, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP, 1, Color( 255, 255, 255 ))
if imgui.xTextButton("Take", "!Roboto@24", 0, 30, 100, 25, 1, Color(255,255,255), Color(180,180,180), Color(120,120,120)) then
net.Start("TakeMoney")
net.WriteEntity(self)
net.SendToServer()
end
imgui.End3D2D()
end
end
I'm trying to make a swep that works similarly to the pipboy, however the viewmodel of the swep's fov and the players fov seems to make the buttons not work correctly.
If i make it to for example:
if (imgui.Entity3D2D(self, Vector(-71, -95, 2), Angle(0, 90, 0), 0.1), LocalPlayer():IsAdmin()) then
it function if the user started with the permission but if he is for example not anymore admin and become admin again it wont work anymore
Is this a thing from gmod or its a glitch?
Hello
I writing because I have a problem. I want to make 3d2d menu with multi scenes, I mean you have a main scene and there you have a button for example "test1" when you click "test1" then will open a new scene. I don't know how can I make something like that or is it possible.
Have a nice day
Soberaja
Is it possible to load and insert images with imgui? Or is there any other way for me to display an image in 3D2D?
i dont know what goes where and i dont know what im doing can someone please help me ;3; reply to this or dm me on discord
{Toby the kat}#7246
I know ive made a issue about this befor but it was closed and im still geting crashes i think it might have something to do with imgui ive made a download link to my addon im making http://www.mediafire.com/file/xn4c2twkilbhfxg/BeastPrinters.zip/file ive trimemd the code a bit and crashes are not as often but i still dont know how to fix them
I used TDUI in my addon before finding this, is it similar or will I have to do a big change in the codebase?
Im trying to make a purchasing system but net.Send keeps breaking imgui.
net.Start("PurchaseItem")
net.Send( LocalPlayer() )
When ever i walk away from my imgui creation i get this error
[DarkRP] addons/fallout_chems/lua/entities/chem_workbench/imgui.lua:294: tried to end invalid render instance
The line of code on cl_init is
imgui.End3D2D()
and the line of code in imgui is
cam.End3D2D()
Been trying to figure this out. Want to attach this to a "models/hunter/plates/plate2x4.mdl" entity and have a sort of placeable scoreboard. I honestly cant figure out how to parent it to the entities position and angle, I also can't figure out how to make my entity still visible as well.
I figure a couple quick examples would do to help me figure this out.
Hey.
I'm working on some 3D2D stuff on a ViewModel, and I found that the FOV makes the cursor fall out of sync with the UI. I looked at #9, which seems to share my issue, but I'm not too keen on his solution. Is there anything else I can do to get around this? It could be that I just have a monkey brain and am missing something really obvious.
A code snippet:
function SWEP:PostDrawViewModel(entity, weapon, ply)
if imgui.Entity3D2D(entity, Vector(9.99, 3.36, 2.17), Angle(0, -90, 89), 0.01) then
draw.RoundedBox(0, 0, 0, 100, 100, color_white)
imgui.xCursor(0, 0, 612, 396)
imgui.End3D2D() end
end
Any help on this would be amazing.
I've been getting routine CTDs when I pull out my physgun near a panel, move an entity the panel is tied to, or when I leave the rendering distance specified in imgui.Start3D2D and then return again.
This happens even when the code is just an empty context:
imgui.Start3D2D(self:GetPos() + self:GetForward () * 42.5 + self:GetUp() * 48.75, ang, 0.01)
imgui.End3D2D()
Could be an error on my part but the lack of error messages has me stumped. This doesn't happen with regular cam.Start3D2D.
(Fantastic work by the way - this is really cool stuff)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.