Getting shaders working with lua.
This commit is contained in:
@@ -9,6 +9,7 @@ module('text')
|
||||
module('tileset')
|
||||
module('texture')
|
||||
module('input')
|
||||
module('shader')
|
||||
|
||||
CELL_STATE_DEFAULT = 0
|
||||
CELL_STATE_HOVER = 1
|
||||
@@ -179,19 +180,23 @@ end
|
||||
|
||||
function sceneUpdate()
|
||||
x = x + inputAxis(INPUT_ACTION_LEFT, INPUT_ACTION_RIGHT)
|
||||
y = y + inputAxis(INPUT_ACTION_UP, INPUT_ACTION_DOWN)
|
||||
y = y - inputAxis(INPUT_ACTION_UP, INPUT_ACTION_DOWN)
|
||||
end
|
||||
|
||||
|
||||
function sceneRender()
|
||||
-- Update camera
|
||||
cameraPushMatrix(camera)
|
||||
camera.bottom = screenGetHeight()
|
||||
camera.right = screenGetWidth()
|
||||
|
||||
shaderBind(SHADER_UNLIT)
|
||||
proj = cameraGetProjectionMatrix(camera)
|
||||
shaderSetMatrix(SHADER_UNLIT, SHADER_UNLIT_PROJECTION, proj)
|
||||
view = cameraGetViewMatrix(camera)
|
||||
shaderSetMatrix(SHADER_UNLIT, SHADER_UNLIT_VIEW, view)
|
||||
|
||||
spriteBatchPush(
|
||||
nil,
|
||||
x, y, x + 32, y + 32,
|
||||
x, y,
|
||||
x + 32, y + 32,
|
||||
colorWhite()
|
||||
)
|
||||
|
||||
@@ -251,6 +256,4 @@ function sceneRender()
|
||||
-- end
|
||||
-- end
|
||||
spriteBatchFlush()
|
||||
|
||||
cameraPopMatrix()
|
||||
end
|
||||
Reference in New Issue
Block a user