Code: Select all
local testtex = "LuaUI/Images/test.png"
function widget:DrawScreen()
if once == false then
local data = gl.TextureInfo( testtex )
echo( "TEXTURE INFO - " .. data.xsize .. ", " .. data.ysize )
-- I have the above code just for debuggin. It outputs -1,-1 for the sizes
once = true
end
DrawTexRect(testxmin, testymin, testxmax, testymax, testtex, 0.3)
end
-- Credit goes to jK and zwzsg for this function. This code was taken
-- from their "kp_buildbar.lua" file from their "Kernel Panic" mod for
-- the Spring engine.
function DrawTexRect(left,top,right,bottom, texture, alpha)
gl.Texture(true)
gl.Texture(texture)
gl.Color(1,1,1,alpha or 1)
gl.TexRect(left,bottom,right,top)
gl.Color(1,1,1,1)
gl.Texture(false)
end