GithubHelp home page GithubHelp logo

handsomematt / 3d2d-vgui Goto Github PK

View Code? Open in Web Editor NEW
90.0 10.0 25.0 981 KB

:eyes: Render and control 2D VGUI in 3D world space for Garry's Mod

License: MIT License

Lua 100.00%
gmod lua 3d2d vgui

3d2d-vgui's People

Contributors

axelbm avatar extremlapin avatar handsomematt avatar mattjeanes avatar ottworks avatar stromic avatar williamvenner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

3d2d-vgui's Issues

Couldn't include module

I getting this:
Couldn't include file 'includes\modules\3d2dvgui.lua' (File not found) (@addons/profile/lua/autorun/client/cl_init.lua (line 146))

I placed 3d2dvgui.lua in "lua/includes/modules" but it still can't find it. Where do i need to place 3d2dvgui.lua?

DHTML Doesn't work correctly

So, when i try to press button, created in html, it is doesn't work, and parent panel is moving.
image (This circle doesn't pressing (web-page: ru.pbox-serv.ga/tests.html ) )

Cant move the panels

I noticed when you pressed e on the panels when its not on anywhere besides the background the panels starts to shift down and right every time you press e on the panel.

Moving frames does not work correctly.

Attempting to hold E and drag/move a frame does not work correctly. Upon trying to move a created frame to the left, or up, relative to the plane it was placed on, the direction reverses and the frame starts to move right or down respectively.

Steps to reproduce:

  1. Make a frame, I simply created the a plain DFrame with size 250, 150, and a postion of (0,0)
  2. hold E on the corner of the frame and try to move it to the left or up
  3. See that it doesn't work.

DImageButton wont work

Is this because it was never supported, just a bug or am I doing something wrong....

My code:

	local DFrame = vgui.Create( "DFrame" )
	DFrame:SetTitle( "" )
	DFrame:SetPos( 0, 0 )
	DFrame:SetSize( 920, 450 )
	DFrame:SetDraggable(false)
	DFrame:ShowCloseButton(false)
	DFrame.Paint = function(s, w, h)
		draw.SimpleText("Blah","DermaLarge",w / 2,20,Color( 0, 0, 0, 255 ),TEXT_ALIGN_CENTER,TEXT_ALIGN_TOP)
	end

	local InfoBtn = vgui.Create( "DImageButton", DFrame )
	InfoBtn:SetPos( 10, 345 )
	InfoBtn:SetImage( "icon16/information.png" )
	InfoBtn:SizeToContents()
	InfoBtn.DoClick = function()
		LocalPlayer():ChatPrint("Hey lmao")
	end

	local testbtn = vgui.Create("DButton", DFrame)
	testbtn:SetPos(200, 100)
	testbtn:SetSize(100,100)
	testbtn:SetText("Text")
	testbtn.DoClick = function()
		LocalPlayer():ChatPrint("Hey lmao")
	end

That looks like this

The desk

As you can see the 3 main components... The title at the top, the big test button, and the small info logo button.

If I click the big button I get a "Hey lmao" message in my chat box however when I click that little logo... I get nothing... So the main issue is that DImageButtons are not working. Maybe it's something I did wrong? I'm not sure but thanks for reading!

Derma panels are cropped (Tested inside an entity)

What happens:

All derma drawing is discarded beyond a certain size (Seems that this size is similar to the screen's resolution).

gm_construct_flatgrass_v6-20002

Since Gmod Derma uses the very screen it may happen that this will not work never, but if there's a solution aside from scaling up the derma it would be nice. (Sure that scaling up the viewport may patch the issue, but the resolution is drastically decreased).

Steps to reproduce:

Create any derma panel using vgui.Create('DFrame');, then set a size higher than your screen resolution.

Code used:

if SERVER then return; end; --Ensure clientside only
function ENT:Initialize()
	local frame = vgui.Create( "DFrame" );
	frame:SetTitle( self.title );
	frame:SetPos( 0, 0 );
	frame:SetSize( 2048, 2048 ); --This can be any W x H
	self.frame = frame;
end
function ENT:Draw()
	self:DrawModel();
	local o = self:GetPos();
	local ang = self:GetAngles();
	local topleft = ang:Forward() * self.corner.x + ang:Right() * self.corner.y;
	-- Above code is for positioning the screen only.
	vgui.Start3D2D( o - topleft + ang:Up() * 1.6, ang, self.scale);
		self.frame:Paint3D2D(); -- here paint the frame
	vgui.End3D2D();
end

3D2D-vgui on swep

My 3D2D Vgui is broken , the position of button in Paint is working but , the position for the mouse clicker is not working !

My swep is like that : http://prntscr.com/nym9cj

I run my vgui.Start3D2D in SWEP:ViewModelDrawn()

With ParentToHUD() , i can't click on any buttons !
Without ParentToHUD(), the position of button is broken.

Getting an error

hello, this is what im getting when using this:
hook.Add( "PostDrawOpaqueRenderables", "DrawSample3D2DFrame", function()
vgui.Start3D2D( pos, angle, 0.5)
hitbutton1:Paint3D2D()
vgui.End3D2D()
end)

[ERROR] gamemodes/rp1950s/gamemode/libraries/client/cl_3d2d.lua:180: attempt to call method 'OThink' (a nil value)

  1. unknown - gamemodes/rp1950s/gamemode/libraries/client/cl_3d2d.lua:180

[ERROR] stack overflow

  1. __index - [C]:-1
    1. OThink - gamemodes/rp1950s/gamemode/libraries/client/cl_3d2d.lua:175
    2. OThink - gamemodes/rp1950s/gamemode/libraries/client/cl_3d2d.lua:180
      1. OThink - gamemodes/rp1950s/gamemode/libraries/client/cl_3d2d.lua:180
      2. OThink - gamemodes/rp1950s/gamemode/libraries/client/cl_3d2d.lua:180
      3. OThink - gamemodes/rp1950s/gamemode/libraries/client/cl_3d2d.lua:180
      4. OThink - gamemodes/rp1950s/gamemode/libraries/client/cl_3d2d.lua:180
        1. OThink - gamemodes/rp1950s/gamemode/libraries/client/cl_3d2d.lua:180
        2. OThink - gamemodes/rp1950s/gamemode/libraries/client/cl_3d2d.lua:180
        3. OThink - gamemodes/rp1950s/gamemode/libraries/client/cl_3d2d.lua:180
        4. OThink - gamemodes/rp1950s/gamemode/libraries/client/cl_3d2d.lua:180
          1. OThink - gamemodes/rp1950s/gamemode/libraries/client/cl_3d2d.lua:180
          2. OThink - gamemodes/rp1950s/gamemode/libraries/client/cl_3d2d.lua:180
          3. OThink - gamemodes/rp1950s/gamemode/libraries/client/cl_3d2d.lua:180
          4. OThink - gamemodes/rp1950s/gamemode/libraries/client/cl_3d2d.lua:180
            1. OThink - gamemodes/rp1950s/gamemode/libraries/client/cl_3d2d.lua:180

Problems using DScrollPanel

Hey there,

i am satisfied with the 3d2d-vgui-"Library" so far.
But there's one thing i can't handle.

If i add a ScrollPanel to no matter which existing Panel, the elements (which should be invisible) are still visible.

Just ignore these error-images.

This

[Stupid] Stack overflow when creating the spawn menu

I was messing around with this and decided to place the spawn menu on a wall and was welcomed with a stack overflow when I tried to do so:

[ERROR] stack overflow
  1. __index - [C]:-1
   2. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:198
    3. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
     4. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
      5. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
       6. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
        7. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
         8. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
          9. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
           10. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
            11. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
             12. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
              13. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
               14. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
                15. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
                 16. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203

Here is how I created the panel:

local sampleFrame = vgui.Create( "SpawnMenu" )
sampleFrame:SetPos( 0, 0 )
sampleFrame:Open()

I'm probably spawning it wrong but I thought to post it just in case it is something with your code

DTextEntry doesnt accept input

When I click on a DTextEntry it posts the OnMousePressed event via
pnl[event](pnl, ...)
in
local function postPanelEvent(pnl, event, ...)
but I can't verify if the text box is actually getting focused or not.

I spent a couple hours on this. Just wondering if you have any ideas/plans for this functionality.

Great job otherwise!

Frame is display on my screen (not correctly)

Hello,
when I open a new frame on m entity I can't use anymore my tab menu (in darkrp). I seen the problem is the position of the frame at points 0 , 0. The frame is work correctly on the entity but the frame is display transparently on my screen: I can click on button and the click hovered is display (on my screen and on my entity) :/ . My question is: How can I block the displaying of the frame on my screen ?

PS: Sorry for the misspelling, I'm French.

[Question] Addon localisation

Yo, so basically I'm using this in my addon and sooner or later it's probably going to conflict with someone else's version of it I imagine. vON has approached this issue by just asking everyone to add it to their addon locally rather than globally - like this.

Do you think this is going to be an issue in the future and does something need to be done about it?

DComboBox

Hey matt,
This 2D3D VGUI script is perfect for me right now because i need this sort of interaction on a panel im using for entities however i have found that DComboBoxes don't stick to the the parent frame when it is open and the options aren't displayed on the 3D2D panel, instead they throw an error and display on your screen instead. How would this be fixed?

http://prntscr.com/kd27y4

The error:

[ERROR] lua/vgui/dmenu.lua:185: attempt to call field 'PerformLayout' (a nil value)

  1. PerformLayout - lua/vgui/dmenu.lua:185
  2. unknown - lua/vgui/dscrollpanel.lua:14

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.