Rendering a moving square entirely from lua.
This commit is contained in:
@@ -7,11 +7,18 @@
|
||||
#include "assert/assert.h"
|
||||
#include "util/memory.h"
|
||||
|
||||
#include "display/camera.h"
|
||||
#include "display/screen.h"
|
||||
|
||||
scene_t SCENE;
|
||||
|
||||
camera_t cam;
|
||||
|
||||
errorret_t sceneInit(void) {
|
||||
memoryZero(&SCENE, sizeof(scene_t));
|
||||
|
||||
cameraInitOrthographic(&cam);
|
||||
|
||||
errorChain(scriptContextInit(&SCENE.scriptContext));
|
||||
errorOk();
|
||||
}
|
||||
@@ -32,9 +39,16 @@ void sceneRender(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
cam.orthographic.right = SCREEN.width;
|
||||
cam.orthographic.bottom = SCREEN.height;
|
||||
cam.orthographic.left = 0.0f;
|
||||
cam.orthographic.top = 0.0f;
|
||||
cameraPushMatrix(&cam);
|
||||
|
||||
errorret_t err = scriptContextCallFunc(
|
||||
&SCENE.scriptContext, "sceneRender", NULL, 0, NULL
|
||||
);
|
||||
cameraPopMatrix();
|
||||
errorCatch(errorPrint(err));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user