Hi forum, I recently took a look at Garry's code in github, and what I see there was that I can make:
[code]
function TOOL:DrawToolScreen(w, h)
--- call some stuff from the surface library in here
surface.DrawCircle( w / 2, h / 2, (w / 2 + h / 2) / 2, Color(255,0,255,255))
end
[/code]
Basically overrides the default render and it can be used to make yr custom tool screens.
So As I call the function, How to initialize it using black color, which then I can draw on?
For now I am drawing on the Default Toolgun screen texture
( The one with Windows XP window and small letters on swamp-green base color where the Tool's name is scrolling)
and getting the Cyan circle above with radius of ~ 128.
Any Ideas ??
[QUOTE=Tomelyr;46309563][URL="http://wiki.garrysmod.com/page/draw/RoundedBox"]draw.Roundedbox[/URL][/QUOTE]
That will lead to """"draw.RoundedBox(0, 0, 0, w, h, Color(0,0,0,255) )""""
[editline]23rd October 2014[/editline]
Is
[url]http://wiki.garrysmod.com/page/draw/NoTexture[/url]
a better option, coz I don't need the texture ...
Maybe i understood it wrong. So you got an Mode for the Toolgun and you are trying to paint the Screen Black?
[QUOTE=Tomelyr;46309748]Maybe i understood it wrong. So you got an Mode for the Toolgun and you are trying to paint the Screen Black?[/QUOTE]
I want to initialize the Toolgun's screen with black instead of the default one.
I am thinking of something like ...
[code]
draw.NoTexture()
draw.RoundedBox(0, 0, 0, w, h, Color(0,0,0,255))
[/code]
Reset it, then draw Black .... and ... it sets it to black
a bit of an disclaimer: i never even tried to do such a thing, so all i wrote are ideas.
The STool itself draws the Screen here:
[url]https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/sandbox/entities/weapons/gmod_tool/cl_viewscreen.lua#L44[/url]
as you can see, the function is just called inside an cam2d
so you could try
[lua]surface.SetDrawColor( 255, 255, 255, 255 )
surface.DrawRect( 0, 0, w, h)
[/lua]
[QUOTE=Tomelyr;46309844]a bit of an disclaimer: i never even tried to do such a thing, so all i wrote are ideas.
The STool itself draws the Screen here:
[url]https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/sandbox/entities/weapons/gmod_tool/cl_viewscreen.lua#L44[/url]
as you can see, the function is just called inside an cam2d
so you could try
[lua]surface.SetDrawColor( 255, 255, 255, 255 )
surface.DrawRect( 0, 0, w, h)
[/lua][/QUOTE]
Basicly I can see that there we got:
[lua]
-- Background
surface.SetDrawColor( 255, 255, 255, 255 )
surface.SetTexture( surface.GetTextureID( "models/weapons/v_toolgun/screen_bg" ) )
surface.DrawTexturedRect( 0, 0, TEX_SIZE, TEX_SIZE )
[/lua]
So I guess I need just the Black texture instead of "models/weapons/v_toolgun/screen_bg"
[QUOTE=dvd_video;46310939]
So I guess I need just the Black texture instead of "models/weapons/v_toolgun/screen_bg"[/QUOTE]
Or you could create an black Material via [url]http://wiki.garrysmod.com/page/Global/CreateMaterial[/url]