aboutsummaryrefslogtreecommitdiff
path: root/examples/system/dynlink/library/cube.c
diff options
context:
space:
mode:
authorJohn "Lameguy" Wilbert Villamor <lameguy64@gmail.com>2022-10-19 17:57:06 +0800
committerGitHub <noreply@github.com>2022-10-19 17:57:06 +0800
commite08a3d9366f8ca14a76b3dd569dac1fb9f569748 (patch)
tree33654513b0b184c27f8035dbc405640fcbeb44ab /examples/system/dynlink/library/cube.c
parentc4a2533d21dfd05cde841ea48c67b05e0e6a853f (diff)
parent9b2ffc6078a850b7d354855cca7622090b41f30c (diff)
downloadpsn00bsdk-e08a3d9366f8ca14a76b3dd569dac1fb9f569748.tar.gz
Merge pull request #59 from spicyjpeg/psxmdec
IRQ handler fix, .STR playback example, multiple library builds (v0.21)
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;