Team Spartan Cookies & Milk Forums
Function Request - Printable Version

+- Team Spartan Cookies & Milk Forums (https://teamscm.co.uk)
+-- Forum: Garry's Mod (https://teamscm.co.uk/forum-4.html)
+--- Forum: Starfall (https://teamscm.co.uk/forum-7.html)
+--- Thread: Function Request (/thread-1874.html)



Function Request - 4N0NYM - 06-08-2016

Hey a Small Suggestion;
could be there add a function for Highres so that the Screen first detect if the Player can see highres and then set it to Highres or Normal ?

not sure if that can be done.


i did Try it with this, but it didnt work :




--@name


function drawHighres()

--@highres
end



if CLIENT then


function Render()

render.clear()
render.setColor(255,255,255)

render.drawRect(256,256,150,150)
if render.getIsHighRes() == true then
render.setColor(255,0,0)
render.drawRect(256,256,150,150)
end


end


A,B = render.getScreenRes()

print(A,B)

if A > 1024 and B > 1024 then

drawHighres()

timer.create("drawScreen",1,1,function() hook("render","render",Render) end)
elseif A < 1024 and B < 1024 then

timer.create("drawScreen",1,1,function() hook("render","render",Render) end)
end


end



RE: Function Request - TheOneAndOnlyTee - 06-08-2016

(06-08-2016, 03:42 AM)4N0NYM Wrote:

--@name


function drawHighres()

--@highres
end



if CLIENT then


function Render()

render.clear()
render.setColor(255,255,255)

render.drawRect(256,256,150,150)
if render.getIsHighRes() == true then
render.setColor(255,0,0)
render.drawRect(256,256,150,150)
end


end


A,B = render.getScreenRes()

print(A,B)

if A > 1024 and B > 1024 then

drawHighres()

timer.create("drawScreen",1,1,function() hook("render","render",Render) end)
elseif A < 1024 and B < 1024 then

timer.create("drawScreen",1,1,function() hook("render","render",Render) end)
end


end

   

so people can read it;

--@name
function drawHighres()
--@highres
end

if CLIENT then
function Render()
render.clear()
render.setColor(255,255,255)
render.drawRect(256,256,150,150)
if render.getIsHighRes() == true then
render.setColor(255,0,0)
render.drawRect(256,256,150,150)
end
end

A,B = render.getScreenRes()
print(A,B)

if A > 1024 and B > 1024 then
drawHighres()
timer.create("drawScreen",1,1,function() hook("render","render",Render) end)
elseif A < 1024 and B < 1024 then
timer.create("drawScreen",1,1,function() hook("render","render",Render) end)
end
end



RE: Function Request - Knight - 06-08-2016

(06-08-2016, 04:03 AM)T-18 Wrote: so people can read it;

You always write such pretty code :)


RE: Function Request - Kosmos - 06-08-2016

There is a function for that:
Code:
--@highres
This won't set the screen to highres if the user can't see it. If you want to enable/disable highres during code you need to write a specialized emitter which uses a rendertarget.
Oh, and obviously (for screens) you can test if you're in hig-res mode with
Code:
render.getIsHighRes()



RE: Function Request - Person8880 - 06-08-2016

To add to what Kosmos said, the pre-processor directives are not code. You can't conditionally execute them, as they're just meta-data that tells Starfall what needs to be setup before any code is executed.

Thus, putting --@highres in a function is meaningless.