void wsh_panel_window_dui::set_configuration(ui_element_config::ptr data) { ui_element_config_parser parser(data); abort_callback_dummy abort; load_config(&parser.m_stream, parser.get_remaining(), abort); // FIX: If window already created, DUI won't destroy it and create it again. if (m_hwnd) { update_script(); } }
void run_play() { sp1_ClearRectInv(&cr, BRIGHT | INK_WHITE | PAPER_BLACK, 32, SP1_RFLAG_TILE | SP1_RFLAG_COLOUR); sp1_UpdateNow(); sp1_SetPrintPos(&ps0, 0, 0); sp1_PrintString(&ps0, ptiles); // setup the game sprites[PLAYER].x = 15 * 8; sprites[PLAYER].y = 20 * 8; sprites[PLAYER].frame = 0; sprites[PLAYER].delay = 0; sprites[PLAYER].sprite = player; update_player(); horde_count = 0; wave_delay = 0; wave = 0; score = 0; lives = 3; invulnerable = 0; update_score(); while(1) { // TODO: pause/resume if (in_inkey() == 12) // exit current game break; key = (joyfunc)(&joy_k); if (key & IN_STICK_LEFT && !(key & IN_STICK_RIGHT)) { if (sprites[PLAYER].x - 4 > ORIGINX) { sprites[PLAYER].x -= 4; sprites[PLAYER].frame = 2; sprites[PLAYER].delay = 4; update_player(); } } if (key & IN_STICK_RIGHT && !(key & IN_STICK_LEFT)) { if (sprites[PLAYER].x + 16 + 8 + 4 < WIDTH) { sprites[PLAYER].x += 4; sprites[PLAYER].frame = 1; sprites[PLAYER].delay = 4; update_player(); } } if (cooldown > 0) --cooldown; if (key & IN_STICK_FIRE && !cooldown) { // fire rate cooldown = 10; add_bullet(ST_BULLET, sprites[PLAYER].x + 4, sprites[PLAYER].y - 2); playfx(FX_FIRE); } // change the frame to normal? if (sprites[PLAYER].delay) { if (!--sprites[PLAYER].delay) { sprites[PLAYER].frame = 0; update_player(); } } update_horde(); update_sprites(); update_script(); if (invulnerable > 0) { // will be 0, but in case of "the unexpected" if (lives <= 0) { // GAME OVER // some noise playfx(FX_EXPLO); playfx(FX_EXPLO); playfx(FX_EXPLO); // we don't want the player to miss the game over music in_wait_nokey(); sp1_SetPrintPos(&ps0, 11, 8); sp1_PrintString(&ps0, "\x14\x46" "G A M E O V E R"); sp1_UpdateNow(); dzx7_standard(song2, TEMPMEM); ntropic_play(TEMPMEM, 0); for (i = 0; i < 32; ++i) wait(); // leave the game break; } --invulnerable; update_player(); } wait(); intrinsic_halt(); // inline halt without impeding optimizer sp1_UpdateNow(); } destroy_type_sprite(ST_ALL); collect_sprites(); // the player sprite is never destroyed, so hide it sp1_MoveSprAbs(sprites[PLAYER].s, &cr, NULL, 0, 34, 0, 0); sp1_UpdateNow(); sp1_ClearRectInv(&cr, BRIGHT | INK_BLACK | PAPER_BLACK, 32, SP1_RFLAG_TILE | SP1_RFLAG_COLOUR); sp1_UpdateNow(); }