Move constants to constants.lua; outline all text; change HudHintTextLarge to HudDefault to support outlines

This commit is contained in:
vlazed 2024-08-19 16:14:26 -04:00
parent 779d524f57
commit 51d721cb30
6 changed files with 35 additions and 16 deletions

View File

@ -1,3 +1,7 @@
-- load dconstants
include("ragdollmover/constants.lua")
AddCSLuaFile("ragdollmover/constants.lua")
-- load gizmos library
include("ragdollmover/rgm_gizmos.lua")
AddCSLuaFile("ragdollmover/rgm_gizmos.lua")
@ -9,6 +13,7 @@ AddCSLuaFile("ragdollmover/rgm_gizmos.lua")
module("rgm", package.seeall)
--[[ Line-Plane intersection, and return the result vector
I honestly cannot explain this at all. I just followed this tutorial:
http://www.wiremod.com/forum/expression-2-discussion-help/19008-line-plane-intersection-tutorial.html
@ -21,7 +26,7 @@ function IntersectRayWithPlane(planepoint, norm, line, linenormal)
return vec
end
local VECTOR_ONE = Vector(1, 1, 1)
local VECTOR_ONE = RGM_Constants.VECTOR_ONE
--Receives player eye position and eye angles.
--If cursor is visible, eye angles are based on cursor position.
@ -944,9 +949,9 @@ end
if CLIENT then
local COLOR_RGMGREEN = Color(0, 200, 0, 255)
local COLOR_RGMBLACK = Color(0, 0, 0, 255)
local OUTLINE_WIDTH = 1
local COLOR_RGMGREEN = RGM_Constants.COLOR_GREEN
local COLOR_RGMBLACK = RGM_Constants.COLOR_BLACK
local OUTLINE_WIDTH = RGM_Constants.OUTLINE_WIDTH
function DrawBoneName(ent, bone, name)
if not name then

View File

@ -1,8 +1,10 @@
include("shared.lua")
local VECTOR_FRONT = Vector(1, 0, 0)
local COLOR_RGMGREEN = Color(0, 200, 0, 255)
local VECTOR_FRONT = RGM_Constants.VECTOR_FRONT
local COLOR_RGMGREEN = RGM_Constants.COLOR_GREEN
local COLOR_RGMBLACK = RGM_Constants.COLOR_BLACK
local OUTLINE_WIDTH = RGM_Constants.OUTLINE_WIDTH
local ANGLE_ARROW_OFFSET = Angle(0, 90, 90)
local ANGLE_DISC = Angle(0, 90, 0)
@ -60,7 +62,7 @@ function ENT:DrawAngleText(axis, hitpos, startAngle)
local textAngle = mabs(mround((overnine - localized.y) * 100) / 100)
local textpos = hitpos:ToScreen()
draw.SimpleText(textAngle, "HudHintTextLarge", textpos.x + 5, textpos.y, COLOR_RGMGREEN, TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
draw.SimpleTextOutlined(textAngle, "HudDefault", textpos.x + 5, textpos.y, COLOR_RGMGREEN, TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM, OUTLINE_WIDTH, COLOR_RGMBLACK)
end
function ENT:Draw()

View File

@ -6,8 +6,8 @@ AddCSLuaFile("shared.lua")
ENT.DisableDuplicator = true
ENT.DoNotDuplicate = true
local VECTOR_ORIGIN = Vector(0, 0, 0)
local VECTOR_FRONT = Vector(1, 0, 0)
local VECTOR_ORIGIN = vector_origin
local VECTOR_FRONT = RGM_Constants.VECTOR_FRONT
local ANGLE_DISC = Angle(0, 90, 0)
local ANGLE_ARROW_OFFSET = Angle(0, 90, 90)

View File

@ -0,0 +1,10 @@
RGM_Constants = {
COLOR_GREEN = Color(0, 200, 0, 255),
COLOR_YELLOW = Color(255, 255, 0, 255),
COLOR_BLACK = Color(0, 0, 0, 255),
OUTLINE_WIDTH = 1,
VECTOR_ONE = Vector(1, 1, 1),
VECTOR_FRONT = Vector(1, 0, 0),
VECTOR_LEFT = Vector(0, 1, 0),
VECTOR_NEARZERO = Vector(0.01, 0.01, 0.01),
}

View File

@ -1,8 +1,8 @@
RGMGIZMOS = {}
local VECTOR_FRONT = Vector(1, 0, 0)
local VECTOR_SIDE = Vector(0, 1, 0)
local COLOR_YELLOW = Color(255, 255, 0, 255)
local VECTOR_FRONT = RGM_Constants.VECTOR_FRONT
local VECTOR_SIDE = RGM_Constants.VECTOR_LEFT
local COLOR_YELLOW = RGM_Constants.COLOR_YELLOW
----------------
-- BASE GIZMO --

View File

@ -938,9 +938,11 @@ function TOOL.BuildCPanel(CPanel)
end
local COLOR_RGMGREEN = Color(0, 200, 0, 255)
local VECTOR_FORWARD = Vector(1, 0, 0)
local VECTOR_LEFT = Vector(0, 1, 0)
local COLOR_RGMGREEN = RGM_Constants.COLOR_GREEN
local COLOR_RGMBLACK = RGM_Constants.COLOR_BLACK
local OUTLINE_WIDTH = RGM_Constants.OUTLINE_WIDTH
local VECTOR_FORWARD = RGM_Constants.VECTOR_FRONT
local VECTOR_LEFT = RGM_Constants.VECTOR_LEFT
function TOOL:DrawHUD()
@ -956,7 +958,7 @@ function TOOL:DrawHUD()
local textpos = { x = pos.x + 5, y = pos.y - 5 }
surface.DrawCircle(pos.x, pos.y, 3.5, COLOR_RGMGREEN)
if ent ~= HoveredEnt then
draw.SimpleText(node.id, "Default", textpos.x, textpos.y, COLOR_RGMGREEN, TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
draw.SimpleTextOutlined(node.id, "Default", textpos.x, textpos.y, COLOR_RGMGREEN, TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM, OUTLINE_WIDTH, COLOR_RGMBLACK)
end
if not node.parent then continue end