• Print

Author Topic: Tab menu  (Read 13853 times)

0 Members and 1 Guest are viewing this topic.

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Tab menu
« Reply #15 on: April 13, 2015, 12:13:31 pm »
Something a little easier to both understand and do...

You can use surface.CreateFont to create two fonts.  One normal one and one with some blur.  Draw the text with the blur underneath and the one without the blur on top.
(UNTESTED, but it should work)
Code: Lua
  1. surface.CreateFont("MyFont", {size=24, blursize=0})
  2. surface.CreateFont("MyFont_Blurred", {size=24, blursize=0.3})
  3.  
  4. function SomeDrawFunction()
  5.         surface.SetFontColor(0, 0, 255, 255)
  6.  
  7.         surface.SetFont("MyFont_Blurred")
  8.         local w, h = surface.GetTextSize("THIS IS AN EXAMPLE")
  9.         surface.SetPos(ScrW()/2-w/2, ScrH()/2-h/2)
  10.         surface.DrawText("THIS IS AN EXAMPLE")
  11.  
  12.         surface.SetFont("MyFont")
  13.         local w, h = surface.GetTextSize("THIS IS AN EXAMPLE")
  14.         surface.SetPos(ScrW()/2-w/2, ScrH()/2-h/2)
  15.         surface.DrawText("THIS IS AN EXAMPLE")
  16. end
  17. hook.Add("HUDPaint", "DrawGlowExample", SomeDrawFunction)

EDIT:  Sorry, I had my code wrong, fixed it for you.

EDIT2:  Some other functions you'll need...

player.GetAll()
Entity:GetPos()
Vector:ToScreen()
Player:Nick()
Player:GetUserGroup
« Last Edit: April 13, 2015, 12:23:08 pm by Aaron113 »

Offline brycenmm

  • Newbie
  • *
  • Posts: 12
  • Karma: -1
Re: Tab menu
« Reply #16 on: April 13, 2015, 03:02:40 pm »
Something a little easier to both understand and do...

You can use surface.CreateFont to create two fonts.  One normal one and one with some blur.  Draw the text with the blur underneath and the one without the blur on top.
(UNTESTED, but it should work)
Code: Lua
  1. surface.CreateFont("MyFont", {size=24, blursize=0})
  2. surface.CreateFont("MyFont_Blurred", {size=24, blursize=0.3})
  3.  
  4. function SomeDrawFunction()
  5.         surface.SetFontColor(0, 0, 255, 255)
  6.  
  7.         surface.SetFont("MyFont_Blurred")
  8.         local w, h = surface.GetTextSize("THIS IS AN EXAMPLE")
  9.         surface.SetPos(ScrW()/2-w/2, ScrH()/2-h/2)
  10.         surface.DrawText("THIS IS AN EXAMPLE")
  11.  
  12.         surface.SetFont("MyFont")
  13.         local w, h = surface.GetTextSize("THIS IS AN EXAMPLE")
  14.         surface.SetPos(ScrW()/2-w/2, ScrH()/2-h/2)
  15.         surface.DrawText("THIS IS AN EXAMPLE")
  16. end
  17. hook.Add("HUDPaint", "DrawGlowExample", SomeDrawFunction)

EDIT:  Sorry, I had my code wrong, fixed it for you.

EDIT2:  Some other functions you'll need...

player.GetAll()
Entity:GetPos()
Vector:ToScreen()
Player:Nick()
Player:GetUserGroup

I'm completely ignorant with lua. Where do I put this stuff?? Where do I put it..?

Offline Livaco

  • Full Member
  • ***
  • Posts: 133
  • Karma: -37
    • Livaco
Re: Tab menu
« Reply #17 on: April 14, 2015, 04:26:08 am »
I'm completely ignorant with lua. Where do I put this stuff?? Where do I put it..?
cl_scoreboard.lua or cl_hud_score.lua
Here To Help And Be Happy And Help :)

My Website
My Addons
PermaBanV1.0

Quote from:  Livaco on April 12 at 9:10:20 PM
I May Be Dum But Am Still Better Then The Rest

Livaco Products©

Offline Buzzkill

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 176
  • Karma: 59
    • The Hundred Acre Bloodbath
Re: Tab menu
« Reply #18 on: April 14, 2015, 07:48:30 am »
cl_scoreboard.lua or cl_hud_score.lua

If you're going to copy/paste something I wrote, can you please include the entire context so it doesn't cause confusion?

Quote
something like cl_scoreboard.lua, cl_hud_score.lua, etc.. depending on your gamemode

Offline Livaco

  • Full Member
  • ***
  • Posts: 133
  • Karma: -37
    • Livaco
Re: Tab menu
« Reply #19 on: April 14, 2015, 10:26:48 am »
If you're going to copy/paste something I wrote, can you please include the entire context so it doesn't cause confusion?
What he asked where it goes
Here To Help And Be Happy And Help :)

My Website
My Addons
PermaBanV1.0

Quote from:  Livaco on April 12 at 9:10:20 PM
I May Be Dum But Am Still Better Then The Rest

Livaco Products©

Offline Buzzkill

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 176
  • Karma: 59
    • The Hundred Acre Bloodbath
Re: Tab menu
« Reply #20 on: April 14, 2015, 10:54:09 am »
What he asked where it goes


Do you know exactly which gamemode he's playing?  Or which menu system he is using?  If you direct him to specific files that don't exist, it creates the opportunity for all sorts of confusion that could be avoided by speaking in general terms (which is what I tried to do when I first referenced those two file names).


  • Print