diff options
| author | Apickx <Apickx@cogarr.org> | 2015-12-28 19:18:30 -0500 |
|---|---|---|
| committer | Apickx <Apickx@cogarr.org> | 2015-12-28 19:18:30 -0500 |
| commit | 868e729d68b5913716bfe5ddb512f4099851e9a2 (patch) | |
| tree | 6441108754145dfd68a6e23bea382b5cb1ab63d5 /gamemode/cl_hud/vgui/mbmodel.lua | |
| download | gearfox-868e729d68b5913716bfe5ddb512f4099851e9a2.tar.gz gearfox-868e729d68b5913716bfe5ddb512f4099851e9a2.tar.bz2 gearfox-868e729d68b5913716bfe5ddb512f4099851e9a2.zip | |
Diffstat (limited to 'gamemode/cl_hud/vgui/mbmodel.lua')
| -rw-r--r-- | gamemode/cl_hud/vgui/mbmodel.lua | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/gamemode/cl_hud/vgui/mbmodel.lua b/gamemode/cl_hud/vgui/mbmodel.lua new file mode 100644 index 0000000..373c98a --- /dev/null +++ b/gamemode/cl_hud/vgui/mbmodel.lua @@ -0,0 +1,53 @@ +local PANEL = {} +local Zero = Vector(0,0,0) +local One = Vector(1,1,1) + +function PANEL:Init() + self.bgcol = MAIN_COLOR2 + + self.Model = vgui.Create( "DModelPanel" , self ) + self.Model:SetCamPos( Vector( 30, 30, 30 ) ) + self.Model:SetLookAt( Zero ) + self.Model:SetSize( self:GetWide() , self:GetTall() ) + self.Model:SetPos( 0 , 0 ) + + self.Model.DoRightClick = function(s) self:DoRightClick() end + self.Model.DoClick = function(s) self:DoLeftClick() end +end + +function PANEL:DoRightClick() +end + +function PANEL:DoLeftClick() +end + +function PANEL:SetModel( name , Texture ) + self.Model:SetModel( name ) + + local MSize,SSize = self.Model.Entity:GetRenderBounds() + SSize = SSize:Length() + + self.Model:SetCamPos( One * SSize ) + self.Model:SetLookAt( Zero ) + + if (Texture) then self.Model.Entity:SetMaterial(Texture) end +end + +function PANEL:GetModel() + return self.Model.Entity:GetModel() +end + +function PANEL:SetBGColor( col ) + self.bgcol = col +end + +function PANEL:Paint(w,h) + DrawRect( 0 , 0 , w , h , self.bgcol ) +end + +function PANEL:PerformLayout() + self.Model:SetSize( self:GetWide() , self:GetTall() ) + self.Model:SetPos( 0 , 0 ) +end + +vgui.Register( "MBModel", PANEL , "Panel" )
\ No newline at end of file |
