From 56ed89173c80ef377685fff5f67c203f9c18fea0 Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Wed, 27 May 2020 22:43:47 +0200 Subject: [PATCH] Minor work on dialogue menu --- gamemode/engine/core/client/cl_fonts.lua | 8 ++++++- gamemode/engine/derma/menus/menu_dialogue.lua | 21 ++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/gamemode/engine/core/client/cl_fonts.lua b/gamemode/engine/core/client/cl_fonts.lua index 02c7ed5..f84a239 100644 --- a/gamemode/engine/core/client/cl_fonts.lua +++ b/gamemode/engine/core/client/cl_fonts.lua @@ -185,4 +185,10 @@ surface.CreateFont( "q_craft_hud_text", { font = "Cambria", size = 25 * Quantum.Client.ResolutionScale, antialias = true -}) \ No newline at end of file +}) + +surface.CreateFont( "q_dialogue_question", { + font = "Arial", + size = 38 * Quantum.Client.ResolutionScale, + antialias = true +}) diff --git a/gamemode/engine/derma/menus/menu_dialogue.lua b/gamemode/engine/derma/menus/menu_dialogue.lua index 64ccf9b..18c9d71 100644 --- a/gamemode/engine/derma/menus/menu_dialogue.lua +++ b/gamemode/engine/derma/menus/menu_dialogue.lua @@ -76,14 +76,29 @@ function menu.open( dt ) end end f.w, f.h = f:GetSize() - + + f.dialogue = {} + local textColor = Color(255, 255, 255, 120) + + -- Title is static, can't be changed mid dialogue. local title = vgui.Create( "DLabel", f ) -- dialogue title, useally the npcs name or something title:SetText(node.name) title:SetFont("q_header_s") - title:SetTextColor(Color(255, 255, 255, 120)) + title:SetTextColor(textColor) title:SizeToContents() title.w, title.h = title:GetSize() - title:SetPos( padding*2, borderHeight/2 - title.h/2 ) + title:SetPos(padding*2, borderHeight/2 - title.h/2) + + -- Dialogue question + f.dialogue.q = vgui.Create("DLabel", f) + f.dialogue.q:SetText(dialogue["init"].question) + f.dialogue.q:SetFont("q_dialogue_question") + f.dialogue.q:SetTextColor(textColor) + f.dialogue.q:SizeToContents() + f.dialogue.q.w, f.dialogue.q.h = f.dialogue.q:GetSize() + f.dialogue.q:SetPos(padding*2, sh - borderHeight/2 - f.dialogue.q.h) + + return f end end