int main() { x=0; y=0; oldx=0; oldy=0; VDP_loadTileData( (const u32 *)tile1, 1, 1, 0); VDP_setTileMapXY(APLAN, 1, x+2, y+2); JOY_init(); JOY_setEventHandler( &myJoyHandler ); //VDP_drawText("Hello World!", x, y); while(1) { VDP_drawText(" ", oldx, oldy); VDP_drawText("Hello World!", x, y); VDP_setTileMapXY(APLAN, 1, x+2, y+2); VDP_waitVSync(); } return (0); }
static void spritesInit( ) { SMS_displayOff(); paused = false; done = false; SMS_loadTiles(font_lib_bin, FONT_TILE, font_lib_bin_size); SMS_loadBGPalette(shawks_pal_bin); SMS_loadSpritePalette(shawks_pal_bin); JOY_init(); JOY_setPressedCallback(&joyPressed); JOY_setReleasedCallback(&joyReleased); SMS_displayOn(); }
int main() { VDP_setScreenWidth320(); Vector2D speed = { FIX32(0.2), FIX32(0.2) }; Vector2D position = { FIX32( 1), FIX32( 1) }; // Init joy handler JOY_init(); JOY_setEventHandler( &joyAtkHandler ); // Under construction // SPR_init( (4 * 8) + (3 * 3 * 9) ); // Knighty is 2x2 tiles and 8 frames, Wizard is 3x3 and 9 frames SPR_init( (4 * 8) + (3 * 3 * 9) ); draw_arena(); init_player_wizard(140, 128); init_player_knighty(128, 128); spr_players[1] = WIZARD_SPR; spr_players[0] = KNIGHTY_SPR; // game loop while (1) { // directionalInput( &p1, &p2 ); wizard_control(&p1, JOY_1); knighty_control(&p2, JOY_2); bounceCharacter( &speed, &position ); debugPlayers(p1, p2, p1_dir, p2_dir); // control_wizard(&p1); SPR_update(spr_players, 2); // wait for the screen to refresh VDP_waitVSync(); } SPR_end(); return 0; }
int main(){ JOY_init(); beastScrollingFX(); return 0; }
void titleScreen() { snowflake snowflakes[TITLE_SCREEN_SNOWFLAKES]; SpriteDef sfdefs[TITLE_SCREEN_SNOWFLAKES]; VDP_resetScreen(); VDP_resetSprites(); // Load Swirls VDP_loadTileData(swirls, TILE_USERINDEX, 20, TRUE); VDP_loadTileData(title_screen, TILE_USERINDEX + 20, 15, TRUE); VDP_loadTileData(swirl_spr, TILE_USERINDEX + 35, 20, TRUE); VDP_setPalette(PAL1, swirl_pal); VDP_setPalette(PAL2, sel_pal); VDP_setPalette(PAL3, ts_pal); JOY_init(); JOY_setEventHandler(titleHandler); ImageAsset* title = getImage(titlbg); VDP_setPalette(PAL0, title->palette); VDP_loadTileData(title->tiles, TILE_USERINDEX + 55, (title->xTiles * title->yTiles), TRUE); VDP_fillTileMapRectInc(VDP_PLAN_B, TILE_ATTR_FULL(PAL0, PRIORITY_LOW, FALSE, FALSE, TILE_USERINDEX + 55), 0, 0, title->xTiles, title->yTiles); MEM_free( title ); VDP_fillTileMapRectInc(VDP_PLAN_A, TILE_ATTR_FULL(PAL3, PRIORITY_LOW, FALSE, FALSE, TILE_USERINDEX + 20), 18, 3, 5, 3); VDP_drawText("Mega Swirl", 1, 7); VDP_drawText("Testing Demo", 1, 8); VDP_drawText(VERSION_STRING, 1, 9); VDP_drawText("Music from Deflemask by", 1, 11); VDP_drawText("Delek", 1, 12); VDP_drawText("Featuring artwork by", 1, 14); VDP_drawText("Radioactivemantaray", 1, 15); VDP_drawText("- Press Start to Play -", 1, 21); VDP_drawText(BUILD_DATE, 1, 24); u8 selected_swirl; for(int i = 0; i != TITLE_SCREEN_SNOWFLAKES; i++) { snowflakes[i].startedAt = snowflakes[i].startDelay = snowflakes[i].fallRate = snowflakes[i].swirltype = 0; sfdefs[i].posx = sfdefs[i].posy = sfdefs[i].tile_attr = sfdefs[i].size = sfdefs[i].link = 0; selected_swirl = (custrand() % 4); snowflakes[i].swirltype = selected_swirl; // Select one of four swirl types snowflakes[i].startDelay = ((custrand() % 3000) + 1) / 300; // Select between a 1-10 second delay (300 ticks per second) snowflakes[i].startedAt = getTick(); // Time when this snowflake was created snowflakes[i].fallRate = (custrand() % 2) + 1; // Select how fast this snowflake should fall to the bottom of the screen sfdefs[i].posx = (custrand() % 320); // Select X position for this swirl sfdefs[i].posy = -16; // Start it off screen sfdefs[i].size = SPRITE_SIZE(2, 2); sfdefs[i].tile_attr = TILE_ATTR_FULL(PAL1, PRIORITY_HIGH, FALSE, FALSE, TILE_USERINDEX + 35 + (4 * selected_swirl)); // This will need to be changed as we need tiles arranged for sprites if(i != 0) { sfdefs[i - 1].link = i; } } VDP_setSpritesDirect(0, sfdefs, TITLE_SCREEN_SNOWFLAKES); Z80_loadDriver(Z80_DRIVER_VGM, 1); Z80_requestBus(1); YM2612_enableDAC(); Z80_releaseBus(); SND_startPlay_VGM(muz_title); while (waitflag == FALSE) { for(int i = 0; i != TITLE_SCREEN_SNOWFLAKES; i++) { if(getTick() - snowflakes[i].startedAt >= snowflakes[i].startDelay) { if(sfdefs[i].posy != 240) { sfdefs[i].posy = sfdefs[i].posy + snowflakes[i].fallRate; } else { selected_swirl = (custrand() % 4); snowflakes[i].startDelay = ((custrand() % 3000) + 1) / 300; snowflakes[i].startedAt = getTick(); snowflakes[i].fallRate = (custrand() % 2) + 1; sfdefs[i].posx = (custrand() % 320); sfdefs[i].posy = -16; } } VDP_setSpritesDirect(0, sfdefs, TITLE_SCREEN_SNOWFLAKES); } } waitflag = FALSE; srand(GET_HVCOUNTER); VDP_clearPlan(APLAN, FALSE); JOY_setEventHandler(joyHandler); ImageAsset* test = getImage(swlspace); VDP_setPalette(PAL0, test->palette); VDP_loadTileData(test->tiles, TILE_USERINDEX + 55, (test->xTiles * test->yTiles), TRUE); VDP_fillTileMapRectInc(VDP_PLAN_B, TILE_ATTR_FULL(PAL0, PRIORITY_LOW, FALSE, FALSE, TILE_USERINDEX + 55), 0, 0, test->xTiles, test->yTiles); MEM_free( test ); SND_stopPlay_VGM(); }