int main() { VDP_setScreenWidth256(); VDP_setHInterrupt(0); VDP_setHilightShadow(0); BMP_init(TRUE, PAL0, FALSE); RSE_Logo3DScreen(); }
int main() { char col; JOY_setEventHandler(joyEvent); VDP_setScreenWidth256(); VDP_setHInterrupt(0); VDP_setHilightShadow(0); BMP_init(TRUE, PLAN_A, PAL0, FALSE); paused = 0; col = 0xFF; /* Initialise particules */ baseposx = intToFix16(BMP_WIDTH / 2); baseposy = intToFix16(BMP_HEIGHT / 2); gravity = FIX16(0.4); initPartic(100); /* Do main job here */ while(1) { char str[8]; handleInput(); if (!paused) { // calculates particules physic updatePartic(partics, numpartic); // ensure previous flip buffer request has been started BMP_waitWhileFlipRequestPending(); // can now draw text BMP_showFPS(0); // display particul number intToStr(numpartic, str, 1); BMP_clearText(1, 3, 4); BMP_drawText(str, 1, 3); // display gravity fix16ToStr(gravity, str, 2); BMP_clearText(1, 4, 5); BMP_drawText(str, 1, 4); // clear bitmap BMP_clear(); // draw particules drawPartic(partics, numpartic, col); // swap buffer BMP_flip(1); } else { BMP_drawText("PAUSE", 1, 4); } } }
int main(void) { music_init(); music_play(3); u16 delay_mod = 4; u16 col_inc_cnt = 0; setup(); reset_demo: hint_val = 3; col = 0; col_off = 0; phrase_num = 0; scroll_off = 0; dscroll = 0; term_pos = 0; term_scrolling = 0; sprites_dma_simple(); term_pos = 0; VDP_setHInterrupt(0); VDP_clearPlan(VDP_PLAN_A, 0); VDP_clearPlan(VDP_PLAN_B, 0); // Greyscale palette for text VDP_setPaletteColor(0,0x000); VDP_setPaletteColor(1,0x444); VDP_setPaletteColor(2,0x888); VDP_setPaletteColor(3,0xEEE); VDP_setScreenWidth256(); bios_boot_demo(); VDP_setScreenWidth320(); VDP_clearPlan(VDP_PLAN_A, 0); VDP_clearPlan(VDP_PLAN_B, 0); awful_put_logo(8, 2); startup_stretch(); VDP_setVerticalScroll(PLAN_A, 252); VDP_setVerticalScroll(PLAN_B, 252); VDP_setHIntCounter(hint_val); SYS_setHIntCallback((_voidCallback *)h_int); volatile u8 p1 = pad_read(0); sprites_init(); col_puts40(8,0,"Computer Science House"); // Initialize background stars star stars[NUM_STARS]; u16 i = 0; for (i = 0; i < NUM_STARS; i++) { stars[i].x = i * 5; stars[i].y = 128 + i * 8; stars[i].speed = (i % 7) + 1; stars[i].offset = (3 * i) % 4; stars[i].size = (i % 4 == 0) ? ('.' + COL_FONT_VRAM_OFFSET) : (128 + '.' + COL_FONT_VRAM_OFFSET); } print_phrase(8); u16 delay = 0; u8 dir = 0; VDP_setHInterrupt(1); for (;;) { delay++; if (col_inc_cnt == 0) { col_inc_cnt = hint_val; col_off += 0x002; } else { col_inc_cnt--; } if (delay == 512) { if (phrase_num == 8) { phrase_num = 0; VDP_setHInterrupt(0); sprite_set(0, 0, 0, 0, 0, 0); sprites_dma_simple(); while (vbl_wait) { __asm__("nop"); } vbl_wait = 1; goto reset_demo; } hint_val++; if (hint_val == 10) { hint_val = 3; } delay_mod = delay_mod >> 1; if (delay_mod == 0) { delay_mod = delay_mod = 4; } VDP_setHIntCounter(hint_val); VDP_setHInterrupt(0); print_phrase(phrase_num); VDP_setHInterrupt(1); phrase_num++; delay = 0; } process_stars(&stars); while (vbl_wait) { __asm__("nop"); } VDP_setHInterrupt(0); VDP_setPaletteColor(14,palette[col]); col = col_off; vbl_wait = 1; sprites_dma_simple(); VDP_setHInterrupt(1); } return 0; }
int main() { char str[16]; VDP_setScreenWidth256(); VDP_setHInterrupt(0); VDP_setHilightShadow(0); // speed up controller checking JOY_setSupport(PORT_1, JOY_SUPPORT_6BTN); JOY_setSupport(PORT_2, JOY_SUPPORT_OFF); JOY_setEventHandler(handleJoyEvent); BMP_init(TRUE, PAL0, FALSE); camdist = FIX16(15); M3D_reset(); M3D_setCamDistance(camdist); M3D_setLightEnabled(1); M3D_setLightXYZ(FIX16(0.9), FIX16(0.9), FIX16(-0.9)); // allocate translation and rotation structure M3D_setTransform(&transformation, &translation, &rotation); M3D_setTranslation(&transformation, FIX16(0), FIX16(0), FIX16(20)); M3D_setRotation(&transformation, FIX16(0), FIX16(0), FIX16(0)); flatDrawing = 0; while (1) { doActionJoy(JOY_1, JOY_readJoypad(JOY_1)); M3D_setCamDistance(camdist); // do work here rotation.x += rotstep.x; rotation.y += rotstep.y; rotation.z += rotstep.z; transformation.rebuildMat = 1; updatePointsPos(); // ensure previous flip buffer request has been started BMP_waitWhileFlipRequestPending(); BMP_showFPS(1); BMP_clear(); drawPoints(0xFF); BMP_drawText("trans z:", 0, 2); fix16ToStr(translation.z, str, 2); BMP_drawText(str, 10, 2); BMP_drawText("cam dist:", 0, 3); fix16ToStr(camdist, str, 2); BMP_drawText(str, 11, 3); BMP_flip(1); } }