Created
August 18, 2020 18:51
-
-
Save superqix/8b918868da5aab72b8e296e255bd32a5 to your computer and use it in GitHub Desktop.
Full Screen Frame Buffer attempt for Solar2d via Snapshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Frame Buffer attempt via Snapshot | |
-- USAGE | |
-- require("render") | |
-- This module adds everything from the stage to a | |
-- "render" snapshot that updates at 60FPS, think of | |
-- it as a fake "frame buffer" | |
-- Touches don't work. ContentBounds, localToContent are | |
-- all broken due to the shift of child objects by | |
-- -centerX, -centerY | |
local width = display.actualContentWidth | |
local height = display.actualContentHeight | |
local centerX, centerY = display.contentCenterX, display.contentCenterY | |
local render = display.newSnapshot(width, height) | |
render.anchorX, render.anchorY = 0,0 | |
render.x, render.y = display.screenOriginX, display.screenOriginY | |
render.fill.effect = "filter.bulge" -- your custom Filter Effect goes here | |
render.fill.effect.intensity = 1.4 | |
render._isRenderer = true | |
local function enterFrame(event) | |
render:toFront() | |
-- add anything new to the render queue | |
for i = 1, display.currentStage.numChildren do | |
local child = display.currentStage[i] | |
if child and not child._isRenderer then | |
render.group:insert(child) | |
child:translate(-centerX, -centerY) | |
end | |
end | |
render:invalidate() | |
end | |
Runtime:addEventListener("enterFrame", enterFrame) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment