Created
April 10, 2017 21:11
-
-
Save AMD-NICK/6ab6ad1d0c48b3f3745b38e0ac0114ec to your computer and use it in GitHub Desktop.
Наброски первого варианта собственного HUD. Оказались крайне неудачными, от чего пришлось отказаться еще до того, как они стали на что-то похожи
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
surface.CreateFont('ui.40', {font = 'roboto', extended = true, size = 40, weight = 500}) | |
surface.CreateFont('ui.39', {font = 'roboto', extended = true, size = 39, weight = 500}) | |
surface.CreateFont('ui.38', {font = 'roboto', extended = true, size = 38, weight = 500}) | |
surface.CreateFont('ui.37', {font = 'roboto', extended = true, size = 37, weight = 500}) | |
surface.CreateFont('ui.36', {font = 'roboto', extended = true, size = 36, weight = 500}) | |
surface.CreateFont('ui.35', {font = 'roboto', extended = true, size = 35, weight = 500}) | |
surface.CreateFont('ui.34', {font = 'roboto', extended = true, size = 34, weight = 500}) | |
surface.CreateFont('ui.33', {font = 'roboto', extended = true, size = 33, weight = 500}) | |
surface.CreateFont('ui.32', {font = 'roboto', extended = true, size = 32, weight = 500}) | |
surface.CreateFont('ui.31', {font = 'roboto', extended = true, size = 31, weight = 500}) | |
surface.CreateFont('ui.30', {font = 'roboto', extended = true, size = 30, weight = 500}) | |
surface.CreateFont('ui.29', {font = 'roboto', extended = true, size = 29, weight = 500}) | |
surface.CreateFont('ui.28', {font = 'roboto', extended = true, size = 28, weight = 500}) | |
surface.CreateFont('ui.27', {font = 'roboto', extended = true, size = 27, weight = 400}) | |
surface.CreateFont('ui.26', {font = 'roboto', extended = true, size = 26, weight = 400}) | |
surface.CreateFont('ui.25', {font = 'roboto', extended = true, size = 25, weight = 400}) | |
surface.CreateFont('ui.24', {font = 'roboto', extended = true, size = 24, weight = 400}) | |
surface.CreateFont('ui.23', {font = 'roboto', extended = true, size = 23, weight = 550}) -- weight | |
surface.CreateFont('ui.22', {font = 'roboto', extended = true, size = 22, weight = 400}) | |
surface.CreateFont('ui.20', {font = 'roboto', extended = true, size = 20, weight = 700}) -- weight | |
surface.CreateFont('ui.19', {font = 'roboto', extended = true, size = 19, weight = 400}) | |
surface.CreateFont('ui.18', {font = 'roboto', extended = true, size = 18, weight = 700}) -- weight | |
surface.CreateFont('ui.17', {font = 'roboto', extended = true, size = 17, weight = 500}) | |
surface.CreateFont('ui.15', {font = 'roboto', extended = true, size = 15, weight = 550}) | |
local W,H = 200,80 | |
local MG = 20 -- margin | |
local agenda = [[ | |
Допустим задача | |
И еще одна | |
А теперь большая задача и типа длинная строка для теста ага | |
Тыц | |
Атаковать мэра | |
Атаковать босса рэкетиров | |
Патролировать город, пока я не скажу, что хватит | |
Если кто будет бегать по улице, то арестуйте его | |
]] | |
local lockdown = "Мэр объявил комендантский час!\nКто будет на улице может быть арестован" | |
local COL_BG = Color(255,255,255,200) | |
local COL_GREEN = Color(25,175,130) | |
local COL_GRAY = Color(35,35,35) | |
local COL_RED = Color(240,100,100) | |
local COL_BLUE = Color(80,150,255) | |
local SW,SH | |
local LP | |
local function drawHUD() | |
draw.Box(MG,SH - MG - H + 1,W,H,Color(150,150,150)) -- BG BG | |
draw.Box(MG,SH - MG - H,W,H,COL_BG) -- BG | |
draw.Box(MG,SH - MG - H,W,3,COL_GREEN) -- upper green line | |
surface.SetDrawColor(220,220,220) | |
surface.DrawLine(MG,SH - H - MG + H / 2, MG + W,SH - H - MG + H / 2) -- middle hor line | |
surface.DrawLine(MG + W / 2,SH - MG - H / 2,MG + W / 2,SH - MG) -- middle vert line | |
draw.DrawText(qq.formatMoney(2280435000),"ui.20",MG + 40,SH - MG - H + 5,COL_GREEN) -- wallet | |
draw.DrawText("Зарплата: " .. qq.formatMoney(40000),"ui.15",MG + 40,SH - MG - H + 23,COL_GRAY) -- salary | |
draw.DrawText(100500,"ui.18",MG + 30,SH - MG - H / 2 + 11,COL_RED) -- health | |
draw.DrawText(50,"ui.18",MG + 30 + W / 2,SH - MG - H / 2 + 11,COL_BLUE) -- armor | |
surface.SetDrawColor(0,0,0) | |
surface.SetMaterial(Material("icon16/error.png")) -- розыск | |
surface.DrawTexturedRect(MG + W + 10,SH - MG - 60,25,25) | |
surface.SetMaterial(Material("icon16/page.png")) -- лицензия | |
surface.DrawTexturedRect(MG + W + 10,SH - MG - 30,25,25) | |
surface.SetMaterial(Material("icon16/money.png")) -- кошелек | |
surface.DrawTexturedRect(MG + 10,SH - MG - H + 10,25,25) | |
surface.SetMaterial(Material("icon16/page.png")) -- ХП | |
surface.DrawTexturedRect(MG + 10,SH - MG - 29,16,16) | |
surface.SetMaterial(Material("icon16/page.png")) -- бронь | |
surface.DrawTexturedRect(MG + 110,SH - MG - 29,16,16) | |
end | |
local function drawTextBox(x,y,w,h,title,txt,color,icon) | |
txt = qq.textWrap(txt, "ui.15", w - 70) | |
txt = string.Implode("\n",txt) | |
local _,th = surface.GetTextSize(txt) | |
local tall = (h or th) + 120 | |
draw.Box(x,y,w,tall,COL_BG) -- BG | |
draw.Box(x,y,w,2,color) -- upper line | |
draw.DrawText(title,"ui.23",x + 60,y + 15,color) | |
draw.DrawText(txt,"ui.17",x + 10,y + 15 + 30,COL_GRAY) | |
return tall--,txt | |
end | |
local lastpos = 0 | |
local function drawAGENDA() | |
lastpos = MG + drawTextBox(MG,MG,300,nil,"Полицейское вещание",agenda,COL_BLUE) | |
end | |
local function drawLockdown() | |
drawTextBox(MG,MG + lastpos,300,nil,"Комендантский час",lockdown,COL_GREEN) | |
end | |
local function drawPLAYERINFO() | |
end | |
hook.Add("HUDPaint","any identifier",function() | |
SW,SH = ScrW(),ScrH() | |
LP = LocalPlayer() | |
drawHUD() | |
drawAGENDA() | |
drawLockdown() | |
drawPLAYERINFO() | |
return true | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment