优化 渲染区

This commit is contained in:
baidwwy 2021-05-08 02:31:14 +08:00
parent 78a85d4a67
commit e506284e5a
2 changed files with 14 additions and 7 deletions

View File

@ -1,7 +1,7 @@
--[[ --[[
@Author : baidwwy @Author : baidwwy
@Date : 2021-02-11 11:49:09 @Date : 2021-02-11 11:49:09
@LastEditTime : 2021-05-06 16:42:43 @LastEditTime : 2021-05-08 02:20:11
--]] --]]
local SDL = require("SDL") local SDL = require("SDL")
@ -113,15 +113,11 @@ function SDL渲染:置渲染区(tex)
self._tg = tex self._tg = tex
return self._rd:SetRenderTarget(tex:()) return self._rd:SetRenderTarget(tex:())
end end
self._rd:SetRenderTarget()
end end
function SDL渲染:渲染结束() function SDL渲染:渲染结束()
if self._rd then if self._rd then
if self._tg then
self._rd:SetRenderTarget()
self._rd:RenderCopy(self._tg:());
self._tg = nil
end
self._rd:RenderPresent() self._rd:RenderPresent()
else else
self._win:UpdateWindowSurface() self._win:UpdateWindowSurface()

View File

@ -1,7 +1,7 @@
--[[ --[[
@Author : GGELUA @Author : GGELUA
@Date : 2020-01-08 21:52:58 @Date : 2020-01-08 21:52:58
@LastEditTime : 2021-05-03 10:45:15 @LastEditTime : 2021-05-08 02:20:23
--]] --]]
local _ENV = require("SDL") local _ENV = require("SDL")
IMG_Init() IMG_Init()
@ -92,4 +92,15 @@ end
function SDL纹理:到精灵() function SDL纹理:到精灵()
return require("SDL.精灵")(self) return require("SDL.精灵")(self)
end end
function SDL纹理:渲染清除(r,g,b,a)
if self._access==TEXTUREACCESS_TARGET then
self._win:(self._tex)
return self._win:(r,g,b,a)
end
end
function SDL纹理:渲染结束()
self._win:()
end
return SDL纹理 return SDL纹理