aboutsummaryrefslogtreecommitdiff
path: root/examples/system/dynlink/library/cube.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/system/dynlink/library/cube.c')
-rw-r--r--examples/system/dynlink/library/cube.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/examples/system/dynlink/library/cube.c b/examples/system/dynlink/library/cube.c
index 84fe552..22a805f 100644
--- a/examples/system/dynlink/library/cube.c
+++ b/examples/system/dynlink/library/cube.c
@@ -81,16 +81,18 @@ static SVECTOR rot = { 0 };
static VECTOR pos = { 0, 0, 400 };
static MATRIX mtx, lmtx;
-void init(CONTEXT *ctx) {
+void init(RenderContext *ctx) {
+ Framebuffer *db = &(ctx->db[ctx->db_active]);
+
InitGeom();
- gte_SetGeomOffset(ctx->xres / 2, ctx->yres / 2);
- gte_SetGeomScreen(ctx->xres / 2);
+ gte_SetGeomOffset(db->draw.clip.w / 2, db->draw.clip.h / 2);
+ gte_SetGeomScreen(db->draw.clip.w / 2);
gte_SetBackColor(63, 63, 63);
gte_SetColorMatrix(&color_mtx);
}
-void render(CONTEXT *ctx, uint16_t buttons) {
+void render(RenderContext *ctx, uint16_t buttons) {
RotMatrix(&rot, &mtx);
TransMatrix(&mtx, &pos);
MulMatrix0(&light_mtx, &mtx, &lmtx);
@@ -104,8 +106,8 @@ void render(CONTEXT *ctx, uint16_t buttons) {
rot.vx += step;
rot.vz += step;
- DB *db = &(ctx->db[ctx->db_active]);
- POLY_F4 *pol4 = (POLY_F4 *) ctx->db_nextpri;
+ Framebuffer *db = &(ctx->db[ctx->db_active]);
+ POLY_F4 *pol4 = (POLY_F4 *) ctx->db_nextpri;
for (uint32_t i = 0; i < CUBE_FACES; i++) {
int32_t p;