Is there any way to change the cursor icon when a derma is open?
Can I add custom cursors?
No, those are operating system cursors. You have to set it to none and then draw your own cursor.
D:
[editline]5th December 2010[/editline]
How would I trace where the players mouse should be?
[editline]5th December 2010[/editline]
because I could just draw the texture to the screen with DrawTexturedQuad, then set the position of the players mouse so that they just cant see their own?
[lua]gui.MousePos()[/lua]
[lua]if mainframe:IsActive() then
hook.Add("HUDPaint", "mouse", function()
local mousetexture = surface.GetTextureID("weed")
local pos = gui.MousePos()
surface.SetDrawColor(255, 255, 255, 255)
surface.SetTexture( mousetexture )
surface.DrawTexturedRect(pos.x, pos.y, 32, 32)
end)
end[/lua]
so something like that?
Big mouse icon, but it looks right... Try it?
Didn't work :( no errors.
Maybe it's being drawn underneath your panel?
But what about the gui.MousePos()?
Draw it on your panels Paint() function.
don't do surface.GetTextureID("weed") inside the hudpaint hook, holy shit
[code][lua\autorun\client\bhop.lua:45] attempt to index local 'pos' (a number value)
[/code]
I get spammed with that in my console, line 45 is "surface.DrawTexturedRect(pos.x, pos.y, 32, 32)"
It may be that I'm not using a DFrame, I have custom vgui panels except I vgui.Reigster("FTFrame", FTPANEL, "DFrame") so it should inherit paint methods from DFrame right?
all panels have a paint function, Use pos.X and pos.Y <- Capital variables
ok ill try that real quick
[editline]5th December 2010[/editline]
same errors, same line
I think it returns 2 variables instead of a table so do this,
local x, y = gui.MousePos()
gui.MousePos returns two numbers.
[code]x, y = gui.MousePos( )[/code]
ok then just x, y, blah, blah. ill try that
[editline]5th December 2010[/editline]
Now it works, but its not on top my mouse its far away
How far away is it? Is it a fixed distance? If so, you can do x-16 or however much is necessary in the DrawTexturedRect function.
yeah I think its a fixed distance, except the only issue is that you dont see it if your mouse isnt over the menu, so I think that taking it out of the .Paint function would be better, what do you guys think?
[editline]5th December 2010[/editline]
[lua] if mainframe:IsVisible() then
local mousetexture = surface.GetTextureID("weed")
hook.Add("HUDPaint", "mouse", function()
x, y = gui.MousePos( )
surface.SetDrawColor(255, 255, 255, 255)
surface.SetTexture( mousetexture )
surface.DrawTexturedRect(x, y, 32, 32)
end)
end[/lua]
That worked, except it draws behind my menu, and the other mouse still shows, how can I make it draw in front of everything else? and I could use SetCursor("none") for the other issue probably
Probably not the best solution but a possibility:
Create a base frame which inherits whatever that has your mouse drawing in its paint function, then base your other frames on that.
(may have to create more than one, for each type (DPanel, DButton, DWhatever))
or, I could set the cursor for a DFrame thats on top of them all, but just transparent?
[editline]5th December 2010[/editline]
then i couldnt click on the menu below :(
[editline]5th December 2010[/editline]
also when I click my mouse the texture goes to the top left hand corner of my screen, maybe because the mouse disappears so it has nothing to trace? Also getting the material to be drawn with priority would help solve all this because right now i cannot click anything and i think that its because the material is under my mouse so i just click on the material
Ok I just tested, still same issue, it draws under the real mouse. It is on top the menu now though
Thats because the real cursor is drawn by the OS (iirc, could be wrong) and not by the game.
It will always draw on top unless you disable it.
If it disables it then how will I click?
I se, I'll test it in a bit then. Thanks.
[editline]5th December 2010[/editline]
I get
[code][lua\autorun\client\bhop.lua:49] attempt to call global 'oldVGUICreate' (a nil value)
Hook '1337' Failed: [@lua\autorun\client\bhop.lua:41] bad argument #1 to 'pairs' (table expected, got nil)
[/code]
I may not be doing it right, I just did this
[lua] if mainframe:IsVisible() then
hook.Add("Think", 1337, function()
for _, pnl in pairs(vguiElements) do
if pnl and pnl:IsValid() then
pnl:SetCursor("none")
end
end
end)
function vgui.Create(...)
local pnl = oldVGUICreate(...)
table.insert(vguiElements, pnl)
return pnl;
end
local mousetexture = surface.GetTextureID("weed")
hook.Add("PostRenderVGUI", "mouse", function()
x, y = gui.MousePos( )
surface.SetDrawColor(255, 255, 255, 255)
surface.SetTexture( mousetexture )
surface.DrawTexturedRect(x, y, 32, 32)
end)
end[/lua]
[editline]5th December 2010[/editline]
what about
[lua]if (CLIENT) then
gui.EnableScreenClicker( false )
end[/lua]
Wow what the fuck. Sorry I'm retarded. Also the gui.EnableMouseClicker was just an idea to hide it easier, but it probably just take it away completely.
Sorry, you need to Log In to post a reply to this thread.